📄 psat.m
字号:
'about',0, ... 'author',0, ... 'opf',0, ... 'line',0, ... 'clock',0, ... 'license',0, ... 'warranty',0, ... 'tviewer',0, ... 'gams',0, ... 'uwpflow',0, ... 'laprint',0);% Component Structures% clear CompComp.funct = cell(5,1);Comp.number = cell(5,1);Comp.prop = [];Comp.n = 0;Comp.init = 0;Comp.descr = '';Comp.name = '';Comp.shunt = 1;if ~command_line_psat set(hdlp, ... 'YData',410-(idx-25)-[20 40 40 20 20], ... 'FaceColor',[0.50 1.00-idx/600 0.50+idx/600]) idx = idx + 30; pause(0.1)end% Output Variables and Names StructuresVarout = struct('t',[], ... 'x',[], ... 'V',[], ... 'ang',[], ... 'p',[], ... 'q',[], ... 'prflow',[], ... 'qrflow',[], ... 'psflow',[], ... 'qsflow',[], ... 'Pm',[], ... 'Vf',[]);%clear VarnameVarname.uname = cell(1,1);Varname.fname = cell(1,1);Varname.comp = cell(1,1);Varname.fcomp = cell(1,1);Varname.bus = cell(1,1);Varname.fV = cell(1,1);Varname.uV = cell(1,1);Varname.fang = cell(1,1);Varname.uang = cell(1,1);Varname.fPm = cell(1,1);Varname.uPm = cell(1,1);Varname.fVf = cell(1,1);Varname.uVf = cell(1,1);Varname.uVref = cell(1,1);Varname.fVref = cell(1,1);Varname.uIf = cell(1,1);Varname.fIf = cell(1,1);Varname.fP = cell(1,1);Varname.uP = cell(1,1);Varname.fQ = cell(1,1);Varname.uQ = cell(1,1);Varname.fPflow = cell(1,1);Varname.fQflow = cell(1,1);Varname.uPflow = cell(1,1);Varname.uQflow = cell(1,1);Varname.fx = cell(1,1);Varname.ux = cell(1,1);Varname.fdet = cell(1,1);Varname.udet = cell(1,1);Varname.fautostate = cell(1,1);Varname.uautostate = cell(1,1);Varname.fautojlfr = cell(1,1);Varname.fautojlfdr = cell(1,1);Varname.uautojlfr = cell(1,1);Varname.uautojlfdr = cell(1,1);Varname.fpflf = cell(1,1);Varname.fpflfd = cell(1,1);Varname.upflf = cell(1,1);Varname.upflfd = cell(1,1);Varname.format = cell(1,1);Snapshot = struct('name','', 'time',Settings.t0, 'V',[], ... 'ang',[], 'x', [], 'Y', [], 'Pg', [], ... 'Qg', [], 'Pl', [], 'Ql', [], 'vfd', [], ... 'pmech', [], 'Jlf', [], 'Jlfv', [], ... 'Fx', [], 'Fy', [], 'Gx', [], 'Ploss', [], ... 'Qloss', [], 'it', 0);if Settings.octave filemode = 'rt';else filemode = 'rt';end% Existing component variable namesfid = fopen([Path.psat,'namevar.ini'],filemode);if fid == -1, disp('#Error: File "namevar.ini" cannot be open.') failed = 1;else nname = 0; while 1 sline = fgetl(fid); if ~ischar(sline), break; end try Varname.uname{nname+1,1} = deblank(sline(1:20)); Varname.fname{nname+1,1} = deblank(sline(21:40)); Varname.comp{nname+1,1} = deblank(sline(41:end)); if Settings.octave & strcmp(Varname.comp{nname+1,1}(end),'\r') Varname.comp{nname+1,1} = Varname.comp{nname+1,1}(1:end-1); end nname = nname + 1; catch % nothing to do ... end end count = fclose(fid);endfid = fopen([Path.psat,'history.ini'],filemode);if fid == -1, disp('#Error: File "history.ini" cannot be open.') failed = 1;else while 1 sline = fgetl(fid); if ~ischar(sline), break, end try eval(['History.',sline(1:19),' = ',sline(20:end),';']); catch % nothing to do ... end end count = fclose(fid);endif ~command_line_psat set(hdlp, ... 'YData',410-(idx-25)-[20 40 40 20 20], ... 'FaceColor',[0.50 1.00-idx/600 0.50+idx/600]) idx = idx + 30; pause(0.1)end% Existing component function namesfid = fopen([Path.psat,'fcomp.ini'],filemode);if fid == -1, disp('#Error: File "fcomp.ini" cannot be open.') failed = 1;else tipi = 0; while 1 sline = fgetl(fid); if ~ischar(sline), break end try tipi = tipi + 1; Varname.fcomp{tipi,1} = deblank(sline(1:15)); Varname.format{tipi,1} = sline(16:end); if Settings.octave & strcmp(Varname.format{tipi,1}(end),'\r') Varname.format{tipi,1} = Varname.format{tipi,1}(1:end-1); end catch % nothing to do ... end end fclose(fid);endif ~command_line_psat set(hdlp, ... 'YData',410-(idx-25)-[20 40 40 20 20], ... 'FaceColor',[0.50 1.00-idx/600 0.50+idx/600]) idx = idx + 30; pause(0.1)end% Existing components functionsfid = fopen([Path.psat,'comp.ini'],filemode);if fid == -1, disp('#Error: File "comp.ini" cannot be open.') failed = 1;else ncomp=0; while 1 sline = fgetl(fid); if ~ischar(sline), break; end try Comp.funct{ncomp+1,1} = deblank(sline(1:23)); Comp.number{ncomp+1,1} = [deblank(sline(25:44)),'.n']; Comp.prop(ncomp+1,:) = str2num(sline(46:60)); ncomp=ncomp+1; catch % nothing to do ... end end count = fclose(fid); Comp.funct{ncomp+1} = 'fm_pv'; Comp.number{ncomp+1} = 'PV.n'; Comp.prop(ncomp+1,:) = [1 1 0 0 0 1 0 0]; Comp.funct{ncomp+2} = 'fm_sw'; Comp.number{ncomp+2} = 'SW.n'; Comp.prop(ncomp+2,:) = [1 1 0 0 0 1 0 0]; Comp.n = ncomp+2;endif ~command_line_psat set(hdlp, ... 'YData',410-(idx-25)-[20 40 40 20 20], ... 'FaceColor',[0.50 1.00-idx/600 0.50+idx/600]) idx = idx + 30; pause(0.1)endif ~isunix & Settings.hostver >= 7 & sum(Theme.color09) < 0.3 Theme.color09 = [0 0 0];end% Differential Algebraic Equations structureDAE = struct('a',[], ... 'V',[], ... 'kg',0, ... 'x',[], ... 'n',0, ... 'npf',0, ... 'g',[], ... 'gp',[], ... 'gq',[], ... 'f',[], ... 'glfp',[], ... 'glfq',[], ... 'J11',[], ... 'J12',[], ... 'J21',[], ... 'J22',[], ... 'Jlf',[], ... 'Jlfv',[], ... 'Jlfd',[], ... 'Fx',[], ... 'Fy',[], ... 'Gx',[], ... 'Ac',[], ... 'tn',[], ... 't', -1);% Small Signal Stability Analysis (SSSA) paramtersSSSA = struct('neig',1,'method',1,'map',1,'matrix',4, ... 'report',[],'eigs',[],'pf',[]);% Limit-induced bifurcation (LIB) parametersLIB = struct('type',1,'init',0,'selbus',1, ... 'slack',0,'lambda',0,'dldp',[],'bus',[]);% Saddle-node bifurcation (SNB) parametersSNB = struct('slack',0,'init',0,'lambda',0,'dldp',[], ... 'bus',[]);% Continuation Power Flow structureCPF = struct('method',1,'flow',1,'type',1,'sbus',1, ... 'vlim',0,'ilim',0,'qlim',0,'init',0, ... 'tolc',1e-5,'tolf',0.01,'tolv',5e-3, ... 'step',0.5,'nump',50,'show',1,'linit',0, ... 'lambda',0,'kg',0,'hopf',0,'stepcut',1);% Optimal Power Flow structureOPF = struct('method',2, ... 'flow',1, ... 'type',1, ... 'deltat',30, ... 'lmin',0.1, ... 'lmax',0.8, ... 'sigma',0.2, ... 'gamma',0.95, ... 'eps_mu',1e-10, ... 'eps1',1e-4, ... 'eps2',5e-3, ... 'omega',0, ... 'omega_s','0', ... 'lmin_s','0.1', ... 'fun','', ... 'flatstart',1, ... 'conv',0, ... 'guess',[], ... 'uname','', ... 'fname','', ... 'varout','', ... 'report','', ... 'show',1, ... 'init',0, ... 'w',0, ... 'wp',[], ... 'atc',0, ... 'line',0, ... 'tiebreak',0, ... 'basepg',1, ... 'basepl',1, ... 'enflow',1, ... 'envolt',1, ... 'enreac',1, ... 'vmin', 0.8, ... 'vmax', 1.2, ... 'obj',0, ... 'ms',0, ... 'dy',0, ... 'dF',0, ... 'dG',0, ... 'NCP', [], ... 'iter',0, ... 'gpc',[], ... 'gqc',[]);PMU = struct('method',1, ... 'number',0, ... 'report','', ... 'measv',0, ... 'measc',0, ... 'pseudo',0, ... 'noobs',0, ... 'voltage', '', ... 'angle', '', ... 'location', '');% GAMS interface structureGAMS = struct('method',2, ... 'type',1, ... 'flow',1, ... 'flatstart',1, ... 'lmin', 0.1, ... 'lmin_s','0.1', ... 'omega',0, ... 'omega_s','0', ... 'lmax',0.8, ... 'hours',[], ... 'libinclude', 0, ... 'loaddir',1, ... 'basepl',1, ... 'basepg',1, ... 'line',0, ... 'show',1);if ~Settings.octave GAMS.ldir = ['ldir ',char(92),'~/psat/gams'];else GAMS.ldir = 'ldir \\~/psat/gams';end% UWPFLOW interfaceUWPFLOW = struct('opt',[],'method',1,'file','psatuw', ... 'command','','status',0);% Structures for contributed functionsNLA = struct('tol',1e-5);% Bus StructureBus = struct('con',[],'n',0,'int',[],'Pg',[], ... 'Qg',[],'Pl',[],'Ql',[],'island',[]);% Line structureLine = struct('con',[],'n',0,'Y',[],'Bp',[], ... 'Bpp',[],'from',[],'to',[]);Shunt = struct('con',[],'bus',[],'g',[],'b',[]);Twt = struct('con',[]);% Slack bus structureSW = struct('con',[],'n',0,'bus',[]);% PV bus structurePV = struct('con',[],'n',0,'bus',[],'pq',[],'store',[]);PV.pq = struct('con',[],'n',0,'bus',[]);% PQ bus structurePQ = struct('con',[],'n',0,'bus',[],'P0',[], ... 'Q0',[],'store',[]);% Polinomial Load structurePl = struct('con',[],'n',0,'bus',[],'init',[]);% Monomial Load structureMn = struct('con',[], ... 'n',0, ... 'bus',[], ... 'init',[], ... 'store',[]);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -