Clean simscape models

This commit is contained in:
2020-11-25 09:40:17 +01:00
parent 9b29c73fff
commit a1581cb873
17 changed files with 11319 additions and 10289 deletions

View File

@@ -1,196 +0,0 @@
%% Clear Workspace and Close figures
clear; close all; clc;
%% Intialize Laplace variable
s = zpk('s');
%% Bode plot options
opts = bodeoptions('cstprefs');
opts.FreqUnits = 'Hz';
opts.MagUnits = 'abs';
opts.MagScale = 'log';
opts.PhaseWrapping = 'on';
opts.xlim = [1 1000];
% Characteristics
L = 0.055; % Leg length [m]
Zc = 0; % ?
m = 0.2; % Top platform mass [m]
k = 1e3; % Total vertical stiffness [N/m]
c = 2*0.1*sqrt(k*m); % Damping ? [N/(m/s)]
Rx = 0.04; % ?
Rz = 0.04; % ?
Ix = m*Rx^2; % ?
Iy = m*Rx^2; % ?
Iz = m*Rz^2; % ?
% Mass Matrix
M = m*[1 0 0 0 Zc 0;
0 1 0 -Zc 0 0;
0 0 1 0 0 0;
0 -Zc 0 Rx^2+Zc^2 0 0;
Zc 0 0 0 Rx^2+Zc^2 0;
0 0 0 0 0 Rz^2];
% Jacobian Matrix
Bj=1/sqrt(6)*[ 1 1 -2 1 1 -2;
sqrt(3) -sqrt(3) 0 sqrt(3) -sqrt(3) 0;
sqrt(2) sqrt(2) sqrt(2) sqrt(2) sqrt(2) sqrt(2);
0 0 L L -L -L;
-L*2/sqrt(3) -L*2/sqrt(3) L/sqrt(3) L/sqrt(3) L/sqrt(3) L/sqrt(3);
L*sqrt(2) -L*sqrt(2) L*sqrt(2) -L*sqrt(2) L*sqrt(2) -L*sqrt(2)];
% Stifnness and Damping matrices
kv = k/3; % Vertical Stiffness of the springs [N/m]
kh = 0.5*k/3; % Horizontal Stiffness of the springs [N/m]
K = diag([3*kh, 3*kh, 3*kv, 3*kv*Rx^2/2, 3*kv*Rx^2/2, 3*kh*Rx^2]); % Stiffness Matrix
C = c*K/100000; % Damping Matrix
% State Space System
A = [ zeros(6) eye(6); ...
-M\K -M\C];
Bw = [zeros(6); -eye(6)];
Bu = [zeros(6); M\Bj];
Co = [-M\K -M\C];
D = [zeros(6) M\Bj];
ST = ss(A,[Bw Bu],Co,D);
% - OUT 1-6: 6 dof
% - IN 1-6 : ground displacement in the directions of the legs
% - IN 7-12: forces in the actuators.
ST.StateName = {'x';'y';'z';'theta_x';'theta_y';'theta_z';...
'dx';'dy';'dz';'dtheta_x';'dtheta_y';'dtheta_z'};
ST.InputName = {'w1';'w2';'w3';'w4';'w5';'w6';...
'u1';'u2';'u3';'u4';'u5';'u6'};
ST.OutputName = {'ax';'ay';'az';'atheta_x';'atheta_y';'atheta_z'};
% Transmissibility
TR=ST*[eye(6); zeros(6)];
figure
subplot(231)
bodemag(TR(1,1));
subplot(232)
bodemag(TR(2,2));
subplot(233)
bodemag(TR(3,3));
subplot(234)
bodemag(TR(4,4));
subplot(235)
bodemag(TR(5,5));
subplot(236)
bodemag(TR(6,6));
% Real approximation of $G(j\omega)$ at decoupling frequency
sys1 = ST*[zeros(6); eye(6)]; % take only the forces inputs
dec_fr = 20;
H1 = evalfr(sys1,j*2*pi*dec_fr);
H2 = H1;
D = pinv(real(H2'*H2));
H1 = inv(D*real(H2'*diag(exp(j*angle(diag(H2*D*H2.'))/2)))) ;
[U,S,V] = svd(H1);
wf = logspace(-1,2,1000);
for i = 1:length(wf)
H = abs(evalfr(sys1,j*2*pi*wf(i)));
H_dec = abs(evalfr(U'*sys1*V,j*2*pi*wf(i)));
for j = 1:size(H,2)
g_r1(i,j) = (sum(H(j,:))-H(j,j))/H(j,j);
g_r2(i,j) = (sum(H_dec(j,:))-H_dec(j,j))/H_dec(j,j);
% keyboard
end
g_lim(i) = 0.5;
end
% Coupled and Decoupled Plant "Gershgorin Radii"
figure;
title('Coupled plant')
loglog(wf,g_r1(:,1),wf,g_r1(:,2),wf,g_r1(:,3),wf,g_r1(:,4),wf,g_r1(:,5),wf,g_r1(:,6),wf,g_lim,'--');
legend('$a_x$','$a_y$','$a_z$','$\theta_x$','$\theta_y$','$\theta_z$','Limit');
xlabel('Frequency (Hz)'); ylabel('Gershgorin Radii')
% #+name: fig:gershorin_raddii_coupled_analytical
% #+caption: Gershorin Raddi for the coupled plant
% #+RESULTS:
% [[file:figs/gershorin_raddii_coupled_analytical.png]]
figure;
title('Decoupled plant (10 Hz)')
loglog(wf,g_r2(:,1),wf,g_r2(:,2),wf,g_r2(:,3),wf,g_r2(:,4),wf,g_r2(:,5),wf,g_r2(:,6),wf,g_lim,'--');
legend('$S_1$','$S_2$','$S_3$','$S_4$','$S_5$','$S_6$','Limit');
xlabel('Frequency (Hz)'); ylabel('Gershgorin Radii')
% Decoupled Plant
figure;
bodemag(U'*sys1*V,opts)
% Controller
fc = 2*pi*0.1; % Crossover Frequency [rad/s]
c_gain = 50; %
cont = eye(6)*c_gain/(s+fc);
% Closed Loop System
FEEDIN = [7:12]; % Input of controller
FEEDOUT = [1:6]; % Output of controller
% Centralized Control
STcen = feedback(ST, inv(Bj)*cont, FEEDIN, FEEDOUT);
TRcen = STcen*[eye(6); zeros(6)];
% SVD Control
STsvd = feedback(ST, pinv(V')*cont*pinv(U), FEEDIN, FEEDOUT);
TRsvd = STsvd*[eye(6); zeros(6)];
% Results
figure
subplot(231)
bodemag(TR(1,1),TRcen(1,1),TRsvd(1,1),opts)
legend('OL','Centralized','SVD')
subplot(232)
bodemag(TR(2,2),TRcen(2,2),TRsvd(2,2),opts)
legend('OL','Centralized','SVD')
subplot(233)
bodemag(TR(3,3),TRcen(3,3),TRsvd(3,3),opts)
legend('OL','Centralized','SVD')
subplot(234)
bodemag(TR(4,4),TRcen(4,4),TRsvd(4,4),opts)
legend('OL','Centralized','SVD')
subplot(235)
bodemag(TR(5,5),TRcen(5,5),TRsvd(5,5),opts)
legend('OL','Centralized','SVD')
subplot(236)
bodemag(TR(6,6),TRcen(6,6),TRsvd(6,6),opts)
legend('OL','Centralized','SVD')

Binary file not shown.

View File

@@ -1,156 +0,0 @@
% Simscape(TM) Multibody(TM) version: 5.1
% This is a model data file derived from a Simscape Multibody Import XML file using the smimport function.
% The data in this file sets the block parameter values in an imported Simscape Multibody model.
% For more information on this file, see the smimport function help page in the Simscape Multibody documentation.
% You can modify numerical values, but avoid any other changes to this file.
% Do not add code to this file. Do not edit the physical units shown in comments.
%%%VariableName:smiData
%============= RigidTransform =============%
%Initialize the RigidTransform structure array by filling in null values.
smiData.RigidTransform(12).translation = [0.0 0.0 0.0];
smiData.RigidTransform(12).angle = 0.0;
smiData.RigidTransform(12).axis = [0.0 0.0 0.0];
smiData.RigidTransform(12).ID = '';
%Translation Method - Cartesian
%Rotation Method - Arbitrary Axis
smiData.RigidTransform(1).translation = [17.500000000021 30.310889132419 5.1574606296500001]; % mm
smiData.RigidTransform(1).angle = 0.093902078374528131; % rad
smiData.RigidTransform(1).axis = [0 0 1];
smiData.RigidTransform(1).ID = 'AssemblyGround[Drone_Stewart_Platform_V8 voice-coil.CATProduct-1:Spring cylinder.CATPart-1]';
%Translation Method - Cartesian
%Rotation Method - Arbitrary Axis
smiData.RigidTransform(2).translation = [0 0 0]; % mm
smiData.RigidTransform(2).angle = 0; % rad
smiData.RigidTransform(2).axis = [0 0 0];
smiData.RigidTransform(2).ID = 'AssemblyGround[Drone_Stewart_Platform_V8 voice-coil.CATProduct-1:Upper_Stewart_Platform_V8.CATPart-1]';
%Translation Method - Cartesian
%Rotation Method - Arbitrary Axis
smiData.RigidTransform(3).translation = [17.500000000021 -30.310889132492001 5.1574606296500001]; % mm
smiData.RigidTransform(3).angle = 0.093902078374528131; % rad
smiData.RigidTransform(3).axis = [0 0 1];
smiData.RigidTransform(3).ID = 'AssemblyGround[Drone_Stewart_Platform_V8 voice-coil.CATProduct-1:Spring cylinder.CATPart-3]';
%Translation Method - Cartesian
%Rotation Method - Arbitrary Axis
smiData.RigidTransform(4).translation = [9.6240451994409995 -30.811470883506999 19.383957937758002]; % mm
smiData.RigidTransform(4).angle = 3.1415926535897931; % rad
smiData.RigidTransform(4).axis = [0.88807383397699313 6.3170900042374556e-16 -0.45970084338121897];
smiData.RigidTransform(4).ID = 'AssemblyGround[Drone_Stewart_Platform_V8 voice-coil.CATProduct-1:Voice-coil.CATPart-1]';
%Translation Method - Cartesian
%Rotation Method - Arbitrary Axis
smiData.RigidTransform(5).translation = [21.871493913361999 -23.740403071639001 19.383957937758002]; % mm
smiData.RigidTransform(5).angle = 2.6777446800421498; % rad
smiData.RigidTransform(5).axis = [-0.79025275363749503 -0.45625264004045041 -0.40906492617245471];
smiData.RigidTransform(5).ID = 'AssemblyGround[Drone_Stewart_Platform_V8 voice-coil.CATProduct-1:Voice-coil.CATPart-2]';
%Translation Method - Cartesian
%Rotation Method - Arbitrary Axis
smiData.RigidTransform(6).translation = [21.871493913361 23.740403071566 19.383957937758002]; % mm
smiData.RigidTransform(6).angle = 2.3226757410894345; % rad
smiData.RigidTransform(6).axis = [0.4840501729431676 0.83839949295006799 -0.25056280708588496];
smiData.RigidTransform(6).ID = 'AssemblyGround[Drone_Stewart_Platform_V8 voice-coil.CATProduct-1:Voice-coil.CATPart-3]';
%Translation Method - Cartesian
%Rotation Method - Arbitrary Axis
smiData.RigidTransform(7).translation = [9.6240451994409995 30.811470883434001 19.383957937758002]; % mm
smiData.RigidTransform(7).angle = 2.1862760354647519; % rad
smiData.RigidTransform(7).axis = [5.6189562004407762e-16 -1 -1.3924588923326856e-16];
smiData.RigidTransform(7).ID = 'AssemblyGround[Drone_Stewart_Platform_V8 voice-coil.CATProduct-1:Voice-coil.CATPart-4]';
%Translation Method - Cartesian
%Rotation Method - Arbitrary Axis
smiData.RigidTransform(8).translation = [-31.495539112739003 7.0710678118320001 19.383957937758002]; % mm
smiData.RigidTransform(8).angle = 2.3226757410894345; % rad
smiData.RigidTransform(8).axis = [-0.48405017294316754 0.83839949295006766 0.25056280708588635];
smiData.RigidTransform(8).ID = 'AssemblyGround[Drone_Stewart_Platform_V8 voice-coil.CATProduct-1:Voice-coil.CATPart-5]';
%Translation Method - Cartesian
%Rotation Method - Arbitrary Axis
smiData.RigidTransform(9).translation = [-31.495539112739003 -7.0710678119050003 19.383957937758002]; % mm
smiData.RigidTransform(9).angle = 2.6777446800421507; % rad
smiData.RigidTransform(9).axis = [0.79025275363749525 -0.45625264004045002 0.40906492617245482];
smiData.RigidTransform(9).ID = 'AssemblyGround[Drone_Stewart_Platform_V8 voice-coil.CATProduct-1:Voice-coil.CATPart-6]';
%Translation Method - Cartesian
%Rotation Method - Arbitrary Axis
smiData.RigidTransform(10).translation = [0 0 0]; % mm
smiData.RigidTransform(10).angle = 0; % rad
smiData.RigidTransform(10).axis = [0 0 0];
smiData.RigidTransform(10).ID = 'AssemblyGround[Drone_Stewart_Platform_V8 voice-coil.CATProduct-1:Bottom_Stewart_Platform_V8.CATPart-1]';
%Translation Method - Cartesian
%Rotation Method - Arbitrary Axis
smiData.RigidTransform(11).translation = [-34.999999999978996 -3.7000000000000001e-11 5.1574606296500001]; % mm
smiData.RigidTransform(11).angle = 0.093902078374528131; % rad
smiData.RigidTransform(11).axis = [0 0 1];
smiData.RigidTransform(11).ID = 'AssemblyGround[Drone_Stewart_Platform_V8 voice-coil.CATProduct-1:Spring cylinder.CATPart-2]';
%Translation Method - Cartesian
%Rotation Method - Arbitrary Axis
smiData.RigidTransform(12).translation = [0 0 0]; % mm
smiData.RigidTransform(12).angle = 0; % rad
smiData.RigidTransform(12).axis = [0 0 0];
smiData.RigidTransform(12).ID = 'RootGround[Drone_Stewart_Platform_V8 voice-coil.CATProduct-1]';
%============= Solid =============%
%Center of Mass (CoM) %Moments of Inertia (MoI) %Product of Inertia (PoI)
%Initialize the Solid structure array by filling in null values.
smiData.Solid(4).mass = 0.0;
smiData.Solid(4).CoM = [0.0 0.0 0.0];
smiData.Solid(4).MoI = [0.0 0.0 0.0];
smiData.Solid(4).PoI = [0.0 0.0 0.0];
smiData.Solid(4).color = [0.0 0.0 0.0];
smiData.Solid(4).opacity = 0.0;
smiData.Solid(4).ID = '';
%Inertia Type - Custom
%Visual Properties - Simple
smiData.Solid(1).mass = 0.002953024625510399; % kg
smiData.Solid(1).CoM = [0.00019528918640542437 -0.0030390869707000701 3.4103846069334764]; % mm
smiData.Solid(1).MoI = [0.094245235034989605 0.095111221695610218 0.060564976663331278]; % kg*mm^2
smiData.Solid(1).PoI = [9.2822238167834426e-07 0.0015998098386190715 -2.9934446424201115e-05]; % kg*mm^2
smiData.Solid(1).color = [0.82352941176470584 0.82352941176470584 1];
smiData.Solid(1).opacity = 1;
smiData.Solid(1).ID = 'Spring cylinder.CATPart*:*Default';
%Inertia Type - Custom
%Visual Properties - Simple
smiData.Solid(2).mass = 0.200; % kg
smiData.Solid(2).CoM = [0 0 22.029956321592298]; % mm
smiData.Solid(2).MoI = [10.958807269683136 10.958651478878741 21.418645161274547]; % kg*mm^2
smiData.Solid(2).PoI = [-2.7272640778847972e-06 2.0116845742236026e-06 2.0925824216820959e-06]; % kg*mm^2
smiData.Solid(2).color = [0 1 1];
smiData.Solid(2).opacity = 1;
smiData.Solid(2).ID = 'Upper_Stewart_Platform_V8.CATPart*:*Default';
%Inertia Type - Custom
%Visual Properties - Simple
smiData.Solid(3).mass = 0.00072851613140055473; % kg
smiData.Solid(3).CoM = [1.6672752107505068e-07 0.049264195897497115 6.8426699166844651]; % mm
smiData.Solid(3).MoI = [0.023642069482559629 0.023409631588225184 0.0076150552208997047]; % kg*mm^2
smiData.Solid(3).PoI = [0.00019174011014260877 5.6635742238393906e-10 -6.4605353421422721e-10]; % kg*mm^2
smiData.Solid(3).color = [0.82352941176470584 0.82352941176470584 1];
smiData.Solid(3).opacity = 1;
smiData.Solid(3).ID = 'Voice-coil.CATPart*:*Default';
%Inertia Type - Custom
%Visual Properties - Simple
smiData.Solid(4).mass = 0.036808422349281396; % kg
smiData.Solid(4).CoM = [1.5151381609408909e-08 -2.5842738425576439e-08 3.8488764942888207]; % mm
smiData.Solid(4).MoI = [16.573140175725058 16.573140156158694 32.475141872846649]; % kg*mm^2
smiData.Solid(4).PoI = [4.9976421207227284e-09 -2.8421200098863714e-09 -1.3395036264003659e-08]; % kg*mm^2
smiData.Solid(4).color = [1 1 0];
smiData.Solid(4).opacity = 1;
smiData.Solid(4).ID = 'Bottom_Stewart_Platform_V8.CATPart*:*Default';

View File

@@ -1,156 +0,0 @@
% Simscape(TM) Multibody(TM) version: 5.1
% This is a model data file derived from a Simscape Multibody Import XML file using the smimport function.
% The data in this file sets the block parameter values in an imported Simscape Multibody model.
% For more information on this file, see the smimport function help page in the Simscape Multibody documentation.
% You can modify numerical values, but avoid any other changes to this file.
% Do not add code to this file. Do not edit the physical units shown in comments.
%%%VariableName:smiData
%============= RigidTransform =============%
%Initialize the RigidTransform structure array by filling in null values.
smiData.RigidTransform(12).translation = [0.0 0.0 0.0];
smiData.RigidTransform(12).angle = 0.0;
smiData.RigidTransform(12).axis = [0.0 0.0 0.0];
smiData.RigidTransform(12).ID = '';
%Translation Method - Cartesian
%Rotation Method - Arbitrary Axis
smiData.RigidTransform(1).translation = [17.500000000021 30.310889132419 5.1574606296500001]; % mm
smiData.RigidTransform(1).angle = 0.093902078374528131; % rad
smiData.RigidTransform(1).axis = [0 0 1];
smiData.RigidTransform(1).ID = 'AssemblyGround[Drone_Stewart_Platform_V8 voice-coil.CATProduct-1:Spring cylinder.CATPart-1]';
%Translation Method - Cartesian
%Rotation Method - Arbitrary Axis
smiData.RigidTransform(2).translation = [0 0 0]; % mm
smiData.RigidTransform(2).angle = 0; % rad
smiData.RigidTransform(2).axis = [0 0 0];
smiData.RigidTransform(2).ID = 'AssemblyGround[Drone_Stewart_Platform_V8 voice-coil.CATProduct-1:Upper_Stewart_Platform_V8.CATPart-1]';
%Translation Method - Cartesian
%Rotation Method - Arbitrary Axis
smiData.RigidTransform(3).translation = [17.500000000021 -30.310889132492001 5.1574606296500001]; % mm
smiData.RigidTransform(3).angle = 0.093902078374528131; % rad
smiData.RigidTransform(3).axis = [0 0 1];
smiData.RigidTransform(3).ID = 'AssemblyGround[Drone_Stewart_Platform_V8 voice-coil.CATProduct-1:Spring cylinder.CATPart-3]';
%Translation Method - Cartesian
%Rotation Method - Arbitrary Axis
smiData.RigidTransform(4).translation = [9.6240451994409995 -30.811470883506999 19.383957937758002]; % mm
smiData.RigidTransform(4).angle = 3.1415926535897931; % rad
smiData.RigidTransform(4).axis = [0.88807383397699313 6.3170900042374556e-16 -0.45970084338121897];
smiData.RigidTransform(4).ID = 'AssemblyGround[Drone_Stewart_Platform_V8 voice-coil.CATProduct-1:Voice-coil.CATPart-1]';
%Translation Method - Cartesian
%Rotation Method - Arbitrary Axis
smiData.RigidTransform(5).translation = [21.871493913361999 -23.740403071639001 19.383957937758002]; % mm
smiData.RigidTransform(5).angle = 2.6777446800421498; % rad
smiData.RigidTransform(5).axis = [-0.79025275363749503 -0.45625264004045041 -0.40906492617245471];
smiData.RigidTransform(5).ID = 'AssemblyGround[Drone_Stewart_Platform_V8 voice-coil.CATProduct-1:Voice-coil.CATPart-2]';
%Translation Method - Cartesian
%Rotation Method - Arbitrary Axis
smiData.RigidTransform(6).translation = [21.871493913361 23.740403071566 19.383957937758002]; % mm
smiData.RigidTransform(6).angle = 2.3226757410894345; % rad
smiData.RigidTransform(6).axis = [0.4840501729431676 0.83839949295006799 -0.25056280708588496];
smiData.RigidTransform(6).ID = 'AssemblyGround[Drone_Stewart_Platform_V8 voice-coil.CATProduct-1:Voice-coil.CATPart-3]';
%Translation Method - Cartesian
%Rotation Method - Arbitrary Axis
smiData.RigidTransform(7).translation = [9.6240451994409995 30.811470883434001 19.383957937758002]; % mm
smiData.RigidTransform(7).angle = 2.1862760354647519; % rad
smiData.RigidTransform(7).axis = [5.6189562004407762e-16 -1 -1.3924588923326856e-16];
smiData.RigidTransform(7).ID = 'AssemblyGround[Drone_Stewart_Platform_V8 voice-coil.CATProduct-1:Voice-coil.CATPart-4]';
%Translation Method - Cartesian
%Rotation Method - Arbitrary Axis
smiData.RigidTransform(8).translation = [-31.495539112739003 7.0710678118320001 19.383957937758002]; % mm
smiData.RigidTransform(8).angle = 2.3226757410894345; % rad
smiData.RigidTransform(8).axis = [-0.48405017294316754 0.83839949295006766 0.25056280708588635];
smiData.RigidTransform(8).ID = 'AssemblyGround[Drone_Stewart_Platform_V8 voice-coil.CATProduct-1:Voice-coil.CATPart-5]';
%Translation Method - Cartesian
%Rotation Method - Arbitrary Axis
smiData.RigidTransform(9).translation = [-31.495539112739003 -7.0710678119050003 19.383957937758002]; % mm
smiData.RigidTransform(9).angle = 2.6777446800421507; % rad
smiData.RigidTransform(9).axis = [0.79025275363749525 -0.45625264004045002 0.40906492617245482];
smiData.RigidTransform(9).ID = 'AssemblyGround[Drone_Stewart_Platform_V8 voice-coil.CATProduct-1:Voice-coil.CATPart-6]';
%Translation Method - Cartesian
%Rotation Method - Arbitrary Axis
smiData.RigidTransform(10).translation = [0 0 0]; % mm
smiData.RigidTransform(10).angle = 0; % rad
smiData.RigidTransform(10).axis = [0 0 0];
smiData.RigidTransform(10).ID = 'AssemblyGround[Drone_Stewart_Platform_V8 voice-coil.CATProduct-1:Bottom_Stewart_Platform_V8.CATPart-1]';
%Translation Method - Cartesian
%Rotation Method - Arbitrary Axis
smiData.RigidTransform(11).translation = [-34.999999999978996 -3.7000000000000001e-11 5.1574606296500001]; % mm
smiData.RigidTransform(11).angle = 0.093902078374528131; % rad
smiData.RigidTransform(11).axis = [0 0 1];
smiData.RigidTransform(11).ID = 'AssemblyGround[Drone_Stewart_Platform_V8 voice-coil.CATProduct-1:Spring cylinder.CATPart-2]';
%Translation Method - Cartesian
%Rotation Method - Arbitrary Axis
smiData.RigidTransform(12).translation = [0 0 0]; % mm
smiData.RigidTransform(12).angle = 0; % rad
smiData.RigidTransform(12).axis = [0 0 0];
smiData.RigidTransform(12).ID = 'RootGround[Drone_Stewart_Platform_V8 voice-coil.CATProduct-1]';
%============= Solid =============%
%Center of Mass (CoM) %Moments of Inertia (MoI) %Product of Inertia (PoI)
%Initialize the Solid structure array by filling in null values.
smiData.Solid(4).mass = 0.0;
smiData.Solid(4).CoM = [0.0 0.0 0.0];
smiData.Solid(4).MoI = [0.0 0.0 0.0];
smiData.Solid(4).PoI = [0.0 0.0 0.0];
smiData.Solid(4).color = [0.0 0.0 0.0];
smiData.Solid(4).opacity = 0.0;
smiData.Solid(4).ID = '';
%Inertia Type - Custom
%Visual Properties - Simple
smiData.Solid(1).mass = 0.002953024625510399; % kg
smiData.Solid(1).CoM = [0.00019528918640542437 -0.0030390869707000701 3.4103846069334764]; % mm
smiData.Solid(1).MoI = [0.094245235034989605 0.095111221695610218 0.060564976663331278]; % kg*mm^2
smiData.Solid(1).PoI = [9.2822238167834426e-07 0.0015998098386190715 -2.9934446424201115e-05]; % kg*mm^2
smiData.Solid(1).color = [0.82352941176470584 0.82352941176470584 1];
smiData.Solid(1).opacity = 1;
smiData.Solid(1).ID = 'Spring cylinder.CATPart*:*Default';
%Inertia Type - Custom
%Visual Properties - Simple
smiData.Solid(2).mass = 0.032807859410420866; % kg
smiData.Solid(2).CoM = [4.3204111866222267e-05 6.4929928363256894e-06 22.029956321592298]; % mm
smiData.Solid(2).MoI = [10.958807269683136 10.958651478878741 21.418645161274547]; % kg*mm^2
smiData.Solid(2).PoI = [-2.7272640778847972e-06 2.0116845742236026e-06 2.0925824216820959e-06]; % kg*mm^2
smiData.Solid(2).color = [0 1 1];
smiData.Solid(2).opacity = 1;
smiData.Solid(2).ID = 'Upper_Stewart_Platform_V8.CATPart*:*Default';
%Inertia Type - Custom
%Visual Properties - Simple
smiData.Solid(3).mass = 0.00072851613140055473; % kg
smiData.Solid(3).CoM = [1.6672752107505068e-07 0.049264195897497115 6.8426699166844651]; % mm
smiData.Solid(3).MoI = [0.023642069482559629 0.023409631588225184 0.0076150552208997047]; % kg*mm^2
smiData.Solid(3).PoI = [0.00019174011014260877 5.6635742238393906e-10 -6.4605353421422721e-10]; % kg*mm^2
smiData.Solid(3).color = [0.82352941176470584 0.82352941176470584 1];
smiData.Solid(3).opacity = 1;
smiData.Solid(3).ID = 'Voice-coil.CATPart*:*Default';
%Inertia Type - Custom
%Visual Properties - Simple
smiData.Solid(4).mass = 0.036808422349281396; % kg
smiData.Solid(4).CoM = [1.5151381609408909e-08 -2.5842738425576439e-08 3.8488764942888207]; % mm
smiData.Solid(4).MoI = [16.573140175725058 16.573140156158694 32.475141872846649]; % kg*mm^2
smiData.Solid(4).PoI = [4.9976421207227284e-09 -2.8421200098863714e-09 -1.3395036264003659e-08]; % kg*mm^2
smiData.Solid(4).color = [1 1 0];
smiData.Solid(4).opacity = 1;
smiData.Solid(4).ID = 'Bottom_Stewart_Platform_V8.CATPart*:*Default';

View File

@@ -132,8 +132,10 @@ legend('location', 'northwest');
Gx = Gu*inv(J');
Gx.InputName = {'Fx', 'Fy', 'Fz', 'Mx', 'My', 'Mz'};
% Real Approximation of $G$ at the decoupling frequency
% <<sec:stewart_real_approx>>
% Decoupling using the SVD
% <<sec:stewart_svd_decoupling>>
% In order to decouple the plant using the SVD, first a real approximation of the plant transfer function matrix as the crossover frequency is required.
% Let's compute a real approximation of the complex matrix $H_1$ which corresponds to the the transfer function $G_u(j\omega_c)$ from forces applied by the actuators to the measured acceleration of the top platform evaluated at the frequency $\omega_c$.
@@ -148,10 +150,18 @@ H1 = evalfr(Gu, j*wc);
D = pinv(real(H1'*H1));
H1 = inv(D*real(H1'*diag(exp(j*angle(diag(H1*D*H1.'))/2))));
% SVD Decoupling
% <<sec:stewart_svd_decoupling>>
% First, the Singular Value Decomposition of $H_1$ is performed:
% #+caption: Real part of $G$ at the decoupling frequency $\omega_c$
% #+RESULTS:
% | 4.4 | -2.1 | -2.1 | 4.4 | -2.4 | -2.4 |
% | -0.2 | -3.9 | 3.9 | 0.2 | -3.8 | 3.8 |
% | 3.4 | 3.4 | 3.4 | 3.4 | 3.4 | 3.4 |
% | -367.1 | -323.8 | 323.8 | 367.1 | 43.3 | -43.3 |
% | -162.0 | -237.0 | -237.0 | -162.0 | 398.9 | 398.9 |
% | 220.6 | -220.6 | 220.6 | -220.6 | 220.6 | -220.6 |
% Now, the Singular Value Decomposition of $H_1$ is performed:
% \[ H_1 = U \Sigma V^H \]
@@ -171,7 +181,7 @@ H1 = inv(D*real(H1'*diag(exp(j*angle(diag(H1*D*H1.'))/2))));
Gsvd = inv(U)*Gu*inv(V');
% Verification of the decoupling using the "Gershgorin Radii"
% <<sec:comp_decoupling>>
% <<sec:stewart_gershorin_radii>>
% The "Gershgorin Radii" is computed for the coupled plant $G(s)$, for the "Jacobian plant" $G_x(s)$ and the "SVD Decoupled Plant" $G_{SVD}(s)$:
@@ -221,6 +231,8 @@ legend('location', 'northwest');
ylim([1e-3, 1e3]);
% Verification of the decoupling using the "Relative Gain Array"
% <<sec:stewart_rga>>
% The relative gain array (RGA) is defined as:
% \begin{equation}
% \Lambda\big(G(s)\big) = G(s) \times \big( G(s)^{-1} \big)^T
@@ -502,141 +514,6 @@ isstable(G_svd)
% The obtained transmissibility in Open-loop, for the centralized control as well as for the SVD control are shown in Figure [[fig:stewart_platform_simscape_cl_transmissibility]].
figure;
tiledlayout(2, 2, 'TileSpacing', 'None', 'Padding', 'None');
ax1 = nexttile;
hold on;
plot(freqs, abs(squeeze(freqresp(G( 'Ax', 'Dwx')/s^2, freqs, 'Hz'))), 'DisplayName', 'Open-Loop');
plot(freqs, abs(squeeze(freqresp(G_cen('Ax', 'Dwx')/s^2, freqs, 'Hz'))), 'DisplayName', 'Centralized');
plot(freqs, abs(squeeze(freqresp(G_svd('Ax', 'Dwx')/s^2, freqs, 'Hz'))), '--', 'DisplayName', 'SVD');
set(gca,'ColorOrderIndex',1)
plot(freqs, abs(squeeze(freqresp(G( 'Ay', 'Dwy')/s^2, freqs, 'Hz'))), 'HandleVisibility', 'off');
plot(freqs, abs(squeeze(freqresp(G_cen('Ay', 'Dwy')/s^2, freqs, 'Hz'))), 'HandleVisibility', 'off');
plot(freqs, abs(squeeze(freqresp(G_svd('Ay', 'Dwy')/s^2, freqs, 'Hz'))), '--', 'HandleVisibility', 'off');
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
ylabel('$D_x/D_{w,x}$, $D_y/D_{w, y}$'); set(gca, 'XTickLabel',[]);
legend('location', 'southwest');
ax2 = nexttile;
hold on;
plot(freqs, abs(squeeze(freqresp(G( 'Az', 'Dwz')/s^2, freqs, 'Hz'))));
plot(freqs, abs(squeeze(freqresp(G_cen('Az', 'Dwz')/s^2, freqs, 'Hz'))));
plot(freqs, abs(squeeze(freqresp(G_svd('Az', 'Dwz')/s^2, freqs, 'Hz'))), '--');
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
ylabel('$D_z/D_{w,z}$'); set(gca, 'XTickLabel',[]);
ax3 = nexttile;
hold on;
plot(freqs, abs(squeeze(freqresp(G( 'Arx', 'Rwx')/s^2, freqs, 'Hz'))));
plot(freqs, abs(squeeze(freqresp(G_cen('Arx', 'Rwx')/s^2, freqs, 'Hz'))));
plot(freqs, abs(squeeze(freqresp(G_svd('Arx', 'Rwx')/s^2, freqs, 'Hz'))), '--');
set(gca,'ColorOrderIndex',1)
plot(freqs, abs(squeeze(freqresp(G( 'Ary', 'Rwy')/s^2, freqs, 'Hz'))));
plot(freqs, abs(squeeze(freqresp(G_cen('Ary', 'Rwy')/s^2, freqs, 'Hz'))));
plot(freqs, abs(squeeze(freqresp(G_svd('Ary', 'Rwy')/s^2, freqs, 'Hz'))), '--');
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
ylabel('$R_x/R_{w,x}$, $R_y/R_{w,y}$'); xlabel('Frequency [Hz]');
ax4 = nexttile;
hold on;
plot(freqs, abs(squeeze(freqresp(G( 'Arz', 'Rwz')/s^2, freqs, 'Hz'))));
plot(freqs, abs(squeeze(freqresp(G_cen('Arz', 'Rwz')/s^2, freqs, 'Hz'))));
plot(freqs, abs(squeeze(freqresp(G_svd('Arz', 'Rwz')/s^2, freqs, 'Hz'))), '--');
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
ylabel('$R_z/R_{w,z}$'); xlabel('Frequency [Hz]');
linkaxes([ax1,ax2,ax3,ax4],'xy');
xlim([freqs(1), freqs(end)]);
ylim([1e-3, 1e2]);
% Small error on the sensor location :no_export:
% Let's now consider a small position error of the sensor:
sens_pos_error = [105 5 -1]*1e-3; % [m]
% The system is identified again:
%% Name of the Simulink File
mdl = 'drone_platform';
%% Input/Output definition
clear io; io_i = 1;
io(io_i) = linio([mdl, '/Dw'], 1, 'openinput'); io_i = io_i + 1; % Ground Motion
io(io_i) = linio([mdl, '/V-T'], 1, 'openinput'); io_i = io_i + 1; % Actuator Forces
io(io_i) = linio([mdl, '/Inertial Sensor'], 1, 'openoutput'); io_i = io_i + 1; % Top platform acceleration
G = linearize(mdl, io);
G.InputName = {'Dwx', 'Dwy', 'Dwz', 'Rwx', 'Rwy', 'Rwz', ...
'F1', 'F2', 'F3', 'F4', 'F5', 'F6'};
G.OutputName = {'Ax', 'Ay', 'Az', 'Arx', 'Ary', 'Arz'};
% Plant
Gu = G(:, {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'});
% Disturbance dynamics
Gd = G(:, {'Dwx', 'Dwy', 'Dwz', 'Rwx', 'Rwy', 'Rwz'});
Gx = Gu*inv(J');
Gx.InputName = {'Fx', 'Fy', 'Fz', 'Mx', 'My', 'Mz'};
Gsvd = inv(U)*Gu*inv(V');
% Gershgorin Radii for the coupled plant:
Gr_coupled = zeros(length(freqs), size(Gu,2));
H = abs(squeeze(freqresp(Gu, freqs, 'Hz')));
for out_i = 1:size(Gu,2)
Gr_coupled(:, out_i) = squeeze((sum(H(out_i,:,:)) - H(out_i,out_i,:))./H(out_i, out_i, :));
end
% Gershgorin Radii for the decoupled plant using SVD:
Gr_decoupled = zeros(length(freqs), size(Gsvd,2));
H = abs(squeeze(freqresp(Gsvd, freqs, 'Hz')));
for out_i = 1:size(Gsvd,2)
Gr_decoupled(:, out_i) = squeeze((sum(H(out_i,:,:)) - H(out_i,out_i,:))./H(out_i, out_i, :));
end
% Gershgorin Radii for the decoupled plant using the Jacobian:
Gr_jacobian = zeros(length(freqs), size(Gx,2));
H = abs(squeeze(freqresp(Gx, freqs, 'Hz')));
for out_i = 1:size(Gx,2)
Gr_jacobian(:, out_i) = squeeze((sum(H(out_i,:,:)) - H(out_i,out_i,:))./H(out_i, out_i, :));
end
figure;
hold on;
plot(freqs, Gr_coupled(:,1), 'DisplayName', 'Coupled');
plot(freqs, Gr_decoupled(:,1), 'DisplayName', 'SVD');
plot(freqs, Gr_jacobian(:,1), 'DisplayName', 'Jacobian');
for in_i = 2:6
set(gca,'ColorOrderIndex',1)
plot(freqs, Gr_coupled(:,in_i), 'HandleVisibility', 'off');
set(gca,'ColorOrderIndex',2)
plot(freqs, Gr_decoupled(:,in_i), 'HandleVisibility', 'off');
set(gca,'ColorOrderIndex',3)
plot(freqs, Gr_jacobian(:,in_i), 'HandleVisibility', 'off');
end
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
hold off;
xlabel('Frequency (Hz)'); ylabel('Gershgorin Radii')
legend('location', 'northwest');
ylim([1e-3, 1e3]);
L_cen = K_cen*Gx;
G_cen = feedback(G, pinv(J')*K_cen, [7:12], [1:6]);
L_svd = K_svd*Gsvd;
G_svd = feedback(G, inv(V')*K_svd*inv(U), [7:12], [1:6]);
isstable(G_cen)
isstable(G_svd)
figure;
tiledlayout(2, 2, 'TileSpacing', 'None', 'Padding', 'None');