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

📄 fm_simtd.m

📁 电力系统分析计算程序
💻 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:    Federico.Milano@uclm.es%Web-site:  http://www.uclm.es/area/gsee/Web/Federico%% Copyright (C) 2002-2008 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');  masks = get_param(blocks,'Masktype');  busidx = find(strcmp(masks,'Bus'));  cd(pathlocal) case 'update' % updating voltages  for i = 1:Bus.n    valore = ['|V| = ', ...              fvar(DAE.y(Bus.v(i)),7), ...              ' p.u.\n<V  = ', ...              fvar(DAE.y(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 + -