📄 fm_main.m
字号:
function fig = fm_main(varargin)% FM_MAIN create the main GUI for PSAT%% HDL = FM_MAIN()%%see general purpose structures for settings%%Author: Federico Milano%Date: 11-Nov-2002%Update: 10-Feb-2003%Update: 27-Feb-2003%Update: 29-Jul-2003%Version: 1.0.3%%E-mail: Federico.Milano@uclm.es%Web-site: http://www.uclm.es/area/gsee/Web/Federico%% Copyright (C) 2002-2008 Federico Milanoglobal Settings Path File History Hdl Theme Figif exist('simulink') ~= 5 fmlib = 'fm_choice(''Simulink is not available on this system'',2)';else fmlib = 'fm_lib';endif nargin if ~exist('Fig'), Fig.main = 0, end if ~Fig.main Fig.main = findobj(get(0,'Children'),'FileName','fm_main'); end switch varargin{1} case 'buttondown' pos = get(Fig.main,'CurrentPoint'); if pos(1) > 0.04064 & pos(2) > 0.1152 & ... pos(1) < 0.2943 & pos(2) < 0.3395 if ~exist('Hdl'), return, end if Hdl.status ~= 0, delete(Hdl.status) Hdl.status = 0; elseif strcmp(get(Fig.main,'SelectionType'),'open') fm_about end elseif pos(1) > 0.0406404 & pos(2) > 0.0358255 & ... pos(1) < 0.9618 & pos(2) < 0.0794 if strcmp(get(Fig.main,'SelectionType'),'open') fm_hist end elseif pos(1) > 0.098522 & pos(2) > 0.7180 & ... pos(1) < 0.5751 & pos(2) < 0.7569 if strcmp(get(Fig.main,'SelectionType'),'open') fm_set setpert, end elseif pos(1) > 0.098522 & pos(2) > 0.8317 & ... pos(1) < 0.5751 & pos(2) < 0.8706 if strcmp(get(Fig.main,'SelectionType'),'open') fm_set setdata, end end case 'buttonmotion' if Settings.hostver >= 7.1 pointer = 'hand'; else pointer = 'crosshair'; end pos = get(Fig.main,'CurrentPoint'); if pos(1) > 0.04064 & pos(2) > 0.1152 & ... pos(1) < 0.2943 & pos(2) < 0.3395 set(Fig.main,'Pointer',pointer); elseif pos(1) > 0.0406404 & pos(2) > 0.0358255 & ... pos(1) < 0.9618 & pos(2) < 0.0794 set(Fig.main,'Pointer',pointer); elseif pos(1) > 0.098522 & pos(2) > 0.7180 & ... pos(1) < 0.5751 & pos(2) < 0.7569 set(Fig.main,'Pointer',pointer); elseif pos(1) > 0.098522 & pos(2) > 0.8317 & ... pos(1) < 0.5751 & pos(2) < 0.8706 set(Fig.main,'Pointer',pointer); else set(Fig.main,'Pointer','arrow'); end end returnendif Fig.main figure(Fig.main) returnendsimversion = '5.1 (R13SP1)';allowsimconv = 1;h0 = figure('Color',Theme.color01, ... 'Units','normalized', ... 'CreateFcn','Fig.main = gcf;', ... 'DeleteFcn','fm_set delete', ... 'FileName','fm_main', ... 'KeyPressFcn','fm_set keypress', ... 'MenuBar','none', ... 'MinColormap', 256, ... 'Name',['PSAT ',Settings.version], ... 'NumberTitle','off', ... 'PaperPosition',[18 180 576 432], ... 'PaperType','A4', ... 'PaperUnits','points', ... 'Position',sizefig(0.6348,0.6276), ... 'RendererMode','manual', ... 'Resize','on', ... 'Tag','Settings', ... 'ToolBar','none', ... 'UserData', 1, ... 'WindowButtonDownFcn','fm_main buttondown', ... 'WindowButtonMotionFcn','fm_main buttonmotion');if Settings.hostver < 7.5 set(h0,'ShareColors','on')endfm_set colormap% Menu File/Openh1 = uimenu('Parent',h0, ... 'Label','File', ... 'Tag','MenuFile');h2 = uimenu('Parent',h1, ... 'Label', 'Open', ... 'Tag','FileOpen');h3 = uimenu('Parent',h2, ... 'Callback','fm_set setdata', ... 'Label', 'Data File', ... 'Tag','OpenData', ... 'Accelerator','d');h3 = uimenu('Parent',h2, ... 'Callback','fm_set setpert', ... 'Label', 'Perturbation File', ... 'Tag','OpenPert', ... 'Accelerator','j');h3 = uimenu('Parent',h2, ... 'Callback','fm_set opensys', ... 'Label', 'Saved System', ... 'Tag','OpenLF', ... 'Accelerator','y');h3 = uimenu('Parent',h2, ... 'Callback','fm_simrep(''ViewModel'',0,0)', ... 'Label', 'Current Simulink model', ... 'Tag','OpenSimModel', ... 'Accelerator','0');h3 = uimenu('Parent',h2, ... 'Callback','fm_set opensim', ... 'Label', 'Simulink Model', ... 'Tag','OpenSim', ... 'Accelerator','%');% Menu File/Saveh2 = uimenu('Parent',h1, ... 'Label', 'Save', ... 'Tag','FileSave');h3 = uimenu('Parent',h2, ... 'Callback','fm_set savesys', ... 'Label', 'Current System', ... 'Tag','SaveLF', ... 'Accelerator','a');h3 = uimenu('Parent',h2, ... 'Callback','fm_set savedata', ... 'Label', 'Restore Data File', ... 'Tag','SaveD', ... 'Accelerator','r');h3 = uimenu('Parent',h2, ... 'Callback','fm_set appendV normal', ... 'Label', 'Save Voltages', ... 'Tag','SaveV');h3 = uimenu('Parent',h2, ... 'Callback','fm_set appendV flat', ... 'Label', 'Set Flat Voltages', ... 'Tag','FlatV');h3 = uimenu('Parent',h2, ... 'Callback','fm_set savesettings', ... 'Label', 'Settings', ... 'Tag','SaveS');h3 = uimenu('Parent',h2, ... 'Callback','fm_simsave(''fm_lib.mdl'',Path.psat)', ... 'Label', ['Library as Simulink ', simversion], ... 'Tag','SaveS');if ~allowsimconv, set(h3,'Enable','off'), endh3 = uimenu('Parent',h2, ... 'Callback','fm_simsave', ... 'Label',['Save model as Simulink ',simversion], ... 'Tag','ToolsSIMMOD');if ~allowsimconv, set(h3,'Enable','off'), endh3 = uimenu('Parent',h2, ... 'Callback','fm_simsave(''all'')', ... 'Label',['Save all models in folder as Sim. ',simversion], ... 'Tag','ToolsALLSIM');if ~allowsimconv, set(h3,'Enable','off'), endh2 = uimenu('Parent',h1, ... 'Callback','fm_set closedata', ... 'Label','Discard Data File', ... 'Tag','DataClose', ... 'Separator','on');h2 = uimenu('Parent',h1, ... 'Callback','fm_set closepert', ... 'Label','Discard Perturbation File', ... 'Tag','PertClose');h2 = uimenu('Parent',h1, ... 'Callback','close(gcf)', ... 'Label','Close', ... 'Tag','FileClose', ... 'Separator','on', ... 'Accelerator','q');h2 = uimenu('Parent',h1, ... 'Callback','fm_set exit', ... 'Label','Exit', ... 'Tag','NetSett', ... 'Accelerator','x');% Menu Edith1 = uimenu('Parent',h0, ... 'Label','Edit', ... 'Tag','MenuEdit');h2 = uimenu('Parent',h1, ... 'Callback',fmlib, ... 'Label', 'Simulink Library', ... 'Tag','NetEdit', ... 'Accelerator','s');a = dir([Path.psat,filesep,'*.mdl']);a = {a.name}';idx = strmatch('fm_xlib',a);for i = 2:length(idx) h2 = uimenu('Parent',h1, ... 'Callback',strrep(a{idx(i)},'.mdl',''), ... 'Label',['Extra Library #',num2str(i-1)], ... 'Tag',['NetEdit',num2str(i)]);endh2 = uimenu('Parent',h1, ... 'Callback','fm_simset', ... 'Label','Simulink Model Settings', ... 'Tag','NetSett');h2 = uimenu('Parent',h1, ... 'Callback','fm_setting', ... 'Label','General Settings', ... 'Tag','ToolSett', ... 'Separator','on', ... 'Accelerator','k');h2 = uimenu('Parent',h1, ... 'Callback','fm_plotsel', ... 'Label','Select Plot Variables', ... 'Tag','PlotSetVar');h2 = uimenu('Parent',h1, ... 'Callback','fm_snbfig', ... 'Label','SNB Settings', ... 'Tag','ToolSNBSett', ... 'Accelerator','g');h2 = uimenu('Parent',h1, ... 'Callback','fm_libfig', ... 'Label', 'LIB Settings', ... 'Tag','ToolLIBSett', ... 'Accelerator','l');h2 = uimenu('Parent',h1, ... 'Callback','fm_cpffig', ... 'Label','CPF Settings', ... 'Tag','ToolOPFSett', ... 'Accelerator','i');h2 = uimenu('Parent',h1, ... 'Callback','fm_opffig', ... 'Label','OPF Settings', ... 'Tag','ToolCPFSett', ... 'Accelerator','z');h2 = uimenu('Parent',h1, ... 'Callback','fm_set setdefault', ... 'Label','Set Default', ... 'Tag','ToolDef');% Menu Runh1 = uimenu('Parent',h0, ... 'Label','Run', ... 'Tag','MenuRun');h2 = uimenu('Parent',h1, ... 'Callback','fm_set lf', ... 'Label','Power Flow', ... 'Tag','RunPF', ... 'Accelerator','p');h2 = uimenu('Parent',h1, ... 'Callback','fm_snb', ... 'Label','Saddle-Node Bifurcation', ... 'Tag','ViewSNB');h2 = uimenu('Parent',h1, ... 'Callback','fm_limit', ... 'Label','Limit-Induced Bifurcation', ... 'Tag','ViewLIB');h2 = uimenu('Parent',h1, ... 'Callback','fm_cpf(''cpf'');', ... 'Label','Continuation Power Flow', ... 'Tag','ViewCPF', ... 'Accelerator','c');h2 = uimenu('Parent',h1, ... 'Callback','fm_set opf', ... 'Label','Optimal Power Flow', ... 'Tag','ViewOPF', ... 'Accelerator','o');h2 = uimenu('Parent',h1, ... 'Callback','fm_n1cont', ... 'Label','N-1 Contingency Analysis', ... 'Tag','ViewN1C');h2 = uimenu('Parent',h1, ... 'Callback','fm_eigfig', ... 'Label','Eigenvalue Analysis', ... 'Tag','ViewEIG', ... 'Separator','on', ... 'Accelerator','e');h2 = uimenu('Parent',h1, ... 'Callback','fm_int', ... 'Label','Time Simulation', ... 'Tag','RunTime', ... 'Accelerator','t');% Menu Toolsh1 = uimenu('Parent',h0, ... 'Label','Tools', ... 'Tag','Tool');h2 = uimenu('Parent',h1, ... 'Callback','fm_dir(0)', ... 'Label','Data Format Conversion', ... 'Tag','ToolDir', ... 'Accelerator','f');h2 = uimenu('Parent',h1, ... 'Callback','fm_comp copen', ... 'Label','Component Browser', ... 'Tag','ToolComp', ... 'Accelerator','b');h2 = uimenu('Parent',h1, ... 'Callback','fm_snap', ... 'Label','Snapshots', ... 'Tag','ToolSnap', ... 'Accelerator','n');h2 = uimenu('Parent',h1, ... 'Callback','fm_pmufig', ... 'Label','PMU placement', ... 'Tag','ToolsPMU', ... 'Accelerator','u');%h2 = uimenu('Parent',h1, ...% 'Callback','fm_pcode', ...% 'Label','Archive (p-code)', ...% 'Tag','ToolsPCODE', ...% 'Separator','on');h2 = uimenu('Parent',h1, ... 'Callback','fm_laprint', ... 'Label','LaTeX Print', ... 'Tag','ToolsLaPrint', ... 'Separator','on');% Menu Interfacesh1 = uimenu('Parent',h0, ... 'Label','Interfaces', ... 'Tag','Interface');h2 = uimenu('Parent',h1, ... 'Callback','fm_gamsfig', ... 'Label','GAMS', ... 'Accelerator', '1', ... 'Tag','InterGams');h2 = uimenu('Parent',h1, ... 'Callback','fm_uwfig', ...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -