-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfm_advanced.m
186 lines (171 loc) · 6.85 KB
/
fm_advanced.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
function fig = fm_advanced(varargin)
% FM_ADVANCED create GUI for advanced settings
%
% HDL = FM_ADVANCED()
%
%Author: Federico Milano
%Date: 04-Jul-2008
%Version: 1.0.0
%
%E-mail: [email protected]
%Web-site: faraday1.ucd.ie/psat.html
%
% Copyright (C) 2002-2019 Federico Milano
global Settings Theme Fig
if nargin
switch varargin{1}
case 'iternum'
if isempty(str2num(get(gcbo,'String')))
set(gcbo,'String',num2str(Settings.pv2pqniter));
fm_disp('The iteration number cannot be empty.',2)
else
Settings.pv2pqniter = round(str2num(get(gcbo,'String')));
fm_disp(['Iteration number set to ',num2str(Settings.pv2pqniter)])
end
end
return
end
if ishandle(Fig.advanced), figure(Fig.advanced), return, end
N = 10.75;
D = (N+3)*0.039+0.0244;
d1 = 1.1*1/(2*N+3);
d2 = 1.2*d1;
d3 = 0.95*d1;
h0 = figure('Color',Theme.color01, ...
'Units', 'normalized', ...
'ColorMap', [], ...
'CreateFcn','Fig.advanced = gcf;', ...
'DeleteFcn','Fig.advanced = -1;', ...
'FileName','fm_advanced', ...
'MenuBar','none', ...
'Name','Advanced Settings', ...
'NumberTitle','off', ...
'PaperPosition',[18 180 576 432], ...
'PaperType','A4', ...
'PaperUnits','points', ...
'Position',sizefig(0.55,D), ...
'RendererMode','manual', ...
'Tag','Advanced', ...
'ToolBar','none', ...
'UserData',Settings);
% Menu File
h1 = 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');
% settings
if strcmp(Settings.platform,'MAC')
aligntxt = 'center';
dm = 0.015;
else
aligntxt = 'left';
dm = 0.0;
end
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color02, ...
'Callback','Settings.resetangles = get(gcbo,''Value'');', ...
'Position',[0.078 20*d3 2*0.43 d2], ...
'String','Reset pre-fault bus angles after fault clearing', ...
'Style','checkbox', ...
'Tag','CheckboxReset', ...
'Value',Settings.resetangles);
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color02, ...
'Callback','Settings.switch2nr = get(gcbo,''Value'');', ...
'Position',[0.078 18.5*d3 2*0.43 d2], ...
'String','Switch back to the NR method for small mismatches', ...
'Style','checkbox', ...
'Tag','CheckboxSwitch', ...
'Value',Settings.switch2nr);
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color02, ...
'Callback','Settings.donotask = get(gcbo,''Value'');', ...
'Position',[0.078 17*d3 2*0.43 d2], ...
'String','Apply current options without asking for confirmation', ...
'Style','checkbox', ...
'Tag','CheckboxAsk', ...
'Value',Settings.donotask);
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color02, ...
'Callback','Settings.locksnap = get(gcbo,''Value'');', ...
'Position',[0.078 15.5*d3 2*0.43 d2], ...
'String','Skip updating of snapshots after power flow analysis', ...
'Style','checkbox', ...
'Tag','CheckboxSnap', ...
'Value',Settings.locksnap);
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color02, ...
'Callback','Settings.vs = get(gcbo,''Value'');', ...
'Position',[0.078 14*d3 2*0.43 d2], ...
'String','Enable Jacobian trajectory tracking (deprecated & undocumented)', ...
'Style','checkbox', ...
'Tag','CheckboxVS', ...
'Value',Settings.vs);
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color02, ...
'HorizontalAlignment','left', ...
'Position',[0.23 12.5*d3-dm 0.63 d2], ...
'String','Number of PF iterations before switching PV to PQ', ...
'Style','text', ...
'Tag','StaticText13');
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color04, ...
'Callback','fm_advanced iternum', ...
'ForegroundColor',Theme.color05, ...
'FontName',Theme.font01, ...
'HorizontalAlignment',aligntxt, ...
'Position',[0.078 12.5*d3 0.14 d2], ...
'String',num2str(Settings.pv2pqniter), ...
'Style','edit', ...
'Tag','EditTextDelta');
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color02, ...
'Callback','Settings.multipvswitch = get(gcbo,''Value'');', ...
'Position',[0.078 11*d3 2*0.43 d2], ...
'String','Allow multiple simultaneous PV to PQ switches', ...
'Style','checkbox', ...
'Tag','CheckboxVS', ...
'Value',Settings.multipvswitch);
if strcmp(Settings.platform,'MAC'), d2 = 1.35*d2; end
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color03, ...
'Callback','close(gcf);', ...
'FontWeight','bold', ...
'ForegroundColor',Theme.color09, ...
'Position',[0.558 2*d1 0.16 d2], ...
'String','OK', ...
'Tag','Pushbutton1');
h1 = uicontrol('Parent',h0, ...
'Units', 'normalized', ...
'BackgroundColor',Theme.color02, ...
'Callback','Settings = get(gcf,''UserData''); close(gcf);', ...
'Position',[0.754 2*d1 0.16 d2], ...
'String','Cancel', ...
'Tag','Pushbutton5');
if nargout > 0, fig = h0; end