📄 fm_open.m
字号:
function fm_open(varargin)% FM_OPEN open a PSAT user defined component from a script%% FM_OPEN by itself opens a component asking for selecting the file,% FM_OPEN(PATH,FILE,OPTION) opens the component FILE saved in folder% PATH.%%If OPTION == 1, the component is displayed in the GUI, otherwise is%silently loaded.%%Author: Federico Milano%Date: 11-Nov-2002%Update: 15-Sep-2003%Version: 1.1.0%%E-mail: fmilano@thunderbox.uwaterloo.ca%Web-site: http://thunderbox.uwaterloo.ca/~fmilano%% Copyright (C) 2002-2005 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.global Algeb Buses Initl Param Servc Stateglobal Fig Comp Pathif isempty(varargin) % open the UDM file cd(Path.build) [filename, pathname] = uigetfile('*.m', 'Open UDM file'); cd(Path.local) if ~pathname return else settings = 1; endelse % open a saved component pathname = varargin{1}; filename = varargin{2}; settings = varargin{3};end% store Servc structureServc2 = Servc;% reset user defined component structuresBuses.n = 0;State.n = 0;Algeb.n = 0;Servc.n = 0;Param.n = 0;Initl.n = 0;State.neq = 0;Algeb.neq = 0;Servc.neq = 0;Comp.name = '';Comp.descr = '';Comp.init = 0;Comp.shunt = 1;Servc.name = [];Buses.name = [];State.name = [];Param.name = [];Algeb.name = [];Initl.name = [];State.eq = [];Algeb.eq = [];Servc.eq = [];State.eqidx = [];Algeb.eqidx = [];Servc.eqidx = [];Initl.idx = [];State.limit = [];State.time = [];State.nodyn = [];Servc.limit = [];Servc.type = [];State.un = [];State.fn = [];Param.type = [];Param.unit = [];Param.descr = [];Initl.idx = [];Algeb.idx = [];Servc.idx = [];State.init = [];State.offset = [];Servc.init = [];Servc.offset = [];Servc.un = [];Servc.fn = [];% load component structurescd(pathname)eval(strrep(filename,'.m',''));cd(Path.local)% update Servc fieldsServc.idx = [Servc2.oldidx; Servc.idx(end-2*Buses.n+1:end)];if settings fm_make % GUI handles hdl = get(Fig.make,'UserData'); % Component properties set(hdl(1),'String',Comp.name); set(hdl(2),'String',' '); set(hdl(3),'String',' '); % Variable listboxes set(hdl(4),'String',Buses.name,'Value',1); set(hdl(5),'String',State.name,'Value',1); set(hdl(6),'String',Algeb.name,'Value',1); set(hdl(7),'String',Servc.name,'Value',1); set(hdl(8),'String',Param.name,'Value',1); set(hdl(9),'String',Initl.name,'Value',1); % Equation listboxes if isempty(State.eq) set(hdl(10),'String',State.eq,'Value',1) else set(hdl(10),'String',strcat(State.eqidx,' = (',State.eq,')/',State.time),'Value',1); end if isempty(Algeb.eq) set(hdl(11),'String',Algeb.eq,'Value',1) else set(hdl(11),'String',strcat(Algeb.eqidx,'=',Algeb.eq),'Value',1); end if isempty(Servc.eq) set(hdl(12),'String',Servc.eq,'Value',1) else set(hdl(12),'String',strcat(Servc.eqidx,'=',Servc.eq),'Value',1); end % Variable popupmenus if isempty(Algeb.idx) set(hdl(13),'String',' ','Value',1) else set(hdl(13),'String',Algeb.idx,'Value',1) end set(hdl(14),'String',Servc.idx,'Value',1) if isempty(Initl.idx) set(hdl(15),'String',' ','Value',1) else set(hdl(15),'String',Initl.idx,'Value',1) endend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -