-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpid_v_param.m
279 lines (242 loc) · 8.45 KB
/
pid_v_param.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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
% PID_PARAM
%
% Sluzi na vypocet parametrov PID regulatora pomocou vybranej analytickej
% metody
% Pomocna premenna, aby analytick?metoda vedela, aky typ regulatora
% sa ma vygenerovat:
% J3 = 1 pre P reg
% J3 = 2 pre PI reg
% J3 = 3 pre PID reg
J3=3;
% METODY
%
%------------ Metoda umiestnenia polov ------
if typy_ns == 1
if(n<2||n>3)
pth_fig = ptg_error('reg_v',ptg_string(11,29,ptv_str_lang),ptv_str_lang);
else
typy_n=1;
param_mup
end
% ---------- Naslinova met�da -----------------
elseif typy_ns == 2
close
if(n<3)
pth_fig = ptg_error('reg_v',ptg_string(11,10,ptv_str_lang),ptv_str_lang);
else
nm
end
%--------------------------------------------------------------------------
% METODA ZAL. NA BEZPECNOSTI VO FAZE A V ZOSILNENI
elseif typy_ns==3
% Cast kontrolovania vhodneho rad n a nenuloveho dopravneho oneskorenia D
if(n~=2||typ_i==2)
pth_fig = ptg_error('reg_v',ptg_string(11,30,ptv_str_lang),ptv_str_lang);
elseif(D==0)
pth_fig = ptg_error('reg_v',ptg_string(11,31,ptv_str_lang),ptv_str_lang);
else
% Pomocna premenna ic3 pre kontrolu zadania Am a Pm
ic3=zeros(1,2);
QGm = Gm;
QPm = Pm;
fig = figure('Color','blue',...
'Resize','off',...
'Numbertitle','off',...
'Menubar',ptv_fig_menubar,...
'Name',ptg_string(1,2,ptv_str_lang), ...
'position',[100 200 215 255]);
navrh_text= uicontrol(gcf,...
'Style','text',...
'position',[15 85 185 155],...
'Fontsize',[12],...
'ForegroundColor','black',...
'BackgroundColor',[fgcolor],...
'Fontweight','bold',...
'HorizontalAlignment','center',...
'String',ptg_string(11,33,ptv_str_lang));
%------------------------------- Gm ---------------------------------------
Gm_text = uicontrol(gcf,...
'Style','text',...
'ForegroundColor','black',...
'Fontweight','bold',...
'Fontsize',[12],...
'BackgroundColor','white',...
'Position',[20 130 85 25],...
'String',ptg_string(11,34,ptv_str_lang));
QGm = uicontrol(gcf,...
'Style','edit',...
'ForegroundColor','black',...
'Fontweight','bold',...
'Fontsize',[12],...
'BackgroundColor','white',...
'Position',[108 130 85 25],...
'String',num2str(QGm),...
'CallBack','ic3(1)=1;QGm=str2num(get(gco,''String''));ic3(1,1)=1;');
%------------------------------- Pm ---------------------------------------
Pm_text = uicontrol(gcf,...
'Style','text',...
'ForegroundColor','black',...
'Fontweight','bold',...
'Fontsize',[12],...
'BackgroundColor','white',...
'Position',[20 100 85 25],...
'String',ptg_string(11,35,ptv_str_lang));
QPm = uicontrol(gcf,...
'Style','edit',...
'ForegroundColor','black',...
'Fontweight','bold',...
'Fontsize',[12],...
'BackgroundColor','white',...
'Position',[108 100 85 25],...
'String',num2str(QPm),...
'CallBack','ic3(2)=1;QPm=str2num(get(gco,''String''));ic3(1,2)=1;');
%----SPAT-----%
navrat = uicontrol(gcf,...
'Style','push',...
'Position',[15 15 60 25],...
'Fontweight','bold',...
'Fontsize',[12],...
'String',ptg_string(3,2,ptv_str_lang),...
'ForegroundColor','black',...
'Callback','close,pid_v');
potvrdenie = uicontrol(gcf,...
'Style','push',...
'Position',[100 15 100 25],...
'Fontweight','bold',...
'String',ptg_string(3,1,ptv_str_lang),...
'Fontsize',[11],...
'ForegroundColor','red',...
'CallBack','close,test_GmPm');
end
% ------------------------------------------------------------- %
% M. POZADOVANEHO MODELU
%
elseif typy_ns == 4
% Testovanie kmitavosti modelu
%
if(typ_i == 1)&&(n == 2)
%
% Aperiodicky model
%
close
typy_ns2=1;
fig2 = figure('Color','blue',...
'Resize','off',...
'Numbertitle','off',...
'Menubar',ptv_fig_menubar,...
'Name',ptg_string(1,2,ptv_str_lang), ...
'Position',[120 300 250 80]);
navrh_text= uicontrol(gcf,...
'Style','text',...
'position',[10 10 120 60],...
'Fontsize',[12],...
'ForegroundColor','black',...
'BackgroundColor',[fgcolor],...
'Fontweight','bold',...
'HorizontalAlignment','left',...
'String',ptg_string(11,16,ptv_str_lang));
typyns2 = uicontrol(gcf,...
'Style','popup',...
'Position',[20 -25 100 60],...
'String',ptg_string(11,17,ptv_str_lang),...
'Value',typy_ns2,...
'ForegroundColor','black',...
'BackGroundColor','white',...
'CallBack','typy_ns2 = get(gco,''Value'');');
prenos_s = uicontrol(gcf,...
'Style','push',...
'Position',[150 45 80 25],...
'String',ptg_string(3,1,ptv_str_lang),...
'Fontweight','bold',...
'ForegroundColor','black',...
'CallBack','close,[z_r,t_i,t_d]=pta_rmm(3,K,T,D,(typy_ns2-1)*5);simul_param');
navrat = uicontrol(gcf,...
'Style','push',...
'Position',[150 10 80 25],...
'String',ptg_string(3,2,ptv_str_lang),...
'Fontweight','bold',...
'ForegroundColor','black',...
'CallBack','close,reg_v');
elseif(typ_i == 2)&&(ksi_km > 0.5)
%
% Tlmene kmitavy model
%
close
typy_ns2=1;
fig2 = figure('Color','blue',...
'Resize','off',...
'Numbertitle','off',...
'Menubar',ptv_fig_menubar,...
'Name',ptg_string(1,2,ptv_str_lang), ...
'Position',[120 300 250 80]);
navrh_text= uicontrol(gcf,...
'Style','text',...
'position',[10 10 120 60],...
'Fontsize',[12],...
'ForegroundColor','black',...
'BackgroundColor',[fgcolor],...
'Fontweight','bold',...
'HorizontalAlignment','left',...
'String',ptg_string(11,16,ptv_str_lang));
typyns2 = uicontrol(gcf,...
'Style','popup',...
'Position',[20 -25 100 60],...
'String',ptg_string(11,17,ptv_str_lang),...
'Value',typy_ns2,...
'ForegroundColor','black',...
'BackGroundColor','white',...
'CallBack','typy_ns2 = get(gco,''Value'');');
prenos_s = uicontrol(gcf,...
'Style','push',...
'Position',[150 45 80 25],...
'String',ptg_string(3,1,ptv_str_lang),...
'Fontweight','bold',...
'ForegroundColor','black',...
'CallBack','close,[z_r,t_i,t_d]=pta_rmm(3,K,Tn,Tu,(typy_ns2-1)*5,ksi_km);simul_param');
navrat = uicontrol(gcf,...
'Style','push',...
'Position',[150 10 80 25],...
'String',ptg_string(3,2,ptv_str_lang),...
'Fontweight','bold',...
'ForegroundColor','black',...
'CallBack','close,reg_v');
elseif((typ_i == 2) && (ksi_km <= 0.5))
pth_fig = ptg_error('reg_v',ptg_string(11,42,ptv_str_lang),ptv_str_lang);
else
pth_fig = ptg_error('reg_v',ptg_string(11,40,ptv_str_lang),ptv_str_lang);
end
% ---------------------------------------------
%
% Metoda nasobneho dominantneho polu
%
elseif typy_ns == 5
% Testovanie aperiodickosti modelu
%
if(typ_i==2)
pth_fig = ptg_error('reg_v',ptg_string(11,39,ptv_str_lang),ptv_str_lang);
% Testovanie vhodnosti radu, aby sa predislo deleniu nulou
%
elseif (n<3)
pth_fig = ptg_error('',ptg_string(11,10,ptv_str_lang),ptv_str_lang);
else
[z_r,t_i,t_d] = pta_mdp(2,3,n,K,T);
close
simul_param
end
%------------ OPTIMAL MODULE CRITERIUM METHOD ------
%
elseif typy_ns == 6
if(n ~= 3)
pth_fig = ptg_error('reg_v',ptg_string(11,38,ptv_str_lang),ptv_str_lang);
elseif( (typ_i == 2 )&&(ksi_km <= 0.71) )
pth_fig = ptg_error('reg_v',ptg_string(11,41,ptv_str_lang),ptv_str_lang);
else
[z_r,t_i,t_d] = pta_omm(3,cit,men);
if(t_i == -Inf)
pth_fig = ptg_error('reg_v',ptg_string(11,37,ptv_str_lang),ptv_str_lang);
else
simul_param;
end
end
%---------------------------------------------------- %
end