⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fm_simtd.m

📁 基于PSAT 软件的多目标最优潮流计算用于中小型电力系统的分析和管理
💻 M
字号:
function fm_simtd(flag)% FM_SIMTD generate data report in Simulink models during time%          domain simulations%% FM_SIMTD(FLAG)%       FLAG: 0 - initialize function and datas%             1 - update variables in the Simulink model%%see also FM_LIB, FM_SIMSET, FM_SIMREP%%Author:    Federico Milano%Date:      05-Oct-2005%Version:   1.0.0%%E-mail:    fmilano@thunderbox.uwaterloo.ca%Web-site:  http://thunderbox.uwaterloo.ca/~fmilano%% Copyright (C) 2002-2006 Federico Milanoglobal File Path DAE Bus Settings clpsatpersistent blocks busidx% silently exit if using command line versionif clpsat.init, return, end% silently exit if the option of updating Simulink models during% time domain simulations is not enforcedif ~Settings.simtd, return, end% silently exit if there is any problemif isempty(File.data), return, endif isempty(findstr(File.data,'(mdl)')), return, endif ~Settings.init, return, endlasterr('');switch flag case 'init' % initializing function  pathlocal = pwd;  cd(Path.data);  filedata = File.data(1:end-5);  open_sys = find_system('type','block_diagram');  donotclose = 0;  for i = 1:length(open_sys),    if strcmp(open_sys{i},filedata),      donotclose = 1;      break    end  end  if ~donotclose,    open_system(filedata);  end  cur_sys = get_param(filedata,'Handle');  blocks = find_system(cur_sys,'Type','block');  %lines = find_system(cur_sys, ...  %                    'FindAll','on', ...  %                    'type','line');  masks = get_param(blocks,'Masktype');  busidx = find(strcmp(masks,'Bus'));  cd(pathlocal) case 'update' % updating voltages  %busidx = find(strcmp(masks,'Bus'));  for i = 1:Bus.n    valore = ['|V| = ', ...              fvar(DAE.V(i),7), ...              ' p.u.\n<V  = ', ...              fvar(DAE.a(i),7), ...              ' rad '];    set_param(blocks(busidx(i)),'AttributesFormatString',valore);  end otherwise  % silently do nothingend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -