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

📄 fm_setting.m

📁 电力系统分析计算程序
💻 M
📖 第 1 页 / 共 2 页
字号:
function fig = fm_setting(varargin)% FM_SETTING create GUI for general settings%% HDL = FM_SETTING()%%Author:    Federico Milano%Date:      11-Nov-2002%Version:   1.0.0%%E-mail:    Federico.Milano@uclm.es%Web-site:  http://www.uclm.es/area/gsee/Web/Federico%% Copyright (C) 2002-2008 Federico Milanoglobal Settings Theme Figif nargin  switch varargin{1}   case 'tstep'    if isempty(str2num(get(gcbo,'String')))      set(gcbo,'String',num2str(Settings.tstep));      fm_disp('Time step cannot be empty.',2)    else      oldtstep = Settings.tstep;      Settings.tstep = str2num(get(gcbo,'String'));      if Settings.tstep == 0        Settings.tstep = oldtstep;        set(gcbo,'String',num2str(Settings.tstep));        fm_disp('Time step cannot be zero.',2)      elseif Settings.tstep < 0        Settings.tstep = oldtstep;        set(gcbo,'String',num2str(Settings.tstep));        fm_disp('Time step cannot be negative.',2)      end      fm_disp(['Time step set to ',num2str(Settings.tstep),' s'])    end   case 'deltadelta'    if isempty(str2num(get(gcbo,'String')))      set(gcbo,'String',num2str(Settings.deltadelta));      fm_disp('Max delta diff. cannot be empty.',2)    else      olddiff = Settings.deltadelta;      Settings.deltadelta = str2num(get(gcbo,'String'));      if Settings.deltadelta == 0        Settings.deltadelta = olddiff;        set(gcbo,'String',num2str(Settings.deltadelta));        fm_disp('Max delta diff. cannot be zero.',2)      elseif Settings.deltadelta < 0        Settings.deltadelta = olddiff;        set(gcbo,'String',num2str(Settings.deltadelta));        fm_disp('Max delta diff. cannot be negative.',2)      end      fm_disp(['Max delta diff. set to ',num2str(Settings.deltadelta),' s'])    end   case 'checkdelta'    Settings.checkdelta = get(gcbo,'Value');    hdl = findobj(gcf,'Tag','EditTextDelta');    if Settings.checkdelta      set(hdl,'Enable','on');    else      set(hdl,'Enable','off');    end   case 'simulink'    Settings.simtd = get(gcbo,'Value');   case 'fixt'    Settings.fixt = get(gcbo,'Value');    hdl = findobj(gcf,'Tag','EditTextTimeStep');    if Settings.fixt      set(hdl,'Enable','on');    else      set(hdl,'Enable','off');    end   case 'setplot'    Settings.plot = get(gcbo,'Value');    hdlvar = findobj(gcbf,'Tag','PopupMenu2');    if Settings.plot      set(hdlvar,'Enable','on');      set(hdlvar,'Value',1);      Settings.plottype = 1;    else      set(hdlvar,'Enable','off');    end   case 'setvscomp'    % This is for enforce the computation of trajectories    % during time domain simulations.    % This option is currently undocumented.    Settings.vs = get(gcbo,'Value');    hdlvar = findobj(gcbf,'Tag','PopupMenu2');    aaa = get(hdlvar,'Value');    if Settings.vs == 0 & aaa == 6      set(hdlvar,'Value',1);      Settings.plottype = 1;    end   case 'setplotvar'    Settings.plottype = get(gcbo,'Value');    if Settings.plottype == 6 & Settings.vs == 0      fm_disp(['You can plot voltage stability indices only if you ' ...               'select Voltage Stability Computations'],2)      set(gcbo,'Value',1);      Settings.plottype = 1;    end  endendif Fig.setting, figure(Fig.setting), return, endmethods = {'Forward Euler'; ...           'Trapezoidal Rule'};plottype = {'State Variables'; ...            'Node Voltages'; ...            'Node Phases'; ...            'Active Power'; ...            'Reactive Power'};pfsolver = {'NR method', ...            'XB fast decoupled', ...            'BX fast decoupled', ...            'Runge-Kutta method', ...            'Iwamoto method', ...            'Simple robust method'};N = 10.75;D = (N+3)*0.039+0.0244;d1 = 1.1*1/(2*N+3);d2 = 1.2*d1;h0 = figure('Color',Theme.color01, ...            'Units', 'normalized', ...            'ColorMap', [], ...            'CreateFcn','Fig.setting = gcf;', ...            'DeleteFcn','Fig.setting = 0;', ...            'FileName','fm_setting', ...            'MenuBar','none', ...            'Name','General Settings', ...            'NumberTitle','off', ...            'PaperPosition',[18 180 576 432], ...            'PaperType','A4', ...            'PaperUnits','points', ...            'Position',sizefig(0.3906,D), ...            'RendererMode','manual', ...            'Tag','Settings', ...            'ToolBar','none', ...            'UserData',Settings);% Menu Fileh1 = uimenu('Parent',h0, ...            'Label','File', ...            'Tag','MenuFile');h2 = uimenu('Parent',h1, ...            'Callback','close(gcf);', ...            'Label','Save and Exit', ...            'Tag','OTV', ...            'Accelerator','s');h2 = uimenu('Parent',h1, ...            'Callback','Settings = get(gcf,''UserData''); close(gcf);', ...            'Label','Discard and Exit', ...            'Tag','NetSett', ...            'Accelerator','x', ...            'Separator','on');h1 = uicontrol('Parent',h0, ...               'Units', 'normalized', ...               'BackgroundColor',Theme.color02, ...               'ForegroundColor',Theme.color03, ...               'Position',[0.038 d1 0.92 1-2*d1], ...               'Style','frame', ...               'Tag','Frame1');d3 = 0.95*d1;% Left-hand checkboxesh1 = uicontrol('Parent',h0, ...               'Units', 'normalized', ...               'BackgroundColor',Theme.color02, ...               'Callback','Settings.distrsw = get(gcbo,''Value'');', ...               'Position',[0.078  5*d3  0.43  d2], ...               'String','Use Distributed Slack Bus', ...               'Style','checkbox', ...               'Tag','Checkbox6', ...               'Value',Settings.distrsw);h1 = uicontrol('Parent',h0, ...               'Units', 'normalized', ...               'BackgroundColor',Theme.color02, ...               'Callback','Settings.static = get(gcbo,''Value'');', ...               'Position',[0.078  6.5*d3  0.43  d2], ...               'String','Discard Dynamic Comp.', ...               'Style','checkbox', ...               'Tag','Checkbox5', ...               'Value',Settings.static);h1 = uicontrol('Parent',h0, ...               'Units', 'normalized', ...               'BackgroundColor',Theme.color02, ...               'Callback','fm_setting checkdelta', ...               'Position',[0.078  18.5*d3  0.43  d2], ...               'String','Stop TDs at max delta', ...               'Style','checkbox', ...               'Tag','Checkbox5', ...               'Value',Settings.checkdelta);h1 = uicontrol('Parent',h0, ...               'Units', 'normalized', ...               'BackgroundColor',Theme.color02, ...               'Callback','Settings.showlf = get(gcbo,''Value'');', ...               'Position',[0.078  11*d3  0.43  d2], ...               'String','Show Power Flow Results', ...               'Style','checkbox', ...               'Tag','Checkbox4', ...               'Value',Settings.showlf); h1 = uicontrol('Parent',h0, ...                'Units', 'normalized', ...                'BackgroundColor',Theme.color02, ...                'Callback','Settings.forcepq = get(gcbo,''Value'');', ...                'Position',[0.078  8*d3  0.43  d2], ...                'String','Force constant PQ loads', ...                'Style','checkbox', ...                'Tag','Checkbox44', ...                'Value',Settings.forcepq);

⌨️ 快捷键说明

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