Commit a1134b95 authored by Kristian Soltesz's avatar Kristian Soltesz
Browse files

work in progress

parent 24b014f5
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
% See the git repo for further documentation. % See the git repo for further documentation.
%% Setup %% Setup
clear all; close all;clc % start from blank sheet close all;clc;clear all % start from blank sheet
% Process model (continuous time LTI SISO system). % Process model (continuous time LTI SISO system).
s = zpk('s'); s = zpk('s');
...@@ -24,34 +24,63 @@ Mks = 10; % Maximum allowed magnitude of transfer function from process ...@@ -24,34 +24,63 @@ Mks = 10; % Maximum allowed magnitude of transfer function from process
% sensitivity. % sensitivity.
%% IE-minimizing PI design %% IE-minimizing PI design
disp('Computing IE-minimizing PI design...')
opts = defaults(P,'pidIE'); opts = defaults(P,'pidIE');
opts.p = [0;0]; % Design PI controller opts.p = [0;0]; % Design PI controller
[K1,p1,opts1] = pidIE(P,Ms,Mt,Mks,opts); [K1,p1,opts1] = pidIE(P,Ms,Mt,Mks,opts);
%% IAE-minimizing filtered PID design %% IAE-minimizing filtered PID design
disp('Computing IAE-minimizing filtered PID design...')
opts = defaults(P,'pidfIAE'); opts = defaults(P,'pidfIAE');
opts.p = [p1;0;0]; % Hot start with PI controller opts.p = [p1;0;0]; % Hot start with PI controller
[K2,p2] = pidfIAE(P,Ms,Mt,Mks,opts); [K2,p2] = pidfIAE(P,Ms,Mt,Mks,opts);
%% IAE-miniming Q design %% IAE-miniming Q design
disp('Computing IAE-minimizing Q design...')
opts = defaults(P,'optIAE',K2); % Hot start with filtered PID controller opts = defaults(P,'optIAE',K2); % Hot start with filtered PID controller
[K3,Pd,Q] = optIAE(P,Ms,Mt,Mks,opts) [K3,Pd,Q] = optIAE(P,Ms,Mt,Mks,opts);
% opts.optIAE.K0 = K2; % Hot start with filtered PID controller. %% Validate and visualize designs
% %K0 = K2; % Pc = P;
% h = 0.1/bandwidth(feedback(K0*P,1)); % wN =
% if totaldelay(P)/h > 15 % avoid excessive number of states for delay-dominated plants %
% h = totaldelay(P)/15; % for design = 3:-1:1 % Go backwards, to start with Q design
% P = Pc;
% eval(['K=K' num2str(design) ';'])
% switch design
% case 1
% c = 'b';
% case 2
% c = 'r';
% case 3
% c = 'g';
% P = Pd;
% wN = ; % Nyquist frequency
% end
% G = loopsens(P,K);
%
% figure(1)
%
% figure(2)
% bode(G.So,'color',c)
% end % end
% %
% % Determine time horizon for optimization %
% loops = loopsens(P,K0); % GoF % % opts.optIAE.K0 = K2; % Hot start with filtered PID controller.
% [y,t] = step(series(P,loops.So)); % load step response % % %K0 = K2;
% T0 = t(end); % % h = 0.1/bandwidth(feedback(K0*P,1));
% [y,t] = step(series(P,loops.So),2*T0); % longer load step response % % if totaldelay(P)/h > 15 % avoid excessive number of states for delay-dominated plants
% iy = find(abs(y)>0.005*max(abs(y))); % Find 0.5% settling time % % h = totaldelay(P)/15;
% T = t(iy(end)) % % end
% % Optimize % %
% K3 = optIAE(P,Ms,Mt,Mks,h,T,K0); % % % Determine time horizon for optimization
% % loops = loopsens(P,K0); % GoF
%% Validate and visualize designs % % [y,t] = step(series(P,loops.So)); % load step response
\ No newline at end of file % % T0 = t(end);
% % [y,t] = step(series(P,loops.So),2*T0); % longer load step response
% % iy = find(abs(y)>0.005*max(abs(y))); % Find 0.5% settling time
% % T = t(iy(end))
% % % Optimize
% % K3 = optIAE(P,Ms,Mt,Mks,h,T,K0);
%
% %% Validate and visualize designs
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment