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

📄 fm_cpffig.m

📁 这是一个很适合研究和学习用的电力系统仿真软件
💻 M
📖 第 1 页 / 共 2 页
字号:
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:    fmilano@thunderbox.uwaterloo.ca
%Web-site:  http://thunderbox.uwaterloo.ca/~fmilano
%
% Copyright (C) 2002-2006 Federico Milano

global Settings Path CPF Theme Fig

if 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;
    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;
    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

  end

  return

end

if Fig.cpf, figure(Fig.cpf), return, end

flussi = {'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;

h0 = 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 File
h1 = uimenu('Parent',h0, ...
            'Label','File', ...
            'Tag','MenuFile');
h2 = uimenu('Parent',h1, ...
            'Callback','close(gcf)', ...
            'Label','Exit', ...
            'Tag','NetSett', ...
            'Accelerator','x');

% Menu Edit
h1 = uimenu('Parent',h0, ...
            'Label','Edit', ...
            'Tag','MenuEdit');
h2 = uimenu('Parent',h1, ...
            'Callback','fm_setting', ...
            'Label','General Settings', ...
            'Tag','ToolSett', ...
            'Accelerator','s');
% Menu Run
h1 = 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 Options
h1 = 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')
end
h2 = 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')
end
h2 = 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')
end
h2 = uimenu('Parent',h1, ...
            'Callback','fm_cpffig onlynegload', ...
            'Label','Use only negative loads', ...
            'Tag','OptNegLoad');
if CPF.onlynegload
  set(h2,'Checked','on')
else
  set(h2,'Checked','off')
end

% Frame
h1 = uicontrol('Parent',h0, ...
               'Units', nr, ...
               'BackgroundColor',c2, ...
               'ForegroundColor',c3, ...
               'Position',[0.025 0.275 0.95 0.675], ...
               'Style','frame', ...
               'Tag','Frame1');

% Popup Menus
h1 = uicontrol('Parent',h0, ...
               'Units', nr, ...
               'BackgroundColor',c4, ...
               'Callback', 'CPF.method = get(gcbo,''Value'');', ...
               'FontName', f1, ...
               'ForegroundColor',c5, ...
               'Position',[0.608  0.79  0.342  0.06], ...
               'String', metodi, ...
               'Style', 'popupmenu', ...
               'Tag','PopupMenu1', ...
               'Value',CPF.method);
h1 = uicontrol('Parent',h0, ...
               'Units', nr, ...
               'BackgroundColor',c4, ...
               'Callback', 'CPF.flow = get(gcbo,''Value'');', ...
               'ForegroundColor',c5, ...
               'FontName', f1, ...
               'Position',[0.608 0.64  0.342  0.06], ...
               'String',flussi, ...
               'Style','popupmenu', ...
               'Tag','PopupMenu2', ...
               'Value',CPF.flow);
if CPF.ilim == 0
  set(h1,'Enable','off')
end

h1 = uicontrol('Parent',h0, ...
               'Units', nr, ...
               'BackgroundColor',c4, ...
               'Callback', 'CPF.type = get(gcbo,''Value'');', ...
               'ForegroundColor',c5, ...
               'FontName', f1, ...
               'Position',[0.608 0.49  0.342  0.06], ...
               'String',tipi, ...
               'Style','popupmenu', ...
               'Tag','PopupMenu3', ...
               'Value',CPF.type);
h1 = uicontrol('Parent',h0, ...
               'Units', nr, ...
               'BackgroundColor',c2, ...
               'HorizontalAlignment','left', ...
               'Position',[0.608  0.86  0.3  0.05], ...
               'String', 'Corrector Step Method', ...
               'Style', 'text', ...
               'Tag', 'StaticText12');
h1 = uicontrol('Parent',h0, ...
               'Units', nr, ...
               'BackgroundColor',c2, ...
               'HorizontalAlignment','left', ...

⌨️ 快捷键说明

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