📄 fm_stat.m
字号:
h2 = uimenu('Parent',h1, ...
'Callback','fm_stat reactivepower', ...
'Label','Switch reactive power units', ...
'Tag','tvopt', ...
'Accelerator','u');
h2 = uimenu('Parent',h1, ...
'Callback','fm_stat pgl', ...
'Label','Switch real power type', ...
'Tag','tvopt', ...
'Accelerator','e');
h2 = uimenu('Parent',h1, ...
'Callback','fm_stat qgl', ...
'Label','Switch reactive power type', ...
'Tag','tvopt', ...
'Accelerator','f');
h2 = uimenu('Parent',h1, ...
'Callback','fm_stat checkabs', ...
'Label','Use absolute values in report files', ...
'Tag','absvalues', ...
'Checked',Settings.absvalues, ...
'Separator','on', ...
'Accelerator','b');
h2 = uimenu('Parent',h1, ...
'Callback','fm_stat shunt', ...
'Label','Include shunts in line flows', ...
'Tag','shuntvalues', ...
'Checked',Settings.shuntvalues, ...
'Accelerator','c');
h2 = uimenu('Parent',h1, ...
'Callback','fm_stat violation', ...
'Label','Include limit violation checks', ...
'Tag','violations', ...
'Checked',Settings.violations, ...
'Accelerator','l');
h2 = uimenu('Parent',h1, ...
'Callback','fm_tviewer', ...
'Label','Select Text Viewer', ...
'Tag','tvopt', ...
'Separator','on', ...
'Accelerator','t');
h1 = uicontrol( ...
'Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color02, ...
'ForegroundColor',Theme.color03, ...
'Position',[0.040268 0.48392 0.91499 0.475], ...
'Style','frame', ...
'Tag','Frame1');
hP = uicontrol( ...
'Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color03, ...
'Callback','fm_stat toplist', ...
'FontName',Theme.font01, ...
'ForegroundColor',Theme.color10, ...
'Max',100, ...
'Position',[0.60235 0.51149 0.14094 0.36547], ...
'String',setvar(Bus.Pg-Bus.Pl), ...
'Style','listbox', ...
'Tag','ListboxP', ...
'Value',1);
hQ = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color03, ...
'Callback','fm_stat toplist', ...
'FontName',Theme.font01, ...
'ForegroundColor',Theme.color10, ...
'Max',100, ...
'Position',[0.7774 0.51149 0.14094 0.36547], ...
'String',setvar(Bus.Qg-Bus.Ql), ...
'Style','listbox', ...
'Tag','ListboxQ', ...
'Value',1);
hB = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color03, ...
'Callback','fm_stat toplist', ...
'FontName',Theme.font01, ...
'ForegroundColor',Theme.color06, ...
'Max',100, ...
'Position',[0.077181 0.51149 0.14094 0.36547], ...
'String',setbus, ...
'Style','listbox', ...
'Tag','ListboxBus', ...
'Value',1);
hV = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color03, ...
'Callback','fm_stat toplist', ...
'FontName',Theme.font01, ...
'ForegroundColor',Theme.color10, ...
'Max',100, ...
'Position',[0.25224 0.51149 0.14094 0.36547], ...
'String',setvar(DAE.V), ...
'Style','listbox', ...
'Tag','ListboxV', ...
'Value',1);
hA = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color03, ...
'Callback','fm_stat toplist', ...
'FontName',Theme.font01, ...
'ForegroundColor',Theme.color10, ...
'Max',100, ...
'Position',[0.42729 0.51149 0.14094 0.36547], ...
'String',setvar(DAE.a), ...
'Style','listbox', ...
'Tag','ListboxAng', ...
'Value',1);
% Static texts
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color02, ...
'HorizontalAlignment','left', ...
'Position',[0.7774 0.89227 0.12975 0.030628], ...
'String','Q', ...
'Style','text', ...
'Tag','StaticText1');
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color02, ...
'HorizontalAlignment','left', ...
'Position',[0.60235 0.89227 0.12975 0.030628], ...
'String','P', ...
'Style','text', ...
'Tag','StaticText1');
hT = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color02, ...
'HitTest','off', ...
'HorizontalAlignment','left', ...
'ListboxTop',0, ...
'Position',[0.42729 0.89227 0.12975 0.030628], ...
'String','Va', ...
'Style','text', ...
'Tag','StaticTextAng');
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color02, ...
'HorizontalAlignment','left', ...
'Position',[0.25224 0.89227 0.12975 0.030628], ...
'String','Vm', ...
'Style','text', ...
'Tag','StaticText1');
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color02, ...
'HorizontalAlignment','left', ...
'Position',[0.077181 0.89227 0.12975 0.030628], ...
'String','Bus', ...
'Style','text', ...
'Tag','StaticText1');
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color02, ...
'ForegroundColor',Theme.color03, ...
'Position',[0.040268 0.049005 0.32662 0.41041], ...
'Style','frame', ...
'Tag','Frame2');
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color02, ...
'HorizontalAlignment','left', ...
'Position',[0.072707 0.41348 0.12975 0.030628], ...
'String','State Variables', ...
'Style','text', ...
'Tag','StaticText1');
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color03, ...
'FontName',Theme.font01, ...
'ForegroundColor',Theme.color10, ...
'Max',100, ...
'Position',[0.072707 0.084227 0.26286 0.317], ...
'String',setx, ...
'Style','listbox', ...
'Tag','ListboxState', ...
'Value',1);
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color02, ...
'ForegroundColor',Theme.color03, ...
'Position',[0.41051 0.049005 0.32662 0.41041], ...
'Style','frame', ...
'Tag','Frame2');
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color03, ...
'FontName',Theme.font01, ...
'ForegroundColor',Theme.color10, ...
'Max',100, ...
'Position',[0.44295 0.084227 0.26286 0.317], ...
'String',' ', ...
'Style','listbox', ...
'Tag','ListboxServ', ...
'Value',1);
if nargin > 0,
set(h1,'String',varargin{1});
elseif ~isempty(OPF.report),
set(h1,'String',OPF.report);
else,
string = cell(0,0);
if Syn.n
idx0 = DAE.n+2*Bus.n;
idx1 = DAE.n+2*Bus.n+Syn.n;
string = [string; ...
strcat(Varname.uvars(idx0+1:idx0+Syn.n),' = ',num2str(Syn.pm)); ...
strcat(Varname.uvars(idx1+1:idx1+Syn.n),' = ',num2str(Syn.vf))];
end
if Exc.n
idx0 = DAE.n+2*Bus.n+2*Syn.n;
string = [string; ...
strcat(Varname.uvars(idx0+1:idx0+Exc.n),' = ',num2str(Exc.vrif))];
end
if Oxl.n
idx0 = DAE.n+2*Bus.n+2*Syn.n+Exc.n;
string = [string; ...
strcat(Varname.uvars(idx0+1:idx0+Oxl.n),' = ',num2str(Oxl.If))];
end
set(h1,'String',string);
end
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color02, ...
'HorizontalAlignment','left', ...
'Position',[0.44295 0.41348 0.12975 0.030628], ...
'String','Other Variables', ...
'Style','text', ...
'Tag','StaticText1');
h1 = axes('Parent',h0, ...
'Box','on', ...
'CameraUpVector',[0 1 0], ...
'CameraUpVectorMode','manual', ...
'Color',Theme.color04, ...
'ColorOrder',Settings.color, ...
'Layer','top', ...
'Position',[0.77964 0.050394 0.17785 0.176378], ...
'Tag','Axes1', ...
'XColor',Theme.color03, ...
'XLim',[0.5 190.5], ...
'XLimMode','manual', ...
'XTickLabelMode','manual', ...
'XTickMode','manual', ...
'YColor',Theme.color03, ...
'YDir','reverse', ...
'YLim',[0.5 115.5], ...
'YLimMode','manual', ...
'YTickLabelMode','manual', ...
'YTickMode','manual', ...
'ZColor',[0 0 0]);
h2 = image('Parent',h1, ...
'CData',imread([Path.images,'stat_fig.jpg'],'jpg'), ...
'Tag','Axes1Image1', ...
'XData',[1 190], ...
'YData',[1 115]);
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color02, ...
'Callback','fm_stat abscheck', ...
'Position',[0.77964 0.050394+0.176378+0.01 0.17785 0.05], ...
'String','Use absolute values', ...
'Style','checkbox', ...
'Tag','CheckABS', ...
'Value',onoff(Settings.absvalues));
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color02, ...
'Callback','fm_stat shuntcheck', ...
'Position',[0.77964 0.1108+0.176378-0.005 0.17785 0.05], ...
'String','Include shunts in LF', ...
'Style','checkbox', ...
'Tag','CheckSHUNT', ...
'Value',onoff(Settings.shuntvalues));
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color02, ...
'Callback','fm_stat violcheck', ...
'Position',[0.77964 0.1712+0.176378-0.02 0.17785 0.05], ...
'String','Check limit violations', ...
'Style','checkbox', ...
'Tag','CheckVIOL', ...
'Value',onoff(Settings.violations));
% Push buttons
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color03, ...
'Callback','fm_stat report', ...
'FontWeight','bold', ...
'ForegroundColor',Theme.color09, ...
'Position',[0.77964 0.39051 0.0839 0.061256], ...
'String','Report', ...
'Tag','Pushbutton1');
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color02, ...
'Callback','close(gcf)', ...
'Position',[0.8685 0.39051 0.0839 0.061256], ...
'String','Close', ...
'Tag','Pushbutton1');
% 'Position',[0.80425 0.39051 0.12864 0.061256], ...
% 'Position',[0.80425 0.317 0.12864 0.061256], ...
if isunix,
dy = 0.0025;
else
dy = 0;
end
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'CData', fm_mat('stat_profile'), ...
'BackgroundColor',Theme.color02, ...
'Callback','fm_stat plotv', ...
'Position',[0.34899 0.89686 0.045861 0.030628+dy], ...
'Tag','Pushbutton3');
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'CData', fm_mat('stat_pu'), ...
'BackgroundColor',Theme.color02, ...
'Callback','fm_stat kvpu', ...
'UserData','pu', ...
'Position',[0.3 0.89686 0.045861 0.030628+dy], ...
'Tag','PushVoltage');
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'CData', fm_mat('stat_profile'), ...
'BackgroundColor',Theme.color02, ...
'Callback','fm_stat plota', ...
'Position',[0.52349 0.89686 0.045861 0.030628+dy], ...
'Tag','Pushbutton3');
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'CData', fm_mat('stat_rad'), ...
'BackgroundColor',Theme.color02, ...
'Callback','fm_stat raddeg', ...
'UserData','rad', ...
'Position',[0.4745 0.89686 0.045861 0.030628+dy], ...
'Tag','PushAngle');
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'CData', fm_mat('stat_sortaz'), ...
'BackgroundColor',Theme.color02, ...
'Callback','fm_stat sort', ...
'Position',[0.1740 0.89686 0.045861 0.030628+dy], ...
'UserData','az', ...
'Tag','PushSort');
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'CData', fm_mat('stat_profile'), ...
'BackgroundColor',Theme.color02, ...
'Callback','fm_stat plotp', ...
'Position',[0.6974 0.89686 0.045861 0.030628+dy], ...
'Tag','Pushbutton3');
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'CData', fm_mat('stat_pu'), ...
'BackgroundColor',Theme.color02, ...
'Callback','fm_stat realpower', ...
'UserData','pu', ...
'Position',[0.6484 0.89686 0.045861 0.030628+dy], ...
'Tag','PushP');
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'CData', fm_mat('stat_pqi'), ...
'BackgroundColor',Theme.color02, ...
'Callback','fm_stat pgl', ...
'UserData','I', ...
'Position',[0.6224 0.89686 0.0229 0.030628+dy], ...
'Tag','PushPGL');
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'CData', fm_mat('stat_profile'), ...
'BackgroundColor',Theme.color02, ...
'Callback','fm_stat plotq', ...
'Position',[0.8725 0.89686 0.045861 0.030628+dy], ...
'Tag','Pushbutton3');
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'CData', fm_mat('stat_pu'), ...
'BackgroundColor',Theme.color02, ...
'Callback','fm_stat reactivepower', ...
'UserData','pu', ...
'Position',[0.8235 0.89686 0.045861 0.030628+dy], ...
'Tag','PushQ');
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'CData', fm_mat('stat_pqi'), ...
'BackgroundColor',Theme.color02, ...
'Callback','fm_stat qgl', ...
'UserData','I', ...
'Position',[0.7975 0.89686 0.0229 0.030628+dy], ...
'Tag','PushQGL');
set(h0,'UserData',[hB; hV; hA; hP; hQ]);
if nargout > 0, fig = h0; end
%==============================================================
function stringa = setvar(input)
global Varname Bus
busn = min(150,Bus.n);
[buss, ordbus] = sort(Varname.bus(1:busn));
hdl = findobj(gcf,'Tag','PushSort');
if ~isempty(hdl)
if strcmp(get(hdl,'UserData'),'1n')
[a,ordbus] = sort(Bus.con);
end
end
stringa = cell(busn,1);
for i = 1:busn,
stringa{i,1} = fvar(input(ordbus(i)),10);
end
%==============================================================
function stringa = setx
global DAE Varname
daen = min(100,DAE.n);
stringa = cell(daen,1);
for i = 1:daen,
stringa{i,1} = [fvar(Varname.uvars{i,1},19), fvar(DAE.x(i),10)];
end
%==============================================================
function stringa = setbus
global Varname Bus
busn = min(150,Bus.n);
[stringa, ord] = sort(Varname.bus(1:busn));
stringa = strcat('[',int2str(Bus.con(ord,1)),']-',stringa);
hdl = findobj(gcf,'Tag','PushSort');
if ~isempty(hdl)
if strcmp(get(hdl,'UserData'),'1n')
[a,ord] = sort(Bus.con(ord));
stringa = stringa(ord);
end
end
%==============================================================
function value = onoff(string)
switch string
case 'on'
value = 1;
otherwise
value = 0;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -