📄 psat.m
字号:
% _____ _____ _____ ______% /\ _ \ /\ ___\ /\ _ \ /\__ __\% \ \ \_\ \ \ \ \___ \ \ \_\ \ \/_/\ \_/% \ \ ___\ \ \___ \ \ \ __ \ \ \ \% \ \ \__/ \/___\ \ \ \ \ \ \ \ \ \% \ \_\ /\_____\ \ \_\ \_\ \ \_\% \/_/ \/_____/ \/_/\/_/ \/_/%% Copyright (C) 2002-2005 Federico Milano%% This toolbox is free software; you can redistribute it and/or modify% it under the terms of the GNU General Public License as published by% the Free Software Foundation; either version 2.0 of the License, or% (at your option) any later version.%% This toolbox is distributed in the hope that it will be useful, but% WITHOUT ANY WARRANTY; without even the implied warranty of% MERCHANDABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU% General Public License for more details.%% You should have received a copy of the GNU General Public License% along with this toolbox; if not, write to the Free Software% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,% USA.echo offif exist('command_line_psat') ~= 1 clear all clear global command_line_psat = 0; if exist('OCTAVE_VERSION') command_line_psat = 1; endend%PSAT Power System Analysis Toolbox%%Author: Federico Milano%Date: 11-Nov-2002%Update: 18-Feb-2003%Update: 22-Feb-2003%Update: 09-Jul-2003%Update: 30-Aug-2003%Update: 22-Feb-2004%Update: 09-Mar-2004%Version: 1.2.0%%E-mail: fmilano@thunderbox.uwaterloo.ca%Web-site: http://thunderbox.uwaterloo.ca/~fmilano% check host versiona = version;a = str2num(a(1:3));if exist('OCTAVE_VERSION') & a < 2.1 disp('PSAT needs an Octave version >= 2.1.x') returnelseif ~exist('OCTAVE_VERSION') & a < 5.3 disp('PSAT needs a Matlab version >= 5.3') returnendpsatver = '1.3.4';psatdate = 'July 14, 2005';failed = 0;disp(' ')disp(' < P S A T >')disp(' Copyright (C) 2002-2005 Federico Milano')disp([' Version ',psatver])disp([' ',psatdate])disp(' ')disp('PSAT comes with ABSOLUTELY NO WARRANTY; type ''gnuwarranty''')disp('for details. This is free software, and you are welcome to')disp(['redistribute it under certain conditions; type' ... ' ''gnulicense'''])disp('for details.')disp(' ')if exist('OCTAVE_VERSION') disp(['Host: Octave ',version])else disp(['Host: Matlab ',version])enddisp(['Session: ', datestr(now,0)])if command_line_psat disp('Usage: Command Line')else disp('Usage: Graphical User Interface')enddisp(['Path: ',pwd])disp(' ')% searching the "PSAT" pathif exist('OCTAVE_VERSION') if isempty(findstr(LOADPATH,'psat')) path([':/',pwd,'//']); endelse psatdir = what('psat'); if isempty(psatdir) psatdir = struct('path',pwd); end if isempty(findstr(path,[psatdir.path,pathsep])), addpath(psatdir.path) disp('PSAT folder has been added to the Matlab path.') endend% check for "lipsol" package%lipdir = which('lipsol');%if isempty(lipdir)% addpath([psatdir.path,filesep,'lipsol'])% disp('LIPSOL folder has been added to the Matlab path.')%end% initialize lipsol%lipconfig% check for "lp_solve" package%lipdir = which('lp_solve');%if isempty(lipdir)% addpath([psatdir.path,filesep,'lp_solve'])% disp('LP_SOLVE folder has been added to the Matlab path.')%endfm_varPath.data = '';Path.local = '';Path.psat = '';Path.pert = '';Path.build = '';Path.images = '';Path.themes = '';Path.filters = '';if command_line_psat clpsat.init = 1; clpsat.mesg = 1; clpsat.refresh = 1; clpsat.refreshsim = 0; clpsat.readfile = 1; clpsat.showopf = 0; clpsat.pq2z = 1; clpsat.viewrep = 0;else clpsat.init = 0; clpsat.mesg = 1; clpsat.refresh = 0; clpsat.refreshsim = 0; clpsat.readfile = 1; clpsat.showopf = 1; clpsat.pq2z = 1; clpsat.viewrep = 1;endPath.local = [pwd,filesep];if exist('OCTAVE_VERSION') Path.psat = strrep(which('psat'),'psat.m','');else if strcmp(computer,'GLNX86') Path.local = strrep(Path.local,getenv('HOME'),'~'); end Path.psat = [psatdir(1).path,filesep]; if strcmp(computer,'GLNX86') Path.psat = strrep(Path.psat,getenv('HOME'),'~'); endendPath.build = [Path.psat,'build', filesep];Path.images = [Path.psat,'images', filesep];Path.themes = [Path.psat,'themes', filesep];Path.filters = [Path.psat,'filters',filesep];if exist(Path.build) ~= 7 disp('No "build" folder found in the current PSAT path.') failed = ~mkdir(Path.psat,'build'); if failed, disp('The folder "build" could not be created') endendif exist(Path.images) ~= 7 disp('No "images" folder found in the current PSAT path.') failed = 1;endif exist(Path.themes) ~= 7 disp('No "themes" folder found in the current PSAT path.') failed = ~mkdir(Path.psat,'themes'); if failed, disp('The folder "themes" could not be created') endendif exist(Path.filters) ~= 7 disp('No "filters" folder found in the current PSAT path.') failed = 1;endif failed disp('The PSAT folder seems to be uncomplete and needs to be installed again.') disp('PSAT initialization failed.') returnendif ~command_line_psat hdl = fm_enter(psatdir(1).path,psatver,psatdate); pause(0.1) hold on hdlp = patch(346-[320 320 280 280 320],410-[20 40 40 20 20], ... [0 0 0], 'EdgeColor',[0 0 0]); set(hdlp,'EraseMode','none'); pause(0.1) idx = 30;else idx = 0;endFile.data = '';File.pert = '';jay = sqrt(-1);Source.data = '';Source.pert = '';Source.description = '';History = struct('text','', ... 'index',1, ... 'string','', ... 'workspace',0, ... 'Max',500, ... 'FontName', ... 'Courier', ... 'FontSize',12, ... 'FontAngle','normal', ... 'FontWeight','normal', ... 'BackgroundColor','w', ... 'ForegroundColor','k');History.text = {['PSAT version ',psatver, ... ', Copyright (C) 2002-2005 Federico Milano']; ... ' '; ['Session ', datestr(now)]};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)endtry settingscatch Theme = struct('color01',[0.800 0.800 0.800], ... 'color02',[0.753 0.753 0.753], ... 'color03',[0.502 0.502 0.502], ... 'color04',[1.000 1.000 1.000], ... 'color05',[0.000 0.000 0.502], ... 'color06',[1.000 1.000 0.502], ... 'color07',[0.502 0.000 0.000], ... 'color08',[0.750 0.390 0.503], ... 'color09',[1.000 1.000 1.000], ... 'color10',[1.000 1.000 1.000], ... 'color11',[0.920 0.920 0.920], ... 'font01','Courier','hdl',zeros(18,1)); Settings = struct('dlf',0, ... 'dac',0, ... 'pq2z',0, ... 'pv2pq',0, ... 'showlf',0, ... 'init', 0, ... 'status', 1, ... 'conv', 1, ... 'red',0, ... 'plot',0, ... 'plottype',1, ... 'method',2, ... 'show',1, ... 'vs',0, ... 'ok',0, ... 'pfsolver', 1, ... 'deltadelta',180, ... 'checkdelta',0, ... 'deltat',1e-5, ... 'deltatmax',1e-3, ... 'deltatmin',1e-5, ... 'chunk',100, ... 'mv',0, ... 'iter',0, ... 'static', 0, ... 'zoom','', ... 'freq', 50, ... 'beep',0, ... 'dyntol',1e-5, ... 'dynmit',20, ... 'lftol',1e-5, ... 'lfmit',20, ... 'lftime', 0, ... 't0',0, ... 'tf',30, ... 'mva',100, ... 'rad',2*3.14159265358979*50, ... 'distrsw', 0, ... 'refbus',0, ... 'color',[], ... 'fixt',0, ... 'tstep',0.001, ... 'xlabel','time (s)', ... 'locksnap',0, ... 'tviewer',[], ... 'absvalues', 'off', ... 'shuntvalues', 'off', ... 'violations', 'off', ... 'export','txt', ... 'noarrows',1, ... 'octave',0, ... 'local',1);endSettings.color = [0 0 1.0000; 0 0.5000 0; 1.0000 0 0; 0 0.7500 0.7500; 0.7500 0 0.7500; 0.7500 0.7500 0; 0.2500 0.2500 0.2500];if ~command_line_psat set(0,'DefaultUicontrolBackgroundColor',Theme.color01)enda = version;Settings.hostver = str2num(a(1:3));Settings.init = 0;Settings.version = psatver;Settings.date = psatdate;if exist('OCTAVE_VERSION') Settings.octave = 1;else Settings.octave = 0;endif ~isfield(Settings,'local') Settings.local = 1;endif isunix & strcmp(Settings.export,'xls') Settings.export = 'txt';endswitch computer case 'PCWIN' Settings.tviewer = '!notepad '; otherwise Settings.tviewer = '!cat ';endHdl = struct('hist',0, ... 'text',0, ... 'status',0, ... 'frame',0, ... 'bar',0, ... 'pert','');if Settings.hostver >= 6 Hdl.pert = str2func('pert');else Hdl.pert = 'pert';endFig = struct('main',0, ... 'plot',0, ... 'update',0, ... 'hist',0, ... 'pset',0, ... 'make',0, ... 'lib',0, ... 'comp',0, ... 'cset',0, ... 'sset',0, ... 'xset',0, ... 'eigen',0, ... 'matrx',0, ... 'theme',0, ... 'simset',0, ... 'setting',0, ... 'snap',0, ... 'stat',0, ... 'pmu',0, ... 'dir',0, ... 'cpf',0, ... 'snb',0, ...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -