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

📄 fm_dirset.m

📁 基于PSAT 软件的多目标最优潮流计算用于中小型电力系统的分析和管理
💻 M
📖 第 1 页 / 共 2 页
字号:
function varargout = fm_dirset(type)% FM_DIRSET define settings and actions for the data format%           conversion GUI%% FM_DIRSET(TYPE)%      TYPE action indentifier%%see also FM_DIR%%Author:    Federico Milano%Date:      11-Nov-2002%Update:    05-Jul-2003%Update:    31-Jul-2003%Update:    07-Oct-2003%Version:   1.1.0%%E-mail:    fmilano@thunderbox.uwaterloo.ca%Web-site:  http://thunderbox.uwaterloo.ca/~fmilano%% Copyright (C) 2002-2006 Federico Milanoglobal Path Fig Settings Themehdl = findobj(Fig.dir,'Tag','PopupMenu1');formato = get(hdl,'Value');hdl_dir = findobj(Fig.dir,'Tag','EditText1');folder1 = get(hdl_dir,'String');if ischar(folder1), cd(folder1), end% codes:IEEE = 1;PSAT = 2;PSATPERT = 3;PSATMDL = 4;CYME = 5;MATPOWER = 6;PST = 7;EPRI = 8;PSSE = 9;PSAP = 10;EUROSTAG = 11;TH = 12;CESI = 13;VST = 14;SIMPOW = 15;NEPLAN = 16;DIGSILENT = 17;POWERWORLD = 18;PET = 19;FLOWDEMO = 20;GEEPC = 21;CHAPMAN = 22;UCTE = 23;PCFLO = 24;WEBFLOW = 25;VITRUVIO = 26; % all filesswitch type  case 'formatlist'  formati = cell(VITRUVIO,1);  formati{IEEE} = 'IEEE CDF (.dat, .txt, .cf)';  formati{CYME} = 'CYME (.nnd, .sf)';  formati{MATPOWER} = 'MatPower (.m)';  formati{PSAT} = 'PSAT data (d*.m)';  formati{PSATPERT} = 'PSAT pert. (p*.m)';  formati{PSATMDL} = 'PSAT Simulink (.mdl)';  formati{PST} = 'PST (.m)';  formati{EPRI} = 'EPRI (.wsc, .txt, .dat)';  formati{PSSE} = 'PSS/E (.raw)';  formati{PSAP} = 'PSAP (.dat)';  formati{EUROSTAG} = 'Eurostag (.dat)';  formati{TH} = 'TH (.dat)';  formati{CESI} = 'INPTC1 (.dat)';  formati{VST} = 'VST (.dat)';  formati{SIMPOW} = 'SIMPOW (.optpow, .dynpow)';  formati{NEPLAN} = 'NEPLAN (.ndt)';  formati{DIGSILENT} = 'DigSilent (.dgs)';  formati{POWERWORLD} = 'PowerWorld (.aux)';  formati{PET} = 'PET (.pet)';  formati{FLOWDEMO} = 'Flowdemo.net (.fdn)';  formati{GEEPC} = 'GE format (.epc)';  formati{CHAPMAN} = 'Chapman format';  formati{UCTE} = 'UCTE format';  formati{PCFLO} = 'PCFLO format';  formati{WEBFLOW} = 'WebFlow format';  formati{VITRUVIO} = 'All Files (*.*)';  varargout(1) = {formati}; %================================================================== case 'changedir'  hdl = findobj(Fig.dir,'Tag','Listbox1');  cdir = get(hdl,'String');  ndir = get(hdl,'Value');  namedir = cdir{ndir(1),1};  switch namedir   case '..'    eval('cd ..');   case '.'    if ~isempty(dir(namedir))      cd(namedir);    end   case '[ * DATA * ]'    if isempty(Path.data), return, end    cd(Path.data)   case '[ * PERT * ]'    if isempty(Path.pert), return, end    cd(Path.pert)   case '[ * LOCAL * ]'    if isempty(Path.local), return, end    cd(Path.local)   case '[ * PSAT * ]'    if isempty(Path.psat), return, end    cd(Path.psat)   otherwise    cd(namedir)  end  a = dir;  numdir = find([a.isdir] == 1);  cdir = {a(numdir).name}';  cdir(strmatch('.',cdir)) = [];  cdir(strmatch('@',cdir)) = [];  set(hdl,'String',[{'.'; '..'};cdir;get(hdl,'UserData')],'Value',1);  hdl = findobj(Fig.dir,'Tag','EditText1');  set(hdl,'String',pwd);  set(Fig.dir,'UserData',pwd);  hdl = findobj(Fig.dir,'Tag','Listbox2');  hdlf = findobj(Fig.dir,'Tag','PopupMenu1');  cfile = uform(get(hdlf,'Value'));  if isempty(cfile)    cfile = 'empty';  else    cfile = sort(cfile);  end  set(hdl,'String',cfile,'Value',1); %================================================================== case 'chformat'  hdlf = findobj(Fig.dir,'Tag','PopupMenu1');  formato = get(hdlf,'Value');  hdl = findobj(Fig.dir,'Tag','Listbox2');  hdlc = findobj(Fig.dir,'Tag','Pushbutton1');  hdl1 = findobj(Fig.dir,'Tag','Checkbox1');  hdl2 = findobj(Fig.dir,'Tag','Checkbox2');  hdl4 = findobj(Fig.dir,'Tag','StaticText2');  cfile = uform(formato);  switch formato   case IEEE,  file = 'ieee';   case CYME,  file = 'cyme';   case MATPOWER,  file = 'pserc';   case PSAT,  file = 'psat';   case PSATPERT,  file = 'psat';   case PSATMDL,  file = 'simulink';   case PST,  file = 'cherry';   case EPRI,  file = 'epri';   case PSSE,  file = 'pti';   case PSAP,  file = 'pjm';   case EUROSTAG,  file = 'eurostag';   case TH, file = 'th';   case CESI, file = 'cesi';   case VST, file = 'cepe';   case SIMPOW, file = 'simpow';   case NEPLAN, file = 'neplan';   case DIGSILENT, file = 'digsilent';   case POWERWORLD, file = 'powerworld';   case PET, file = 'pet';   case FLOWDEMO, file = 'eeh';   case GEEPC, file = 'ge';   case CHAPMAN, file = 'chapman';   case UCTE, file = 'ucte';   case PCFLO, file = 'pcflo';   case WEBFLOW, file = 'webflow';   case VITRUVIO, file = 'vitruvio';  end  if formato == VITRUVIO,    if ~get(hdlf,'UserData'), set(hdlc,'Enable','off'), end    set(hdl1,'Enable','off')    set(hdl2,'Enable','off')    set(hdl4,'Enable','off')  elseif formato == PSAT,    set(hdlc,'Enable','on')    set(hdl1,'Enable','off','Value',0)    if ~get(hdlf,'UserData'), set(hdl2,'Enable','on'), end    if ~get(hdlf,'UserData'), set(hdl4,'Enable','on'), end  elseif formato == PSATPERT,    if ~get(hdlf,'UserData'), set(hdlc,'Enable','off'), end    set(hdl1,'Enable','off')    set(hdl2,'Enable','off')    set(hdl4,'Enable','off')  else % all other formats    set(hdlc,'Enable','on')    set(hdl1,'Enable','inactive','Value',1)    set(hdl2,'Enable','off')    set(hdl4,'Enable','off')  end  a = imread([Path.images,'logo_',file,'.jpg'],'jpg');  [yl,xl,zl] = size(a);  set(Fig.dir,'Units','pixels')  figdim = get(Fig.dir,'Position');  set(Fig.dir,'Units','normalized')  dimx = figdim(3)*0.2616;  dimy = figdim(4)*0.3468;  rl = xl/yl;  if dimx > xl & dimy > yl    xd = xl/figdim(3);    yd = yl/figdim(4);    set(gca,'Position',[0.8358-xd/2, 0.5722-yd/2, xd, yd]);  elseif xl > yl,    xd = 0.2616;    yd = 0.3468/rl;    set(gca,'Position',[0.7050, 0.5722-0.1734/rl, xd, yd]);  else,    xd = 0.2616*rl;    yd = 0.3468;    set(gca,'Position',[0.8358-0.1308*rl, 0.3988, xd, yd]);  end  xd = round(xd*figdim(3));  yd = round(yd*figdim(4));  %disp([xl yl xd yd])  if xd ~= xl & yd ~= yl    try      a = imresize(a,[yd xd],'bilinear',11);    catch      % imresize is not available!!!    end  end  set(gca,'XLim',[0.5 xd+0.5],'YLim',[0.5  yd+0.5]);  set(get(gca,'Children'),'CData',a,'XData',[1 xd],'YData',[1 yd]);  set(gca,'XTick',[],'XTickLabel','','XColor',Theme.color01);  set(gca,'YTick',[],'YTickLabel','','YColor',Theme.color01);  if isempty(cfile), cfile = 'empty'; else, cfile = sort(cfile); end  set(hdl,'String',cfile,'Value',1); %================================================================== case 'editinit'  if ~isempty(Path.temp)    try      cd(Path.temp);    catch      % nothing to do    end   elseif ~isempty(Path.data)    try      cd(Path.data);    catch      % nothing to do    end       end  set(gcbo,'String',pwd)  set(gcf,'UserData',pwd); %================================================================== case 'dirinit'  devices = getdevices;  devices{end+1,1} = '[ * DATA * ]';  devices{end+1,1} = '[ * PERT * ]';  devices{end+1,1} = '[ * LOCAL * ]';  devices{end+1,1} = '[ * PSAT * ]';  set(gcbo,'UserData',devices)  cd(get(gcf,'UserData'))  a = dir;  numdir = find([a.isdir] == 1);  if isempty(numdir)    cdir = {' '};  else    cdir = {a(numdir).name}';    cdir(strmatch('.',cdir)) = [];    cdir(strmatch('@',cdir)) = [];  end  set(findobj(Fig.dir,'Tag','Listbox1'), ...      'String',[{'.';'..'};cdir; devices]); %================================================================== case 'dirsel'  values = get(gcbo,'Value');  set(gcbo,'Value',values(end));  if strcmp(get(Fig.dir,'SelectionType'),'open')    cd(Path.local)    fm_dirset('changedir');  end %================================================================== case 'diredit'    hdl = findobj(Fig.dir,'Tag','EditText1');  cartella = get(hdl,'String');  try    cd(cartella);    hdl = findobj(Fig.dir,'Tag','Listbox1');    a = dir;    cdir = {'.';'..'};    numdir = find([a.isdir] == 1);    j = 2;    for i = 1:length(numdir)      if ~strcmp(a(numdir(i)).name(1),'.') & isunix        j = j + 1;        cdir{j,1} = a(numdir(i)).name;      end    end    if isempty(cdir),      cdir = ' ';    else,      cdir = sort(cdir);    end    set(hdl,'String',[cdir;get(hdl,'UserData')],'Value',1);    hdl = findobj(Fig.dir,'Tag','Listbox2');    cfile = uform(formato);    if isempty(cfile),      cfile = 'empty';    else,      cfile = sort(cfile);    end    set(hdl,'String',cfile,'Value',1);    set(Fig.dir,'UserData',cartella);  catch    fm_disp(lasterr,2)    set(hdl_dir,'String',get(Fig.dir,'UserData'));  end %================================================================== case 'getfolder'  pathname = get(Fig.dir,'UserData');  cartella = uigetdir(pathname);  if cartella    hdl = findobj(Fig.dir,'Tag','EditText1');    set(hdl,'String',cartella);    cd(Path.local)    fm_dirset('diredit');  end %================================================================== case 'convert'  hdl = findobj(Fig.dir,'Tag','Listbox2');  numfile = get(hdl,'Value');  nomefile = get(hdl,'String');  if ~iscell(nomefile),    nomefile = cellstr(nomefile);  end  hdl = findobj(Fig.dir,'Tag','PopupMenu1');  if numfile == 1 & strcmp(nomefile{1},'empty')    fm_disp('Current folder does not contain files in the selected format.',2)    cd(Path.local)    return  end  % if coverting a PSAT file, get destination format  hdlpsat = findobj(Fig.dir,'Tag','Checkbox2');  convpsat = get(hdlpsat,'Value');  for i = 1:length(numfile)    lasterr('');    filename = nomefile{numfile(i),1};    check = 0;    switch get(hdl,'Value')     case IEEE      check = fm_perl('IEEE CDF','ieee2psat',filename);     case CYME      check = fm_perl('CYME','cyme2psat',filename);     case MATPOWER      check = matpower2psat(filename,pwd);     case PSAT      switch convpsat       case 1, check = psat2ieee(filename,pwd);       case 2, check = psat2epri(filename,pwd);      end     case PSATMDL      check = sim2psat(filename,pwd);           case PSATPERT      fm_disp('No filter is associated with pertubation files.')     case PST      check = pst2psat(filename,pwd);     case EPRI      check = fm_perl('WSCC','epri2psat',filename);     case PSSE      check = fm_perl('PSS/E','psse2psat',filename);     case PSAP      check = fm_perl('PSAP','psap2psat',filename);     case EUROSTAG      check = fm_perl('EUROSTAG','eurostag2psat',filename);     case TH,      check = fm_perl('TH','th2psat',filename);     case CESI,      fm_choice(['Filter for INPTC1 data format has not been implemeted ' ...                 'yet.'],2)      break     case VST      check = fm_perl('VST','vst2psat',filename);     case SIMPOW      check = fm_perl('SIMPOW','simpow2psat',filename);     case NEPLAN      check = fm_perl('NEPLAN','neplan2psat',filename);     case DIGSILENT      check = fm_perl('DIGSILENT','digsilent2psat',filename);     case POWERWORLD      check = fm_perl('PowerWorld','pwrworld2psat',filename);     case PET

⌨️ 快捷键说明

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