📄 fm_cpffig.m
字号:
function fig = fm_cpffig(varargin)% FM_CPFFIG create GUI for Continuation Power Flow settings%% HANDLE = FM_CPFFIG% HANDLE = figure graphic handle%%see CPF structure for settings%%Author: Federico Milano%Date: 11-Nov-2002%Update: 11-Feb-2003%Version: 1.0.2%%E-mail: Federico.Milano@uclm.es%Web-site: http://www.uclm.es/area/gsee/Web/Federico%% Copyright (C) 2002-2008 Federico Milanoglobal Settings Path CPF Theme Figif nargin & ischar(varargin{1}) switch varargin{1} case 'hopf' switch get(gcbo,'Checked') case 'on' set(gcbo,'Checked','off') CPF.hopf = 0; case 'off' set(gcbo,'Checked','on') CPF.hopf = 1; end case 'stepcut' switch get(gcbo,'Checked') case 'on' set(gcbo,'Checked','off') CPF.stepcut = 0; case 'off' set(gcbo,'Checked','on') CPF.stepcut = 1; end case 'negload' switch get(gcbo,'Checked') case 'on' set(gcbo,'Checked','off') CPF.negload = 0; case 'off' set(gcbo,'Checked','on') CPF.negload = 1; CPF.onlynegload = 0; set(findobj(gcf,'Tag','OptOnlyNegLoad'),'Checked','off') CPF.onlypqgen = 0; set(findobj(gcf,'Tag','OptPQGen'),'Checked','off') CPF.areaannualgrowth = 0; set(findobj(Fig.cpf,'Tag','OptArea'),'Checked','off') CPF.regionannualgrowth = 0; set(findobj(Fig.cpf,'Tag','OptRegion'),'Checked','off') end case 'onlynegload' switch get(gcbo,'Checked') case 'on' set(gcbo,'Checked','off') CPF.onlynegload = 0; case 'off' set(gcbo,'Checked','on') CPF.onlynegload = 1; CPF.negload = 0; set(findobj(gcf,'Tag','OptNegLoad'),'Checked','off') CPF.onlypqgen = 0; set(findobj(gcf,'Tag','OptPQGen'),'Checked','off') CPF.areaannualgrowth = 0; set(findobj(Fig.cpf,'Tag','OptArea'),'Checked','off') CPF.regionannualgrowth = 0; set(findobj(Fig.cpf,'Tag','OptRegion'),'Checked','off') end case 'onlypqgen' switch get(gcbo,'Checked') case 'on' set(gcbo,'Checked','off') CPF.onlypqgen = 0; case 'off' set(gcbo,'Checked','on') CPF.onlypqgen = 1; CPF.negload = 0; set(findobj(gcf,'Tag','OptNegLoad'),'Checked','off') CPF.onlynegload = 0; set(findobj(gcf,'Tag','OptOnlyNegLoad'),'Checked','off') CPF.areaannualgrowth = 0; set(findobj(Fig.cpf,'Tag','OptArea'),'Checked','off') CPF.regionannualgrowth = 0; set(findobj(Fig.cpf,'Tag','OptRegion'),'Checked','off') end case 'ilim' CPF.ilim = get(gcbo,'Value'); hdl = findobj(Fig.cpf,'Tag','PopupMenu2'); if CPF.ilim == 0 set(hdl,'Enable','off') else set(hdl,'Enable','on') end case 'pqgen' Prompt = {'Bus index','Active power [MW]','Reactive power [MW]'}; DefAns = {'1','1','0'}; Title = 'PQ generator data'; NumLines = 3; Options.Resize='on'; Options.WindowStyle='normal'; Options.Interpreter='tex'; Answer = fm_input(Prompt, Title, NumLines, DefAns,Options); busidx = str2num(Answer{1}); if busidx <= 0 fm_disp('The bus index must be positive'); return end p = str2num(Answer{2})/Settings.mva; q = str2num(Answer{3})/Settings.mva; global Bus PQ idx = getint(Bus,busidx); if idx == 0 fm_disp('The bus index must be an existing bus'); return end kv = getkv(Bus,idx,1); data = [busidx Settings.mva kv p q 1.10 0.90 0 1]; PQ = add(PQ,data,1); CPF.onlypqgen = 1; set(findobj(Fig.cpf,'Tag','OptOnlyNegLoad'),'Checked','off') CPF.negload = 0; set(findobj(Fig.cpf,'Tag','OptNegLoad'),'Checked','off') CPF.onlynegload = 0; set(findobj(Fig.cpf,'Tag','OptPQGen'),'Checked','on') CPF.areaannualgrowth = 0; set(findobj(Fig.cpf,'Tag','OptArea'),'Checked','off') CPF.regionannualgrowth = 0; set(findobj(Fig.cpf,'Tag','OptRegion'),'Checked','off') case 'areaannualgrowth' global Areas switch get(gcbo,'Checked') case 'on' set(gcbo,'Checked','off') CPF.areaannualgrowth = 0; case 'off' CPF.onlypqgen = 0; set(findobj(Fig.cpf,'Tag','OptOnlyNegLoad'),'Checked','off') CPF.negload = 0; set(findobj(Fig.cpf,'Tag','OptNegLoad'),'Checked','off') CPF.onlynegload = 0; set(findobj(Fig.cpf,'Tag','OptPQGen'),'Checked','off') CPF.areaannualgrowth = 1; set(findobj(Fig.cpf,'Tag','OptArea'),'Checked','on') CPF.regionannualgrowth = 0; set(findobj(Fig.cpf,'Tag','OptRegion'),'Checked','off') end case 'regionannualgrowth' global Regions switch get(gcbo,'Checked') case 'on' set(gcbo,'Checked','off') CPF.regionannualgrowth = 0; case 'off' CPF.onlypqgen = 0; set(findobj(Fig.cpf,'Tag','OptOnlyNegLoad'),'Checked','off') CPF.negload = 0; set(findobj(Fig.cpf,'Tag','OptNegLoad'),'Checked','off') CPF.onlynegload = 0; set(findobj(Fig.cpf,'Tag','OptPQGen'),'Checked','off') CPF.areaannualgrowth = 0; set(findobj(Fig.cpf,'Tag','OptArea'),'Checked','off') CPF.regionannualgrowth = 1; set(findobj(Fig.cpf,'Tag','OptRegion'),'Checked','on') end end returnendif Fig.cpf, figure(Fig.cpf), return, endflussi = {'Currents (I)'; 'Active Powers (P)'; 'Apparent Powers (S)'};metodi = {'Perpendicular Intersection'; 'Local Parametrization'};tipi = {'Complete Nose Curve'; 'Stop at Bifurcation'; 'Stop at Limit'};nr = 'normalized';c2 = Theme.color02;c3 = Theme.color03;c4 = Theme.color04;c5 = Theme.color05;f1 = Theme.font01;if strcmp(Settings.platform,'MAC') aligntxt = 'center'; dm = 0.0075;else aligntxt = 'left'; dm = 0;endh0 = figure('Units',nr, ... 'Color',c2, ... 'Colormap',[], ... 'CreateFcn', 'Fig.cpf = gcf;', ... 'DeleteFcn', 'Fig.cpf = 0;', ... 'MenuBar','none', ... 'Name','PSAT-CPF', ... 'NumberTitle','off', ... 'PaperPosition',[18 180 576 432], ... 'PaperUnits','points', ... 'Position',sizefig(0.6,0.5), ... 'Resize','on', ... 'ToolBar','none', ... 'FileName','fm_cpffig');fm_set colormap% Menu Fileh1 = uimenu('Parent',h0, ... 'Label','File', ... 'Tag','MenuFile');h2 = uimenu('Parent',h1, ... 'Callback','close(gcf)', ... 'Label','Exit', ... 'Tag','NetSett', ... 'Accelerator','x');% Menu Edith1 = uimenu('Parent',h0, ... 'Label','Edit', ... 'Tag','MenuEdit');h2 = uimenu('Parent',h1, ... 'Callback','fm_setting', ... 'Label','General Settings', ... 'Tag','ToolSett', ... 'Accelerator','s');% Menu Runh1 = uimenu('Parent',h0, ... 'Label','Run', ... 'Tag','MenuRun');h2 = uimenu('Parent',h1, ... 'Callback','fm_cpf(''main'');', ... 'Label','Run CPF', ... 'Tag','ToolCPFSett', ... 'Accelerator','z');h2 = uimenu('Parent',h1, ... 'Callback','fm_n1cont', ... 'Label','N-1 Contingency Analysis', ... 'Tag','ViewN1C', ... 'Accelerator','n');% Menu Optionsh1 = uimenu('Parent',h0, ... 'Label','Options', ... 'Tag','MenuOpt');h2 = uimenu('Parent',h1, ... 'Callback','fm_cpffig hopf', ... 'Label','Check for Hopf Bif.', ... 'Tag','OptHB', ... 'Accelerator','h');if CPF.hopf set(h2,'Checked','on')else set(h2,'Checked','off')endh2 = uimenu('Parent',h1, ... 'Callback','fm_cpffig stepcut', ... 'Label','Enforce step cut control', ... 'Tag','OptSTC', ... 'Accelerator','c');if CPF.stepcut set(h2,'Checked','on')else set(h2,'Checked','off')endh2 = uimenu('Parent',h1, ... 'Callback','fm_cpffig negload', ... 'Label','Include negative loads', ... 'Tag','OptNegLoad');if CPF.negload set(h2,'Checked','on')else set(h2,'Checked','off')endh2 = uimenu('Parent',h1, ... 'Callback','fm_cpffig onlynegload', ... 'Label','Use only negative loads', ... 'Tag','OptOnlyNegLoad');if CPF.onlynegload set(h2,'Checked','on')else set(h2,'Checked','off')endh2 = uimenu('Parent',h1, ... 'Callback','fm_cpffig onlypqgen', ... 'Label','Use only PQ generators', ... 'Tag','OptPQGen');if CPF.onlypqgen set(h2,'Checked','on')else set(h2,'Checked','off')endh2 = uimenu('Parent',h1, ... 'Callback','fm_cpffig areaannualgrowth', ... 'Label','Use area annual growth', ... 'Tag','OptArea');if CPF.areaannualgrowth set(h2,'Checked','on')else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -