📄 psat.m
字号:
'plotsel',0, ... 'threed',0, ... 'equiv',0, ... 'bus',0);% Component Structures% clear CompComp.prop = [];Comp.n = 0;Comp.init = 0;Comp.descr = '';Comp.name = '';Comp.shunt = 1;Comp.series = 0;if ~command_line_psat set(hdlp,'XData',[8 8 107 107 8]) set(htxt,'String','Initializing "namevar[xy].ini"...') drawnowend% Output Variables and Names StructuresVarout = struct('t',[],'vars',[],'idx',[],'surf',0,'hdl',[],'zlevel',0, ... 'movie',[],'alpha',1,'caxis',0,'xb',[],'yb',[]);Varname = struct('compx','','unamex','','fnamex','', ... 'compy','','unamey','','fnamey','', ... 'uvars','','fvars','','nvars',0, ... 'idx',[],'custom',0,'fixed',1, ... 'x',1,'y',1,'P',0,'Q',0, ... 'Pij',0,'Qij',0,'Iij',0,'Sij',0,'pos',[], ... 'areas',0,'regions',0);% SnapshotsSnapshot = struct('name','', 'time',Settings.t0, ... 'y',[], 'x', [], 'Ybus', [], 'Pg', [], ... 'Qg', [], 'Pl', [], 'Ql', [], ... 'Gy', [], 'Fx', [], 'Fy', [], 'Gx', [], ... 'Ploss', [], 'Qloss', [], 'it', 0);filemode = 'rt';% State variable namesfid = fopen([Path.psat,'namevarx.ini'],filemode);if fid == -1, disp('#Error: File "namevarx.ini" cannot be open.') failed = 1;else nname = 0; while 1 sline = fgetl(fid); if ~ischar(sline), break; end try Varname.unamex{nname+1,1} = deblank(sline(1:20)); Varname.fnamex{nname+1,1} = deblank(sline(21:40)); Varname.compx{nname+1,1} = deblank(sline(41:end)); if Settings.octave & strcmp(Varname.compx{nname+1,1}(end),'\r') Varname.compx{nname+1,1} = Varname.compx{nname+1,1}(1:end-1); end nname = nname + 1; catch % nothing to do ... end end count = fclose(fid);end% Algebraic variable namesfid = fopen([Path.psat,'namevary.ini'],filemode);if fid == -1, disp('#Error: File "namevary.ini" cannot be open.') failed = 1;else nname = 0; while 1 sline = fgetl(fid); if ~ischar(sline), break; end try Varname.unamey{nname+1,1} = deblank(sline(1:20)); Varname.fnamey{nname+1,1} = deblank(sline(21:40)); Varname.compy{nname+1,1} = deblank(sline(41:end)); if Settings.octave & strcmp(Varname.compy{nname+1,1}(end),'\r') Varname.compx{nname+1,1} = Varname.compy{nname+1,1}(1:end-1); end nname = nname + 1; catch % nothing to do ... end end count = fclose(fid);endif ~command_line_psat set(hdlp,'XData',[8 8 140 140 8]) set(htxt,'String','Initializing "history.ini"...') drawnowendfid = 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 Settings.octave sline = sline(1:end-1); end 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,'XData',[8 8 173 173 8]) set(htxt,'String','Initializing "comp.ini"...') drawnowend% 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.names{ncomp+1,1} = deblank(sline(1:21)); Comp.prop(ncomp+1,:) = str2num(sline(22:38)); ncomp = ncomp + 1; catch % nothing to do ... end end count = fclose(fid); Comp.names{ncomp+1} = 'PV'; Comp.prop(ncomp+1,:) = [2 1 0 1 0 1 0 0 0]; Comp.names{ncomp+2} = 'SW'; Comp.prop(ncomp+2,:) = [2 1 0 1 0 1 0 0 0]; Comp.n = ncomp + 2;endif ~command_line_psat set(hdlp,'XData',[8 8 206 206 8]) set(htxt,'String','Initializing global structures...') drawnowendif ~isunix & Settings.hostver >= 7 & sum(Theme.color09) < 0.3 Theme.color09 = [0 0 0];end% Differential Algebraic Equations structureDAE = struct('x',[], ... 'y',[], ... 'kg',0, ... 'lambda',0, ... 'm',0, ... 'n',0, ... 'npf',0, ... 'g',[], ... 'f',[], ... 'Gy',[], ... 'Fx',[], ... 'Fy',[], ... 'Fl',[], ... 'Fk',[], ... 'Gx',[], ... 'Gl',[], ... 'Gk',[], ... '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,... 'negload',0,'onlynegload',0,'onlypqgen',0, ... 'areaannualgrowth',0,'regionannualgrowth',0);% 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',[], ... '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, ... 'LMP',[], ... 'NCP',[], ... 'iter',0, ... 'gpc',[], ... 'gqc',[]);OMIB = struct('cm',[],'ncm',[],'mt',[],'pmax',[],'pc',[], ... 'sig',[],'du',[],'tu',[],'margin',0);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, ... 'libinclude', 0, ... 'loaddir',1, ... 'basepl',1, ... 'basepg',1, ... 'line',0, ... 'show',1);GAMS.ldir = ['ldir ',char(92),'~/psat/gams'];% UWPFLOW interfaceUWPFLOW = struct('opt',[],'method',1,'file','psatuw', ... 'command','','status',0);% Structure for librariesLA = struct( ... 'a',[], ... 'b_avr',[], 'b_tg',[], 'b_svc',[], 'b_statcom',[], ... 'b_tcsc',[], 'b_sssc',[], 'b_upfc',[], 'b_hvdc',[], ... 'c_y',[], ... 'd_y',[], ... 'd_avr',[], 'd_tg',[], 'd_svc',[], 'd_statcom',[], ... 'd_tcsc',[], 'd_sssc',[], 'd_upfc',[], 'd_hvdc',[], ... 'h_ps',[], 'h_qs',[], 'h_is',[], 'h_pr',[], 'h_qr',[], 'h_ir',[]);EQUIV = struct( ... 'buslist',[], ... 'custom_file','', ... 'custom_path','', ... 'equivalent_method',1, ... 'area_num',1, ... 'region_num',1, ... 'bus_selection',1, ... 'bus_depth',0, ... 'bus_voltage',220, ... 'island', 0, ... 'gentype', 1, ... 'stop_island',0);if ~command_line_psat set(hdlp,'XData',[8 8 239 239 8]) set(htxt,'String','Initializing classes...') drawnowend% Component classes & structuresBus = BUclass;Areas = ARclass('area');Regions = ARclass('region');SW = SWclass;PV = PVclass;PQ = PQclass;Line = LNclass;Lines = LSclass;Twt = TWclass;Shunt = SHclass;PQgen = PQclass;Demand = DMclass;Supply = SUclass;Fault = FTclass;Breaker = BKclass;Fl = FLclass;if ~command_line_psat set(hdlp,'XData',[8 8 272 272 8]) drawnowendMn = MNclass;Pl = PLclass;Mot = IMclass;Thload = THclass;Ltc = LTclass;Tap = TPclass;Syn = SYclass;Exc = AVclass;Tg = TGclass;Oxl = OXclass;Pss = PSclass;Svc = SVclass;Statcom = STclass;Tcsc = TCclass;Sssc = SSclass;Upfc = UPclass;Hvdc = HVclass;if ~command_line_psat set(hdlp,'XData',[8 8 305 305 8]) drawnowendMass = DSclass;SSR = SRclass;Rmpg = RGclass;Rmpl = RLclass;Rsrv = RSclass;Vltn = VLclass;Ypdp = YPclass;Pod = POclass;COI = CIclass;if ~command_line_psat set(hdlp,'XData',[8 8 338 338 8]) set(htxt,'String','Initializing Simulink Library...') drawnowend% load PSAT Simulink libraryif Settings.matlab & Settings.hostver >= 7 if ~exist('load_system') if exist('simulink') ~= 5 fm_disp('* * Simulink cannot be found on your system.') fm_disp('* * The PSAT-Simulink will not be available.') else fm_disp('* * Problems in loading the PSAT Simulink Library.') end else load_system('fm_lib') endendif failed, disp(' '), disp('PSAT is not properly initialized.')else, if ~command_line_psat, fm_main, endendif ~command_line_psat, close(hdl), endclear failed hdl hdlp a count fid nname sline tipi ncompclear psatver psatdate psatdir lipdir command_line_psat htxt% ----------------------------------------------------------- %% W A R N I N G %% ----------------------------------------------------------- %% Following lines were written by the UDM build utility. %% This utility requires you do NOT change anything beyond %% this point in order to be able to correctly install and %% uninstall UDMs. %% ----------------------------------------------------------- %Sofc = FCclass;Cac = CCclass;Cluster = CLclass;Exload = ELclass;Phs = PHclass;Wind = WNclass;Cswt = CSclass;Dfig = DFclass;Ddsg = DDclass;Busfreq = BFclass;Pmu = PMclass;Jimma = JIclass;Mixload = MXclass;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -