Add and modify identification scripts

This commit is contained in:
Thomas Dehaeze 2018-06-21 11:43:46 +02:00
parent 91ab166b3e
commit 518978fc1b
4 changed files with 51 additions and 35 deletions

View File

@ -22,14 +22,21 @@ initializeSample(struct('mass', 50));
[G_50, G_50_raw] = identifyG();
%%
freqs = logspace(1, 4, 1000);
freqs = logspace(0, 3, 1000);
bodeFig({G_1(1, 1), G_1(2, 2), G_1(3, 3)}, struct('phase', true))
bodeFig({G_1(1, 1), G_1(2, 2), G_1(3, 3)}, freqs, struct('phase', true))
legend({'$F_{n_x} \rightarrow D_{x}$ - $M = 1Kg$', ...
'$F_{n_y} \rightarrow D_{y}$ - $M = 1Kg$', ...
'$F_{n_z} \rightarrow D_{z}$ - $M = 1Kg$'})
legend('location', 'southwest')
exportFig('G_xyz', 'normal-normal')
exportFig('G_xyz_1', 'normal-normal')
bodeFig({G_20(1, 1), G_20(2, 2), G_20(3, 3)}, struct('phase', true))
legend({'$F_{n_x} \rightarrow D_{x}$ - $M = 20Kg$', ...
'$F_{n_y} \rightarrow D_{y}$ - $M = 20Kg$', ...
'$F_{n_z} \rightarrow D_{z}$ - $M = 20Kg$'})
legend('location', 'southwest')
exportFig('G_xyz_20', 'normal-normal')
bodeFig({G_1(1, 1), G_20(1, 1), G_50(1, 1)}, struct('phase', true))
legend({'$F_{n_x} \rightarrow D_{x}$ - $M = 1Kg$', ...
@ -43,7 +50,7 @@ legend({'$F_{n_y} \rightarrow D_{y}$ - $M = 1Kg$', ...
'$F_{n_y} \rightarrow D_{y}$ - $M = 20Kg$', ...
'$F_{n_y} \rightarrow D_{y}$ - $M = 50Kg$'})
legend('location', 'southwest')
exportFig('G_y_mass', 'normal-normal')
exportFig('G_y_mass', 'half-normal')
bodeFig({G_1(3, 3), G_20(3, 3), G_50(3, 3)}, struct('phase', true))
legend({'$F_{n_z} \rightarrow D_{z}$ - $M = 1Kg$', ...
@ -52,5 +59,26 @@ legend({'$F_{n_z} \rightarrow D_{z}$ - $M = 1Kg$', ...
legend('location', 'southwest')
exportFig('G_z_mass', 'normal-normal')
%%
bodeFig({G_1(2, 2), G_20(2, 2), G_50(2, 2)}, freqs, struct('phase', true))
legend({'$M = 1Kg$', ...
'$M = 20Kg$', ...
'$M = 50Kg$'})
exportFig('G_y_mass_article', 'half-normal')
%%
save('./mat/G_f_to_d.mat', 'G_1', 'G_20', 'G_50');
%%
freqs = logspace(-1, 3, 1000);
bodeFig({G_1(1, 1), G_20(1, 1), G_50(1, 1)}, freqs, struct('phase', true))
ylabel('Amplitude [m/N]');
legend({'$1Kg$', ...
'$20Kg$', ...
'$50Kg$'})
legend('location', 'southwest')
set(gca,'YTick',[1e-8, 1e-6, 1e-4])
ylim([1e-9, 1e-3])
exportFig('G_x_mass', 'half-short', struct('tikz', true))

View File

@ -5,34 +5,22 @@
%%
clear; close all; clc;
%% Options for preprocessing the identified transfer functions
f_low = 10;
f_high = 10000;
%%
initializeSample(struct('mass', 20));
initializeSimConf(struct('cl_time', 0));
%% Options for Linearized
options = linearizeOptions;
options.SampleTime = 0;
%% Open Loop
[Gd_ol_20, Gd_ol_20_raw] = identifyGd(struct('cl', false));
%% Name of the Simulink File
mdl = 'Assemblage';
%% NASS
% Input/Output definition
io(1) = linio([mdl, '/Micro-Station/Gm'],1,'input');
io(2) = linio([mdl, '/Micro-Station/Sample'],1,'output');
% Run the linearization
Gd_xg_to_d_raw = linearize(mdl,io, 0);
Gd_xg_to_d = preprocessIdTf(Gd_xg_to_d_raw, f_low, f_high);
% Input/Output names
Gd_xg_to_d.InputName = {'Dgx', 'Dgy', 'Dgz'};
Gd_xg_to_d.OutputName = {'Dx', 'Dy', 'Dz', 'Rx', 'Ry', 'Rz'};
% Bode Plot of the linearized function
bodeFig({Gd_xg_to_d(1, 1), Gd_xg_to_d(2, 2), Gd_xg_to_d(3, 3)}, struct('phase', true))
legend({'$Dg_{x} \rightarrow D_{x}$', '$Dg_{y} \rightarrow D_{y}$', '$Dg_{z} \rightarrow D_{z}$'})
%% Close Loop
[Gd_cl_20, Gd_cl_20_raw] = identifyGd(struct('cl', true));
%%
save('./mat/Gd_xg_to_d.mat', 'Gd_xg_to_d');
freqs = logspace(0, 3, 1000);
bodeFig({Gd_ol_20(1, 1), Gd_cl_20(1, 1)}, freqs, struct('ylabel', 'Amplitude [m/m]'))
legend({'OL', 'CL'});
exportFig('transmissibility_ol_cl', 'half-normal');
%%
save('./mat/Gd_ol_cl.mat', 'Gd_ol_20', 'Gd_cl_20');

View File

@ -6,7 +6,7 @@
clear; close all; clc;
%%
initializeSample(struct('mass', 10));
initializeSample(struct('mass', 20));
%% Options for preprocessing the identified transfer functions
f_low = 10; % [Hz]
@ -85,14 +85,14 @@ io(1) = linio([mdl, '/Micro-Station/Fn'], 1,'input');
io(2) = linio([mdl, '/Micro-Station/Nano_Hexapod'],1,'output');
% Run the linearization
c = linearize(mdl,io, 0);
G_nass_raw = linearize(mdl,io, 0);
% Post-process the linearized function
G_nass = preprocessIdTf(G_nass_raw, f_low, f_high);
% Input/Output names
G_nass.InputName = {'Fnass_x', 'Fnass_y', 'Fnass_z', 'Mnass_x', 'Mnass_y', 'Mnass_z'};
G_nass.OutputName = {'Dnass_x', 'Dnass_y', 'Dnass_z', 'Dnass_x', 'Dnass_y', 'Dnass_z'};
G_nass.OutputName = {'Dnass_x', 'Dnass_y', 'Dnass_z', 'Rnass_x', 'Rnass_y', 'Rnass_z'};
%% Save all transfer function
save('../mat/identified_tf.mat', 'G_ty', 'G_ry', 'G_rz', 'G_hexa', 'G_nass')
save('./mat/identified_tf.mat', 'G_ty', 'G_ry', 'G_rz', 'G_hexa', 'G_nass')