📄 fm_plotsel.m
字号:
'Position',[0.1066 0.1185 0.8020 0.7852],... 'String',{ '<Empty>' },... 'Style','listbox',... 'Value',1,... 'Tag','listbox4');if ~Varname.areas(1) Varname.areas = 0; set(h7,'Value',1)else set(h7,'Value',Varname.areas+1);endh8 = uicontrol(... 'Parent',h0, ... 'Units','normalized',... 'BackgroundColor',Theme.color03, ... 'FontWeight','bold', ... 'ForegroundColor',Theme.color09, ... 'Callback','close(gcf);', ... 'Position',[0.8092 0.1087 0.1259 0.0580],... 'String','Close',... 'Tag','Pushbutton1');h8 = uicontrol(... 'Parent',h0, ... 'Callback','fm_plotsel appendidx', ... 'Units','normalized',... 'BackgroundColor',Theme.color02, ... 'Position',[0.6222 0.1087 0.1259 0.0598],... 'String','Save',... 'Tag','Pushbutton2');h10 = uicontrol(... 'CData',fm_mat('plotsel_pij'), ... 'Parent',h0, ... 'Units','normalized',... 'Callback','fm_plotsel setPij', ... 'HorizontalAlignment','center', ... 'Position',[0.0611 0.0453 0.0623 0.0924],... 'String','',... 'Value',Varname.Pij,... 'Style','togglebutton',... 'Tag','radiobutton1');h11 = uicontrol(... 'CData',fm_mat('plotsel_qij'), ... 'Parent',h0, ... 'Units','normalized',... 'Callback','fm_plotsel setQij', ... 'HorizontalAlignment','center', ... 'Position',[0.1297 0.0453 0.0623 0.0924],... 'String','',... 'Value',Varname.Qij,... 'Style','togglebutton',... 'Tag','radiobutton2');h12 = uicontrol(... 'CData',fm_mat('plotsel_iij'), ... 'Parent',h0, ... 'Units','normalized',... 'Callback','fm_plotsel setIij', ... 'Position',[0.1983 0.0453 0.0623 0.0924],... 'HorizontalAlignment','center', ... 'String','',... 'Value',Varname.Iij,... 'Style','togglebutton',... 'Tag','radiobutton3');h13 = uicontrol(... 'CData',fm_mat('plotsel_sij'), ... 'Parent',h0, ... 'Units','normalized',... 'Callback','fm_plotsel setSij', ... 'Position',[0.2668 0.0453 0.0623 0.0924],... 'HorizontalAlignment','center', ... 'String','',... 'Style','togglebutton',... 'Value',Varname.Sij,... 'Tag','radiobutton4');h10 = uicontrol(... 'CData',fm_mat('plotsel_x'), ... 'Parent',h0, ... 'Units','normalized',... 'Callback','fm_plotsel setx', ... 'HorizontalAlignment','center', ... 'Position',[0.0611 0.1467 0.0623 0.0924],... 'String','',... 'Value',Varname.x,... 'Style','togglebutton',... 'Tag','radiobutton5');h11 = uicontrol(... 'CData',fm_mat('plotsel_y'), ... 'Parent',h0, ... 'Units','normalized',... 'Callback','fm_plotsel sety', ... 'HorizontalAlignment','center', ... 'Position',[0.1297 0.1467 0.0623 0.0924],... 'String','',... 'Value',Varname.y,... 'Style','togglebutton',... 'Tag','radiobutton6');h12 = uicontrol(... 'CData',fm_mat('plotsel_p'), ... 'Parent',h0, ... 'Units','normalized',... 'Callback','fm_plotsel setP', ... 'Position',[0.1983 0.1467 0.0623 0.0924],... 'HorizontalAlignment','center', ... 'String','',... 'Value',Varname.P,... 'Style','togglebutton',... 'Tag','radiobutton7');h13 = uicontrol(... 'CData',fm_mat('plotsel_q'), ... 'Parent',h0, ... 'Units','normalized',... 'Callback','fm_plotsel setQ', ... 'Position',[0.2668 0.1467 0.0623 0.0924],... 'HorizontalAlignment','center', ... 'String','',... 'Style','togglebutton',... 'Value',Varname.Q,... 'Tag','radiobutton8');h6 = uicontrol(... 'Parent',h0, ... 'Units','normalized',... 'Callback','fm_plotsel fixed', ... 'CreateFcn','fm_plotsel create_fixed', ... 'Position',[0.3728 0.1594 0.1870 0.0453],... 'HorizontalAlignment','left', ... 'String','Fixed Selection',... 'Value',Varname.fixed,... 'Style','checkbox',... 'Tag','checkbox_fixed');h7 = uicontrol(... 'Parent',h0, ... 'Units','normalized',... 'Callback','fm_plotsel custom', ... 'CreateFcn','fm_plotsel create_custom', ... 'Position',[0.3728 0.0688 0.1870 0.0453],... 'HorizontalAlignment','left', ... 'String','Manual Selection',... 'Value',Varname.custom,... 'Style','checkbox',... 'Tag','checkbox_custom');h1 = uicontrol( ... 'Parent',h0, ... 'CData',fm_mat('main_exit'), ... 'Units','normalized', ... 'BackgroundColor',Theme.color02, ... 'Callback','fm_plotsel remove', ... 'Position',[0.885 0.9 0.05 0.05], ... 'Tag','PushRemove');if nargout > 0, fig = h0; end% ===============================================function setarea(s1,s2,s3,s4)% ===============================================global Varnamevalue = get(gcbo,'Value');hdl_fix = findobj(gcf,'Tag','checkbox_fixed');hdl_cus = findobj(gcf,'Tag','checkbox_custom');hdl_list1 = findobj(gcf,'Tag','listbox1');hdl_list2 = findobj(gcf,'Tag','listbox2');hdl_tog = findobj(gcf,'Style','togglebutton');hdl_text1 = findobj(gcf,'Tag','StaticText1');hdl_text2 = findobj(gcf,'Tag','StaticText2');hdl_text3 = findobj(gcf,'Tag','StaticText3');if value set(hdl_fix,'Value',s1); set(hdl_cus,'Value',s2); set(hdl_list1,'Enable',s3) set(hdl_tog,'Enable',s4) set(hdl_text1,'Enable',s3) set(hdl_text3,'Enable',s4) Varname.custom = s2; Varname.fixed = s1;else set(hdl_fix,'Value',s2); set(hdl_cus,'Value',s1); set(hdl_list1,'Enable',s4) set(hdl_tog,'Enable',s3) set(hdl_text1,'Enable',s4) set(hdl_text3,'Enable',s3) Varname.custom = s1; Varname.fixed = s2;end% ===============================================function setidx% ===============================================global Varname Bus DAE Settings Fig Areas Regionsif Varname.fixed Varname.idx = []; n1 = DAE.n+DAE.m; n2 = n1 + 2*Bus.n; n3 = 2*Settings.nseries; jdx = [1:(2*Settings.nseries)]'; if Varname.x Varname.idx = [1:DAE.n]'; end if Varname.y idx0 = DAE.n; Varname.idx = [Varname.idx; idx0+[1:DAE.m]']; end if Varname.P idx0 = n1; Varname.idx = [Varname.idx; idx0+Bus.a]; end if Varname.Q idx0 = n1; Varname.idx = [Varname.idx; idx0+Bus.v]; end if Varname.Pij idx0 = n2; Varname.idx = [Varname.idx; idx0+jdx]; end if Varname.Qij idx0 = n2 + n3; Varname.idx = [Varname.idx; idx0+jdx]; end if Varname.Iij idx0 = n2 + 2*n3; Varname.idx = [Varname.idx; idx0+jdx]; end if Varname.Sij idx0 = n2 + 3*n3; Varname.idx = [Varname.idx; idx0+jdx]; endelseif Varname.custom Varname.idx = get(findobj(gcf,'Tag','listbox1'),'Value');end% take into account area selectionif Varname.areas(1), setzone('area'), end% take into account region selectionif Varname.regions(1), setzone('region'), endhdl_list2 = findobj(gcf,'Tag','listbox2');if isempty(Varname.idx) set(hdl_list2,'String','<Empty>','Value',1)else set(hdl_list2,'String',Varname.uvars(Varname.idx), ... 'Value',1, ... 'ListboxTop',1)end% ===============================================function setzone(type)% ===============================================global DAE Areas Bus Regions Settings Varnamen1 = DAE.n+DAE.m;n2 = n1 + 2*Bus.n;n3 = Settings.nseries;n4 = 2*n3;switch type case 'area' zdx = getidx(Areas,Varname.areas); buses = getarea(Bus,0,0); case 'region' zdx = getidx(Regions,Varname.regions); buses = getregion(Bus,0,0);end% find buses within selected zonesbdx = find(ismember(buses,zdx));idx = getint(Bus,getidx(Bus,bdx));% find series components within selected zones[fr,to] = fm_flows('onlyidx');series1 = ismember(fr,idx);series2 = ismember(to,idx);ldx = find(series1+series2);% find state and algebraic variables within selected zones[x,y] = fm_getxy(idx);values = [];if Varname.x | (Varname.y & ~isempty(y)) values = [x; DAE.n+y];endif Varname.y values = [values; DAE.n+[bdx; Bus.n+bdx]];endif Varname.P values = [values; n1+bdx];endif Varname.Q values = [values; n1+Bus.n+bdx];endif Varname.Pij values = [values; n2+ldx]; values = [values; n2+n3+ldx];endif Varname.Qij values = [values; n2+n4+ldx]; values = [values; n2+n3+n4+ldx];endif Varname.Iij values = [values; n2+2*n4+ldx]; values = [values; n2+2*n4+n3+ldx];endif Varname.Sij values = [values; n2+3*n4+ldx]; values = [values; n2+3*n4+n3+ldx];endvalues = sort(values);Varname.idx = intersect(Varname.idx,values);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -