📄 psat.m
字号:
% _____ _____ _____ ______% /\ _ \ /\ ___\ /\ _ \ /\__ __\% \ \ \_\ \ \ \ \___ \ \ \_\ \ \/_/\ \_/% \ \ ___\ \ \___ \ \ \ __ \ \ \ \% \ \ \__/ \/___\ \ \ \ \ \ \ \ \ \% \ \_\ /\_____\ \ \_\ \_\ \ \_\% \/_/ \/_____/ \/_/\/_/ \/_/%% Copyright (C) 2002-2008 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 classes 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: 06-Mar-2007%%E-mail: Federico.Milano@uclm.es%Web-site: http://www.uclm.es/area/gsee/Web/Federico% check host versiona = version;a = str2num(a(1:3));if ~exist('OCTAVE_VERSION') if a < 5.3 disp('PSAT needs a Matlab version >= 5.3') return elseif a < 7.0 disp(['For Matlab versions < 7.0, PSAT runs only ' ... 'in the command line mode']) command_line_psat = 1; endendpsatver = '2.1.2';psatdate = 'June 26, 2008';failed = 0;disp(' ')disp(' < P S A T >')disp(' Copyright (C) 2002-2008 Federico Milano')disp([blanks(30-floor(5+length(psatver)/2)),'Version ',psatver])disp([blanks(30-ceil(length(psatdate)/2)),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" pathpsatdir = which('psat.m');psatdir = psatdir(1:end-7);if strcmp(psatdir,'.'), psatdir = pwd; end% check for Octaveif exist('OCTAVE_VERSION') & isempty(findstr(path,[psatdir,filesep,'@BUclass'])) folders = dir([psatdir,filesep,'@*']); for i = length(folders):-1:1 if folders(i).isdir addpath([psatdir,filesep,folders(i).name]) end end addpath([psatdir,filesep,'filters']) addpath(psatdir) clear foldersend% check for Matlabif isempty(strmatch(path,[psatdir,filesep,'filters'],'exact')) addpath([psatdir,filesep,'filters'])endif isempty(strmatch(path,psatdir,'exact')) addpath(psatdir)endfm_varPath = struct('data','','local','','psat','','pert','', ... 'build','','images','','themes','', ... 'filters','','temp','');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 strncmp(computer,'GLNX',4) Path.local = strrep(Path.local,'~',getenv('HOME')); end Path.psat = [psatdir,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,htxt] = fm_enter(psatdir,psatver,psatdate); pause(0.1) hold on % the size of the splash window are 346 x 410 pixels hdlp = patch([8 8 41 41 8],[405 395 395 405 405], ... [0.50 0.45 0.95],'EdgeColor',[1 1 1]); set(hdlp,'EraseMode','none'); set(htxt,'Color',[0.4 0.4 0.4],'String','Initializing History...') drawnowendFile = struct('data','','pert','','temp','','modify','');Source = struct('data','','pert','','description','');jay = sqrt(-1);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-2008 Federico Milano']; ... ' '; ['Session ', datestr(now)]};if ~command_line_psat set(hdlp,'XData',[8 8 74 74 8]) set(htxt,'String','Initializing Settings...') drawnowendtry 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, ... 'maxvar',1500, ... 'maxsimout', 15, ... 'maxsimin', 15, ... 'mv',0, ... 'nseries',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, ... 'color',[], ... 'fixt',0, ... 'tstep',0.001, ... 'xlabel','time (s)', ... 'locksnap',0, ... 'tviewer',[], ... 'absvalues', 'off', ... 'violations', 'off', ... 'export','txt', ... 'noarrows',1, ... 'matlab',1, ... 'octave',0, ... 'local',1, ... 'simtd',0, ... 'forcepq',0, ... 'switch2nr',0, ... 'resetangles',0, ... 'format',1, ... 'coi',0, ... 'platform','UNIX', ... 'report',0);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; Settings.matlab = 0;else Settings.octave = 0; Settings.matlab = 1;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 ';endif Settings.octave Settings.platform = computer;else if strncmp(computer,'PC',2) Settings.platform = 'PC'; elseif strncmp(computer,'MAC',3) & usejava('jvm') Settings.platform = 'MAC'; else Settings.platform = 'UNIX'; end % Use default colors if the Java Desktop is in use if Settings.hostver >= 6.1 if usejava('jvm') Theme.color01 = get(0,'factoryUicontrolBackgroundColor'); Theme.color02 = get(0,'factoryUicontrolBackgroundColor'); Theme.color03 = get(0,'factoryUicontrolBackgroundColor'); Theme.color04 = get(0,'factoryAxesXColor'); Theme.color05 = get(0,'factoryUicontrolForegroundColor'); Theme.color06 = get(0,'factoryUicontrolForegroundColor'); Theme.color07 = get(0,'factoryUicontrolForegroundColor'); Theme.color09 = get(0,'factoryUicontrolForegroundColor'); Theme.color10 = get(0,'factoryUicontrolForegroundColor'); Theme.color11 = get(0,'factoryAxesXColor'); Theme.font01 = get(0,'factoryTextFontName'); Theme.font02 = get(0,'factoryTextFontName'); Theme.font03 = get(0,'factoryTextFontName'); Theme.font04 = get(0,'factoryTextFontName'); end endendHdl = 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, ... 'about',0, ... 'author',0, ... 'opf',0, ... 'line',0, ... 'clock',0, ... 'license',0, ... 'warranty',0, ... 'tviewer',0, ... 'gams',0, ... 'uwpflow',0, ... 'laprint',0, ...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -