Commit e8b05a08 authored by Adwait Datar's avatar Adwait Datar
Browse files

Gitlab Runner Update from orc-aux-files/master:Add slides for 17_1

parent 836ddc5c
function [filters,K,hinf]=Design1(G1,G2)
% Design Wk
Wk=4.6;
% Design Ws
lg1=12;
hg1=2;
wb1=0.02;
order1=1;
Ws=get_shaping_filter(lg1,hg1,wb1,order1);
% Design Vd
lg2=23;
hg2=12;
wb2=1;
order2=2;
Vd=1*get_shaping_filter(lg2,hg2,wb2,order2);
% Design Vr
Vr=0.95;
%% Convert to state space
Ws=ss(Ws);
Wk=ss(Wk);
Vd=ss(Vd);
Vr=ss(Vr);
filters=struct;
filters.Ws=Ws;
filters.Wk=Wk;
filters.Vd=Vd;
filters.Vr=Vr;
%% Plot combined shaping filters
figure()
subplot(221); sigma(inv(Ws*Vr),'r-'); title('inv(Ws*Vr)')
subplot(222); sigma(inv(Ws*Vd),'r-'); title('inv(Ws*Vd)')
subplot(223); sigma(inv(Wk*Vr),'r-'); title('inv(Wk*Vr)')
subplot(224); sigma(inv(Wk*Vd),'r-'); title('inv(Wk*Vd)')
%% Construct generalized plant with Gd and prefilters
%
% r --->| Vr |---------------------+
% |
% d --->|0.5*Vd |--+ |
% | |
% +----------- | ------------ | ------->| Wk |-------> zk
% | | |
% | ____ v ____ v e
% u --+--->| G1 |-->O-->| G2 |---->O-----+-->| Ws |-------> zs
% ---- ---- y - |
% +----------------> e
systemnames = 'G1 G2 Ws Wk Vr Vd';
inputvar = '[r(1); d(1); u(1)]';
input_to_Vr = '[r]';
input_to_Vd = '[d]';
input_to_G1 = '[u]';
input_to_G2 = '[G1 + 0.5*Vd]';
input_to_Wk = '[u]';
input_to_Ws = '[Vr-G2]';
outputvar = '[Wk; Ws; Vr-G2]';
% cleanupsysic = 'yes';
GSYS = sysic;
%% Design the controller
[K, CL, hinf] = hinfsyn(GSYS, 1, 1); % 1 measured output, 1 controller input
end
\ No newline at end of file
function [filters,K,hinf]=Design10(G1,G2)
% Design Wk
Wk=1;
%Design Ws
% lg1=50;
% hg1=1;
% wb1=10;
% order1=1;
% Ws=get_shaping_filter(lg1,hg1,wb1,order1);
Ws=1;
% Design Vd
Vd=get_shaping_filter(1e3,1e-10,1,1);
% Design Vr
Vr=get_shaping_filter(1e3,1e-10,1,1);
%Vr=1;
%% Convert to state space
Ws=ss(Ws);
Wk=ss(Wk);
Vd=ss(Vd);
Vr=ss(Vr);
filters=struct;
filters.Ws=Ws;
filters.Wk=Wk;
filters.Vd=Vd;
filters.Vr=Vr;
%% Plot combined shaping filters
figure()
subplot(221); sigma(inv(Ws*Vr),'r-'); title('inv(Ws*Vr)')
subplot(222); sigma(inv(Ws*Vd),'r-'); title('inv(Ws*Vd)')
subplot(223); sigma(inv(Wk*Vr),'r-'); title('inv(Wk*Vr)')
subplot(224); sigma(inv(Wk*Vd),'r-'); title('inv(Wk*Vd)')
%% Construct generalized plant with Gd and prefilters
%
% r --->| Vr |---------------------+
% |
% d --->|0.5*Vd |--+ |
% | |
% +----------- | ------------ | ------->| Wk |-------> zk
% | | |
% | ____ v ____ v e
% u --+--->| G1 |-->O-->| G2 |---->O-----+-->| Ws |-------> zs
% ---- ---- y - |
% +----------------> e
systemnames = 'G1 G2 Ws Wk Vr Vd';
inputvar = '[r(1); d(1); u(1)]';
input_to_Vr = '[r]';
input_to_Vd = '[d]';
input_to_G1 = '[u]';
input_to_G2 = '[G1 + 0.5*Vd]';
input_to_Wk = '[u]';
input_to_Ws = '[Vr-G2]';
outputvar = '[Wk; Ws; Vr-G2]';
% cleanupsysic = 'yes';
GSYS = sysic;
%% Design the controller
[K, CL, hinf] = hinfsyn(GSYS, 1, 1); % 1 measured output, 1 controller input
end
\ No newline at end of file
function [filters,K,hinf]=Design101(G1,G2)
% Design Wk
Wk=0.13;
% Design Ws
% lg1=12;
% hg1=30;
% wb1=100;
% order1=1;
% Ws=get_shaping_filter(lg1,hg1,wb1,order1);
Ws=1;
% Design Vd
Vd=get_shaping_filter(1,1e-6,0.0006,1);
% Design Vr
Vr=get_shaping_filter(1,1e-6,0.00001,1);
%% Convert to state space
Ws=ss(Ws);
Wk=ss(Wk);
Vd=ss(Vd);
Vr=ss(Vr);
filters=struct;
filters.Ws=Ws;
filters.Wk=Wk;
filters.Vd=Vd;
filters.Vr=Vr;
%% Plot combined shaping filters
figure()
subplot(221); sigma(inv(Ws*Vr),'r-'); title('inv(Ws*Vr)')
subplot(222); sigma(inv(Ws*Vd),'r-'); title('inv(Ws*Vd)')
subplot(223); sigma(inv(Wk*Vr),'r-'); title('inv(Wk*Vr)')
subplot(224); sigma(inv(Wk*Vd),'r-'); title('inv(Wk*Vd)')
%% Construct generalized plant with Gd and prefilters
%
% r --->| Vr |---------------------+
% |
% d --->|0.5*Vd |--+ |
% | |
% +----------- | ------------ | ------->| Wk |-------> zk
% | | |
% | ____ v ____ v e
% u --+--->| G1 |-->O-->| G2 |---->O-----+-->| Ws |-------> zs
% ---- ---- y - |
% +----------------> e
systemnames = 'G1 G2 Ws Wk Vr Vd';
inputvar = '[r(1); d(1); u(1)]';
input_to_Vr = '[r]';
input_to_Vd = '[d]';
input_to_G1 = '[u]';
input_to_G2 = '[G1 + 0.5*Vd]';
input_to_Wk = '[u]';
input_to_Ws = '[Vr-G2]';
outputvar = '[Wk; Ws; Vr-G2]';
% cleanupsysic = 'yes';
GSYS = sysic;
%% Design the controller
[K, CL, hinf] = hinfsyn(GSYS, 1, 1); % 1 measured output, 1 controller input
end
\ No newline at end of file
function [filters,K,hinf]=Design102(G1,G2)
% Design Wk
Wk=0.23;
% Design Ws
% lg1=12;
% hg1=30;
% wb1=100;
% order1=1;
% Ws=get_shaping_filter(lg1,hg1,wb1,order1);
Ws=1;
% Design Vd
Vd=get_shaping_filter(1,1e-6,0.006,1);
% Design Vr
Vr=get_shaping_filter(1,1e-6,0.00001,1);
%% Convert to state space
Ws=ss(Ws);
Wk=ss(Wk);
Vd=ss(Vd);
Vr=ss(Vr);
filters=struct;
filters.Ws=Ws;
filters.Wk=Wk;
filters.Vd=Vd;
filters.Vr=Vr;
%% Plot combined shaping filters
figure()
subplot(221); sigma(inv(Ws*Vr),'r-'); title('inv(Ws*Vr)')
subplot(222); sigma(inv(Ws*Vd),'r-'); title('inv(Ws*Vd)')
subplot(223); sigma(inv(Wk*Vr),'r-'); title('inv(Wk*Vr)')
subplot(224); sigma(inv(Wk*Vd),'r-'); title('inv(Wk*Vd)')
%% Construct generalized plant with Gd and prefilters
%
% r --->| Vr |---------------------+
% |
% d --->|0.5*Vd |--+ |
% | |
% +----------- | ------------ | ------->| Wk |-------> zk
% | | |
% | ____ v ____ v e
% u --+--->| G1 |-->O-->| G2 |---->O-----+-->| Ws |-------> zs
% ---- ---- y - |
% +----------------> e
systemnames = 'G1 G2 Ws Wk Vr Vd';
inputvar = '[r(1); d(1); u(1)]';
input_to_Vr = '[r]';
input_to_Vd = '[d]';
input_to_G1 = '[u]';
input_to_G2 = '[G1 + 0.5*Vd]';
input_to_Wk = '[u]';
input_to_Ws = '[Vr-G2]';
outputvar = '[Wk; Ws; Vr-G2]';
% cleanupsysic = 'yes';
GSYS = sysic;
%% Design the controller
[K, CL, hinf] = hinfsyn(GSYS, 1, 1); % 1 measured output, 1 controller input
end
\ No newline at end of file
function [filters,K,hinf]=Design2(G1,G2)
% Design Wk
Wk=3.6;
% Design Ws
lg1=12;
hg1=2;
wb1=0.02;
order1=1;
Ws=get_shaping_filter(lg1,hg1,wb1,order1);
% Design Vd
lg2=40;
hg2=12;
wb2=3;
order2=2;
Vd=1*get_shaping_filter(lg2,hg2,wb2,order2);
% Design Vr
Vr=0.95;
%% Convert to state space
Ws=ss(Ws);
Wk=ss(Wk);
Vd=ss(Vd);
Vr=ss(Vr);
filters=struct;
filters.Ws=Ws;
filters.Wk=Wk;
filters.Vd=Vd;
filters.Vr=Vr;
%% Plot combined shaping filters
figure()
subplot(221); sigma(inv(Ws*Vr),'r-'); title('inv(Ws*Vr)')
subplot(222); sigma(inv(Ws*Vd),'r-'); title('inv(Ws*Vd)')
subplot(223); sigma(inv(Wk*Vr),'r-'); title('inv(Wk*Vr)')
subplot(224); sigma(inv(Wk*Vd),'r-'); title('inv(Wk*Vd)')
%% Construct generalized plant with Gd and prefilters
%
% r --->| Vr |---------------------+
% |
% d --->|0.5*Vd |--+ |
% | |
% +----------- | ------------ | ------->| Wk |-------> zk
% | | |
% | ____ v ____ v e
% u --+--->| G1 |-->O-->| G2 |---->O-----+-->| Ws |-------> zs
% ---- ---- y - |
% +----------------> e
systemnames = 'G1 G2 Ws Wk Vr Vd';
inputvar = '[r(1); d(1); u(1)]';
input_to_Vr = '[r]';
input_to_Vd = '[d]';
input_to_G1 = '[u]';
input_to_G2 = '[G1 + 0.5*Vd]';
input_to_Wk = '[u]';
input_to_Ws = '[Vr-G2]';
outputvar = '[Wk; Ws; Vr-G2]';
% cleanupsysic = 'yes';
GSYS = sysic;
%% Design the controller
[K, CL, hinf] = hinfsyn(GSYS, 1, 1); % 1 measured output, 1 controller input
end
\ No newline at end of file
function [filters,K,hinf]=Design201(G1,G2)
% Design Wk
Wk=100*get_shaping_filter(1e6,1e-6,1e5,1);
% Design Ws
% lg1=12;
% hg1=30;
% wb1=100;
% order1=1;
% Ws=get_shaping_filter(lg1,hg1,wb1,order1);
Ws=1;
% Design Vd
Vd=get_shaping_filter(1,1e-6,0.0006,1);
% Design Vr
Vr=get_shaping_filter(1,1e-6,0.00001,1);
%% Convert to state space
Ws=ss(Ws);
Wk=ss(Wk);
Vd=ss(Vd);
Vr=ss(Vr);
filters=struct;
filters.Ws=Ws;
filters.Wk=Wk;
filters.Vd=Vd;
filters.Vr=Vr;
%% Plot combined shaping filters
figure()
subplot(221); sigma(inv(Ws*Vr),'r-'); title('inv(Ws*Vr)')
subplot(222); sigma(inv(Ws*Vd),'r-'); title('inv(Ws*Vd)')
subplot(223); sigma(inv(Wk*Vr),'r-'); title('inv(Wk*Vr)')
subplot(224); sigma(inv(Wk*Vd),'r-'); title('inv(Wk*Vd)')
%% Construct generalized plant with Gd and prefilters
%
% r --->| Vr |---------------------+
% |
% d --->|0.5*Vd |--+ |
% | |
% +----------- | ------------ | ------->| Wk |-------> zk
% | | |
% | ____ v ____ v e
% u --+--->| G1 |-->O-->| G2 |---->O-----+-->| Ws |-------> zs
% ---- ---- y - |
% +----------------> e
systemnames = 'G1 G2 Ws Wk Vr Vd';
inputvar = '[r(1); d(1); u(1)]';
input_to_Vr = '[r]';
input_to_Vd = '[d]';
input_to_G1 = '[u]';
input_to_G2 = '[G1 + 0.5*Vd]';
input_to_Wk = '[u]';
input_to_Ws = '[Vr-G2]';
outputvar = '[Wk; Ws; Vr-G2]';
% cleanupsysic = 'yes';
GSYS = sysic;
%% Design the controller
[K, CL, hinf] = hinfsyn(GSYS, 1, 1); % 1 measured output, 1 controller input
end
\ No newline at end of file
function [filters,K,hinf]=Design3(G1,G2)
% Design Wk
Wk=1.1;
% Design Ws
lg1=12;
hg1=20;
wb1=0.00000001;
order1=1;
Ws=get_shaping_filter(lg1,hg1,wb1,order1);
% Design Vd
Vd=get_shaping_filter(1,1e-6,0.001,1);
% Design Vr
Vr=get_shaping_filter(1,1e-6,0.00001,1);
%% Convert to state space
Ws=ss(Ws);
Wk=ss(Wk);
Vd=ss(Vd);
Vr=ss(Vr);
filters=struct;
filters.Ws=Ws;
filters.Wk=Wk;
filters.Vd=Vd;
filters.Vr=Vr;
%% Plot combined shaping filters
figure()
subplot(221); sigma(inv(Ws*Vr),'r-'); title('inv(Ws*Vr)')
subplot(222); sigma(inv(Ws*Vd),'r-'); title('inv(Ws*Vd)')
subplot(223); sigma(inv(Wk*Vr),'r-'); title('inv(Wk*Vr)')
subplot(224); sigma(inv(Wk*Vd),'r-'); title('inv(Wk*Vd)')
%% Construct generalized plant with Gd and prefilters
%
% r --->| Vr |---------------------+
% |
% d --->|0.5*Vd |--+ |
% | |
% +----------- | ------------ | ------->| Wk |-------> zk
% | | |
% | ____ v ____ v e
% u --+--->| G1 |-->O-->| G2 |---->O-----+-->| Ws |-------> zs
% ---- ---- y - |
% +----------------> e
systemnames = 'G1 G2 Ws Wk Vr Vd';
inputvar = '[r(1); d(1); u(1)]';
input_to_Vr = '[r]';
input_to_Vd = '[d]';
input_to_G1 = '[u]';
input_to_G2 = '[G1 + 0.5*Vd]';
input_to_Wk = '[u]';
input_to_Ws = '[Vr-G2]';
outputvar = '[Wk; Ws; Vr-G2]';
% cleanupsysic = 'yes';
GSYS = sysic;
%% Design the controller
[K, CL, hinf] = hinfsyn(GSYS, 1, 1); % 1 measured output, 1 controller input
end
\ No newline at end of file
function [filters,K,hinf]=Design301(G1,G2)
% Design Wk
Wk=0.08;
% Design Ws
% lg1=12;
% hg1=30;
% wb1=100;
% order1=1;
% Ws=get_shaping_filter(lg1,hg1,wb1,order1);
Ws=1;
% Design Vd
Vd=get_shaping_filter(1,1e-6,0.0008,1);
% Design Vr
Vr=get_shaping_filter(1,1e-6,0.0000001,1);
%% Convert to state space
Ws=ss(Ws);
Wk=ss(Wk);
Vd=ss(Vd);
Vr=ss(Vr);
filters=struct;
filters.Ws=Ws;
filters.Wk=Wk;
filters.Vd=Vd;
filters.Vr=Vr;
%% Plot combined shaping filters
figure()
subplot(221); sigma(inv(Ws*Vr),'r-'); title('inv(Ws*Vr)')
subplot(222); sigma(inv(Ws*Vd),'r-'); title('inv(Ws*Vd)')
subplot(223); sigma(inv(Wk*Vr),'r-'); title('inv(Wk*Vr)')
subplot(224); sigma(inv(Wk*Vd),'r-'); title('inv(Wk*Vd)')
%% Construct generalized plant with Gd and prefilters
%
% r --->| Vr |---------------------+
% |
% d --->|0.5*Vd |--+ |
% | |
% +----------- | ------------ | ------->| Wk |-------> zk
% | | |
% | ____ v ____ v e
% u --+--->| G1 |-->O-->| G2 |---->O-----+-->| Ws |-------> zs
% ---- ---- y - |
% +----------------> e
systemnames = 'G1 G2 Ws Wk Vr Vd';
inputvar = '[r(1); d(1); u(1)]';
input_to_Vr = '[r]';
input_to_Vd = '[d]';
input_to_G1 = '[u]';
input_to_G2 = '[G1 + 0.5*Vd]';
input_to_Wk = '[u]';
input_to_Ws = '[Vr-G2]';
outputvar = '[Wk; Ws; Vr-G2]';
% cleanupsysic = 'yes';
GSYS = sysic;
%% Design the controller
[K, CL, hinf] = hinfsyn(GSYS, 1, 1); % 1 measured output, 1 controller input
end
\ No newline at end of file
function [filters,K,hinf]=Design4(G1,G2)
% Design Wk
Wk=0.1;
% Design Ws
% lg1=12;
% hg1=30;
% wb1=100;
% order1=1;
% Ws=get_shaping_filter(lg1,hg1,wb1,order1);
Ws=1;
% Design Vd
Vd=get_shaping_filter(1,1e-6,0.0006,1);
% Design Vr
Vr=get_shaping_filter(1,1e-6,0.00001,1);