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

📄 psat.m

📁 这是一个很适合研究和学习用的电力系统仿真软件
💻 M
📖 第 1 页 / 共 2 页
字号:
fid = 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;
end

if ~command_line_psat
  set(hdlp,'XData',8+idx+[0 0 33 33 0])
  idx = idx + 33;
  pause(0.1)
end

if ~isunix & Settings.hostver >= 7 & sum(Theme.color09) < 0.3
  Theme.color09 = [0 0 0];
end

% Differential Algebraic Equations structure
DAE = 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',[], ...
             'Fl',[], ...
             'Fk',[], ...
             'Gx',[], ...
             'Gl',[], ...
             'Gk',[], ...
             'Ac',[], ...
             'tn',[], ...
	     't', -1);

% Small Signal Stability Analysis (SSSA) paramters
SSSA = struct('neig',1,'method',1,'map',1,'matrix',4, ...
              'report',[],'eigs',[],'pf',[]);

% Limit-induced bifurcation (LIB) parameters
LIB = struct('type',1,'init',0,'selbus',1, ...
             'slack',0,'lambda',0,'dldp',[],'bus',[]);

% Saddle-node bifurcation (SNB) parameters
SNB = struct('slack',0,'init',0,'lambda',0,'dldp',[], ...
             'bus',[]);

% Continuation Power Flow structure
CPF = 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);

% Optimal Power Flow structure
OPF = 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, ...
             '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 structure
GAMS = 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 interface
UWPFLOW = struct('opt',[],'method',1,'file','psatuw', ...
                 'command','','status',0);

% Structures for contributed functions
NLA = struct('tol',1e-8);

% Bus Structure
Bus = struct('con',[],'n',0,'int',[],'Pg',[], ...
             'Qg',[],'Pl',[],'Ql',[],'island',[]);

% Area Structure
Area = struct('con',[],'n',0,'slack',[]);

% Line structure
Line = struct('con',[],'n',0,'Y',[],'Bp',[], ...
              'Bpp',[],'from',[],'to',[]);
Shunt = struct('con',[],'bus',[],'g',[],'b',[]);
Twt = struct('con',[]);

% Component structures
SW = SWclass;
PV = PVclass;
PQ = PQclass;
Fl = FLclass;
PQgen = PQclass;
Demand = DMclass;
Supply = SUclass;
Tg   = TGclass;
Svc  = SVclass;
Statcom = STclass;
Tcsc = TCclass;
Sssc = SSclass;
Upfc = UPclass;

% Polinomial Load  structure
Pl = struct('con',[],'n',0,'bus',[],'init',[]);

% Monomial Load  structure
Mn = struct('con',[], ...
            'n',0, ...
            'bus',[], ...
            'init',[]);

% Transmission Line structure
Lines = struct('con',[],'n',0,'bus1',[],'bus2',[]);

if ~command_line_psat
  set(hdlp,'XData',8+idx+[0 0 33 33 0])
  idx = idx + 33;
  pause(0.1)
end

% Synchronous Machine  structure
Syn = struct('con',[], ...
             'n',0, ...
             'bus',[], ...
             'Id',[], ...
             'Iq',[], ...
             'Pg',[], ...
             'Qg',[], ...
             'J11',[], ...
             'J12',[], ...
             'J21',[], ...
             'J22',[], ...
             'delta',[], ...
             'omega',[], ...
             'e1q',[], ...
             'e1d',[], ...
             'e2q',[], ...
             'e2d',[], ...
             'psiq',[], ...
             'psid',[], ...
             'pm',[], ...
             'vf',[], ...
             'Pg0',[], ...
             'Gp',[], ...
             'Gq',[], ...
             'c1',[], ...
             'c2',[], ...
             'c3',[], ...
             'cluster',[]);

% Excitation Control  structure
Exc = struct('con',[], ...
             'n',0, ...
             'bus',[], ...
             'syn',[], ...
             'vrif',[], ...
             'vrif0',[], ...
             'vr1',[], ...
             'vr2',[], ...
             'vr3',[], ...
             'vm',[], ...
             'vf',[], ...
             'cluster',[]);

% Subtransmission Area Equivalents  structure
SAE1 = struct('con',[], ...
              'n',0, ...
              'm',[]);
SAE2 = struct('con',[], ...
              'n',0, ...
              'm1',[], ...
              'm2',[]);
SAE3 = struct('con',[], ...
              'n',0, ...
              'm1',[], ...
              'm2',[], ...
              'm3',[]);

% Fault  structure
Fault = struct('con',[], ...
               'n',0, ...
               'bus',[], ...
               'dat',[], ...
               'ang',[]);
Breaker = struct('con',[], ...
                 'n',0, ...
                 'bus',[]);

% Tap changer & load  structure
Tap = struct('con',[], ...
             'n',0, ...
             'bus',[], ...
             'm',[]);

% Asynchronous Motor  structure
Mot = struct('con',[], ...
             'n',0, ...
             'bus',[], ...
             'dat',[], ...
             'slip',[], ...
             'e1r',[], ...
             'e1m',[], ...
             'e2r',[], ...
             'e2m',[]);

% Thermostatically controlled load
Thload = struct('con',[], ...
                'n',0, ...
                'bus',[], ...
                'T',[], ...
                'G',[]);

% On Load Tap Changer  structure
Ltc = struct('con',[], ...
             'n',0, ...
             'bus1',[], ...
             'bus2',[], ...
             'dat',[], ...
             'm',[]);

if ~command_line_psat
  set(hdlp,'XData',8+idx+[0 0 33 33 0])
  idx = idx + 33;
  pause(0.1)
