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

📄 autorun.m

📁 用于电力系统的一个很好的分析软件
💻 M
字号:
function check = autorun(msg,type)% AUTORUN properly launch PSAT routine checking for data%         files and previous power flow solutions%% CHECK = AUTORUN(MSG)%         MSG   message to be displayed%         TYPE  0 for static analysis, 1 for dynamic analysis%         CHECK 1 if everything goes fine, 0 otherwise%%Author:    Federico Milano%Date:      29-Oct-2003%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 Settings File Busglobal DAE LIB SNB OPF CPF clpsat Compcheck = 0;% check for data fileif isempty(File.data),  fm_disp(['Set a data file before running ',msg,'.'],2)  returnend% check for initial power flow solutionif ~Settings.init  solvepf  if ~Settings.init, return, endend% check for dynamic components if running a static analysisif ~type & DAE.n & ~clpsat.init  dynlf = sum(prod(Comp.prop(:,[3 6 9]),2));  iscpf = strcmp(msg,'Continuation Power Flow');  if ~Settings.static & ~dynlf    Settings.ok = 0;    uiwait(fm_choice('Dynamic components will be discarded. Continue?'))    if Settings.ok      Settings.static = 1;      solvepf      Settings.static = 0; % reset initial condition    else      return    end  elseif ~Settings.static & ~dynlf & iscpf    Settings.ok = 0;    uiwait(fm_choice(['Dynamic components can lead to numerical ' ...                      'problems, discard?']))    if Settings.ok      Settings.static = 1;      solvepf      Settings.static = 0; % reset initial condition    end  elseif iscpf    Settings.ok = 1;    %uiwait(fm_choice(['Dynamic components can lead to numerical ' ...    %                  'problems, continue?']))    %if ~Settings.ok, return, end  else    uiwait(fm_choice(['Dynamic components are not supported for ' ...                      'static analysis'],2))    return  endend% check for previous CPF & ATC solutionsif strcmp(msg,'SNB Direct Method')  one = 1;else  one = 0;endif CPF.init & ~(one & CPF.init == 1)  switch CPF.init   case 1, met = 'CPF';   case 2, met = 'ATC';   case 3, met = 'N-1 Cont. An.';   case 4, met = 'Continuation OPF (PSAT-GAMS)';  end  Settings.ok = 0;  if clpsat.init    Settings.ok = clpsat.refresh;  else    uiwait(fm_choice([met,' has been run last. Do you want to' ...                      ' restore initial PF solution?']))  end  if Settings.ok    solvepf    fm_disp(['Initial PF solution will be used as ', ...	     'base case solution.'])  else    fm_disp(['Last ',met,' solution will be used as ', ...	     'base case solution.'])  end  CPF.init = 0;end% check for previous time domain simulationsif Settings.init == 2  Settings.ok = 0;  if clpsat.init    Settings.ok = clpsat.refresh;  else    uiwait(fm_choice(['TD has been run last. Do you want to' ...                      ' restore initial PF solution?']))  end  if Settings.ok    solvepf    fm_disp(['Initial PF solution will be used as ', ...	     'base case solution.'])  else    fm_disp('Last TD point will be used as base case solution.')  end  Settings.init = 1;end% check for SNB direct methodif SNB.init  Settings.ok = 0;  if clpsat.init    Settings.ok = clpsat.refresh;  else    uiwait(fm_choice(['SNB direct method has been run last. Do you want to' ...                      ' restore initial PF solution?']))  end  if Settings.ok    solvepf    fm_disp(['Initial PF solution will be used as ', ...	     'base case solution.'])  else    fm_disp('SNB solution will be used as base case solution.')  end  SNB.init = 0;end% check for LIB direct methodif LIB.init  Settings.ok = 0;  if clpsat.init    Settings.ok = clpsat.refresh;  else    uiwait(fm_choice(['LIB direct method has been run last. Do you want to' ...                      ' restore initial PF solution?']))  end  if Settings.ok    solvepf    fm_disp('Initial PF solution will be used as base case solution.')  else    fm_disp('LIB solution will be used as base case solution.')  end  LIB.init = 0;end% check for OPF solutionif strcmp(msg,'Optimal Power Flow')  one = 0;else  one = 1;endif OPF.init & one  Settings.ok = 0;  if clpsat.init    Settings.ok = clpsat.refresh;  else    uiwait(fm_choice(['OPF has been run last. Do you want to' ...                      ' restore initial PF solution?']))  end  if Settings.ok    solvepf    fm_disp(['Initial PF solution will be used as ', ...	     'base case solution.'])  else    fm_disp('OPF solution will be used as base case solution.')  end  OPF.init = 0;endcheck = 1;% ---------------------------------------------------function solvepfglobal Settings Varnamefm_disp('Solve base case power flow...')varname_old = Varname.idx;Settings.show = 0;fm_set('lf')Settings.show = 1;if ~isempty(varname_old)  Varname.idx = varname_old;end

⌨️ 快捷键说明

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