end

% Over Excitation Limiter  structure
Oxl = struct('con',[], ...
             'n',0, ...
             'bus',[], ...
             'syn',[], ...
             'exc',[], ...
             'v',[], ...
             'If',[]);

% Power system stabilizer  structure
Pss = struct('con',[], ...
             'n',0, ...
             'bus',[], ...
             'syn',[], ...
             'exc',[], ...
             'v1',[], ...
             'v2',[], ...
             'v3',[], ...
             'va',[], ...
             'vss',[], ...
             'Vs',[], ...
             's1',[]);

% HVDC  structure
Hvdc = struct('con',[], ...
              'n',0, ...
              'bus1', [], ...
              'bus2',[], ...
              'dat',[], ...
              'Id',[], ...
              'xr',[], ...
              'xi',[]);

if ~command_line_psat
  set(hdlp,'XData',8+idx+[0 0 33 33 0])
  idx = idx + 33;
  pause(0.1)
end

% Mass structure
Mass = struct('con',[], ...
              'syn',[], ...
              'n',0, ...
              'delta_HP',[], ...
              'omega_HP',[], ...
              'delta_IP',[], ...
              'omega_IP',[], ...
              'delta_LP',[], ...
              'omega_LP',[], ...
              'delta_EX',[], ...
              'omega_EX',[]);

% SSR structure
SSR = struct('con',[], ...
             'bus',[], ...
             'n',0, ...
             'Id',[], ...
             'Iq',[], ...
             'If',[], ...
             'Edc',[], ...
             'Eqc',[], ...
             'Tm',[], ...
             'Efd',[], ...
             'delta_HP',[], ...
             'omega_HP',[], ...
             'delta_IP',[], ...
             'omega_IP',[], ...
             'delta_LP',[], ...
             'omega_LP',[], ...
             'delta', [], ...
             'omega', [], ...
             'delta_EX',[], ...
             'omega_EX',[]);

% Voltage stability & Market structure
Rsrv = struct('con',[], ...
              'n',0, ...
              'bus',[]);
Rmpg = struct('con',[], ...
              'n',0, ...
              'sup',[], ...
              'bus',[]);
Rmpl = struct('con',[], ...
              'n',0, ...
              'dem',[], ...
              'bus',[]);
Vltn = struct('con',[], ...
              'n',0, ...
              'bus',[]);
Ypdp = struct('con',[], ...
              'day',[], ...
              'week',[], ...
              'year',[], ...
              'd',1, ...
              'w',1, ...
              'y',1, ...
              'len', 0);

% Supplemtary Stabilizing Control Loop
Pod = struct('con',[], ...
             'n',0, ...
             'svc',[],...
             'statcom',[],...
             'sssc',[],...
             'upfc',[],...
             'tcsc',[],...
             'idx',[], ...
             'type',[], ...
             'v1',[], ...
             'v2',[], ...
             'v3',[], ...
             'Vs',[], ...
             'u',[]);

% load PSAT Simulink library
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')
end

if ~command_line_psat
  set(hdlp,'XData',8+idx+[0 0 33 33 0],'FaceColor',[0.85 0.2 0])
  hold off
  pause(0.1)
end

if failed,
  disp(' '), disp('PSAT is not properly initialized.')
else,
  if ~command_line_psat, fm_main, end
end

if ~command_line_psat, close(hdl), end

clear failed hdl hdlp idx a count fid nname sline tipi ncomp
clear psatver psatdate psatdir lipdir command_line_psat

% ----------------------------------------------------------- %
%                       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 - Fuel Cell Model
Sofc = struct('con',[],'n',0,'bus',[],'Ik',[],'Vk',[],'pH2',[],'pH20',[],'pO2',[],'qH2',[],'m',[]);

% Cac - Central Area Controller
Cac = struct('con',[],'n',0,'bus',[],'q1',[],'q',[]);

% Cluster - Cluster Controllers
Cluster = struct('con',[],'n',0,'exc',[],'syn',[],'svc',[],'bus',[],'cac',[],'Vs',[],'u',[],'dVsdQ',[]);

% Exload - Exponential recovery load
Exload = struct('con',[],'n',0,'dat',[],'bus',[],'xp',[],'xq',[]);

% Phs - Phase Shifting Transformer
Phs = struct('con',[],'n',0,'bus1',[],'bus2',[],'alpha',[],'Pm',[]);

% Wind speed
Wind = struct('con',[],'n',0,'speed',[],'vwa',[],'vw',[]);

% Constant speed wind turbine
Cswt = struct('con',[],'n',0,'bus',[],'wind',[],'dat',[],'omega_wr',[], ...
              'omega_m',[],'gamma',[],'e1r',[],'e1m',[]);

% Doubly fed induction generator
Dfig = struct('con',[],'n',0,'bus',[],'wind',[],'dat',[], ...
              'omega_m',[],'theta_p',[],'idr',[],'iqr',[]);

% Direct drive synchronous generator
Ddsg = struct('con',[],'n',0,'bus',[],'wind',[],'dat',[], ...
              'omega_m',[],'theta_p',[],'ids',[],'iqs',[],'idc',[]);

% Busfreq - Bus frequency measurement
Busfreq = struct('con',[],'n',0,'dat',[],'bus',[],'x',[],'w',[]);

% Pmu - Phasor measurement unit
Pmu = struct('con',[],'n',0,'bus',[],'dat',[],'vm',[],'thetam',[]);

% Jimma - Jimma's load
Jimma = JIclass;

% Mixed - Mixed load
Mixload = MXclass;

⌨️ 快捷键说明

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