[WIP] Add src folder, change damping of system

This commit is contained in:
Thomas Dehaeze
2018-06-13 09:37:20 +02:00
parent 3b4a67e0a1
commit 971a520edd
17 changed files with 102 additions and 120 deletions

View File

@@ -1,25 +1,11 @@
%% Script Description
%
%%
clear;
close all;
clc
%% Define options for bode plots
bode_opts = bodeoptions;
bode_opts.Title.FontSize = 12;
bode_opts.XLabel.FontSize = 12;
bode_opts.YLabel.FontSize = 12;
bode_opts.FreqUnits = 'Hz';
bode_opts.MagUnits = 'abs';
bode_opts.MagScale = 'log';
bode_opts.PhaseWrapping = 'on';
bode_opts.PhaseVisible = 'on';
clear; close all; clc;
%% Options for preprocessing the identified transfer functions
f_low = 10;
f_high = 1000;
f_high = 10000;
%% Options for Linearized
options = linearizeOptions;
@@ -28,21 +14,23 @@ options.SampleTime = 0;
%% Name of the Simulink File
mdl = 'Assemblage';
%% Y-Translation Stage
%% NASS
% Input/Output definition
io(1) = linio([mdl, '/Fnass_cart'],1,'input');
io(2) = linio([mdl, '/Sample'],1,'output');
io(1) = linio([mdl, '/Micro-Station/Fn'],1,'input');
io(2) = linio([mdl, '/Micro-Station/Nano_Hexapod'],1,'output');
% Run the linearization
G_f_to_d = linearize(mdl,io, 0);
G_f_to_d = preprocessIdTf(G_f_to_d, 10, 10000);
% Input/Output names
G_f_to_d.InputName = {'Fy'};
G_f_to_d.OutputName = {'Dy'};
G_f_to_d.InputName = {'Fx', 'Fy', 'Fz', 'Mx', 'My', 'Mz'};
G_f_to_d.OutputName = {'Dx', 'Dy', 'Dz', 'Rx', 'Ry', 'Rz'};
% Bode Plot of the linearized function
figure;
bode(G_f_to_d(2, 2), bode_opts)
bodeFig({G_f_to_d(1, 1), G_f_to_d(2, 2), G_f_to_d(3, 3)}, struct('phase', true))
legend({'$F_{n_x} \rightarrow D_{x}$', '$F_{n_y} \rightarrow D_{y}$', '$F_{n_z} \rightarrow D_{z}$'})
%%
save('../mat/G_f_to_d.mat', 'G_f_to_d');
save('./mat/G_f_to_d.mat', 'G_f_to_d');

View File

@@ -3,25 +3,11 @@
% Save all computed transfer functions into one .mat file
%%
clear;
close all;
clc
%% Define options for bode plots
bode_opts = bodeoptions;
bode_opts.Title.FontSize = 12;
bode_opts.XLabel.FontSize = 12;
bode_opts.YLabel.FontSize = 12;
bode_opts.FreqUnits = 'Hz';
bode_opts.MagUnits = 'abs';
bode_opts.MagScale = 'log';
bode_opts.PhaseWrapping = 'on';
bode_opts.PhaseVisible = 'off';
clear; close all; clc;
%% Options for preprocessing the identified transfer functions
f_low = 10;
f_high = 1000;
f_low = 10; % [Hz]
f_high = 10000; % [Hz]
%% Options for Linearized
options = linearizeOptions;
@@ -33,7 +19,7 @@ mdl = 'Assemblage';
%% Y-Translation Stage
% Input/Output definition
io(1) = linio([mdl, '/Fy'],1,'input');
io(2) = linio([mdl, '/Translation y'],1,'output');
io(2) = linio([mdl, '/Dy_meas'],1,'output');
% Run the linearization
G_ty_raw = linearize(mdl,io, 0);
@@ -46,13 +32,14 @@ G_ty.InputName = {'Fy'};
G_ty.OutputName = {'Dy'};
% Bode Plot of the linearized function
figure;
bode(G_ty, bode_opts)
bodeFig({G_ty}, struct('phase', true))
legend({'$F_{y} \rightarrow D_{y}$'})
exportFig('id_ty', 'normal-normal')
%% Tilt Stage
% Input/Output definition
io(1) = linio([mdl, '/My'],1,'input');
io(2) = linio([mdl, '/Tilt'],1,'output');
io(2) = linio([mdl, '/Ry_meas'],1,'output');
% Run the linearization
G_ry_raw = linearize(mdl,io, 0);
@@ -65,14 +52,14 @@ G_ry.InputName = {'My'};
G_ry.OutputName = {'Ry'};
% Bode Plot of the linearized function
figure;
bode(G_ry, bode_opts)
bodeFig({G_ry}, struct('phase', true))
legend({'$M_{y} \rightarrow R_{y}$'})
exportFig('id_ry', 'normal-normal')
%% Spindle
% Input/Output definition
io(1) = linio([mdl, '/Mz'],1,'input');
io(2) = linio([mdl, '/Spindle'],1,'output');
io(2) = linio([mdl, '/Rz_meas'],1,'output');
% Run the linearization
G_rz_raw = linearize(mdl,io, 0);
@@ -85,14 +72,14 @@ G_rz.InputName = {'Mz'};
G_rz.OutputName = {'Rz'};
% Bode Plot of the linearized function
figure;
bode(G_rz, bode_opts)
bodeFig({G_rz}, struct('phase', true))
legend({'$M_{z} \rightarrow R_{z}$'})
exportFig('id_ry', 'normal-normal')
%% Hexapod Symetrie
% Input/Output definition
io(1) = linio([mdl, '/Fhexa_cart'],1,'input');
io(2) = linio([mdl, '/Hexapod Symetrie'],1,'output');
io(2) = linio([mdl, '/Dm_meas'],1,'output');
% Run the linearization
G_hexa_raw = linearize(mdl,io, 0);
@@ -102,19 +89,28 @@ G_hexa = preprocessIdTf(G_hexa_raw, f_low, f_high);
% Input/Output names
G_hexa.InputName = {'Fhexa_x', 'Fhexa_y', 'Fhexa_z', 'Mhexa_x', 'Mhexa_y', 'Mhexa_z'};
G_hexa.OutputName = {'Dhexa_x', 'Dhexa_y', 'Dhexa_z', 'Dhexa_x', 'Dhexa_y', 'Dhexa_z'};
G_hexa.OutputName = {'Dhexa_x', 'Dhexa_y', 'Dhexa_z', 'Rhexa_x', 'Rhexa_y', 'Rhexa_z'};
% Bode Plot of the linearized function
figure;
bode(G_hexa, bode_opts)
bodeFig({G_hexa(1, 1), G_hexa(2, 2), G_hexa(3, 3)}, struct('phase', true))
legend({'$F_{h_x} \rightarrow D_{h_x}$', '$F_{h_y} \rightarrow D_{h_y}$', '$F_{h_z} \rightarrow D_{h_z}$'})
exportFig('id_hexapod_trans', 'normal-normal')
bodeFig({G_hexa(4, 4), G_hexa(5, 5), G_hexa(6, 6)}, struct('phase', true))
legend({'$M_{h_x} \rightarrow R_{h_x}$', '$M_{h_y} \rightarrow R_{h_y}$', '$M_{h_z} \rightarrow R_{h_z}$'})
exportFig('id_hexapod_rot', 'normal-normal')
bodeFig({G_hexa(1, 1), G_hexa(2, 1), G_hexa(3, 1)}, struct('phase', true))
legend({'$F_{h_x} \rightarrow D_{h_x}$', '$F_{h_x} \rightarrow D_{h_y}$', '$F_{h_x} \rightarrow D_{h_z}$'})
exportFig('id_hexapod_coupling', 'normal-normal')
%% NASS
% Input/Output definition
io(1) = linio([mdl, '/Fnass_cart'],1,'input');
io(2) = linio([mdl, '/NASS'],1,'output');
io(2) = linio([mdl, '/Dn_meas'],1,'output');
% Run the linearization
G_nass_raw = linearize(mdl,io, 0);
c = linearize(mdl,io, 0);
% Post-process the linearized function
G_nass = preprocessIdTf(G_nass_raw, f_low, f_high);
@@ -124,8 +120,17 @@ G_nass.InputName = {'Fnass_x', 'Fnass_y', 'Fnass_z', 'Mnass_x', 'Mnass_y', 'Mna
G_nass.OutputName = {'Dnass_x', 'Dnass_y', 'Dnass_z', 'Dnass_x', 'Dnass_y', 'Dnass_z'};
% Bode Plot of the linearized function
figure;
bode(G_nass, bode_opts)
bodeFig({G_nass(1, 1), G_nass(2, 2), G_nass(3, 3)}, struct('phase', true))
legend({'$F_{n_x} \rightarrow D_{n_x}$', '$F_{n_y} \rightarrow D_{n_y}$', '$F_{n_z} \rightarrow D_{n_z}$'})
exportFig('id_nass_trans', 'normal-normal')
bodeFig({G_nass(4, 4), G_nass(5, 5), G_nass(6, 6)}, struct('phase', true))
legend({'$M_{n_x} \rightarrow R_{n_x}$', '$M_{n_y} \rightarrow R_{n_y}$', '$M_{n_z} \rightarrow R_{n_z}$'})
exportFig('id_nass_rot', 'normal-normal')
bodeFig({G_nass(1, 1), G_nass(2, 1), G_nass(3, 1)}, struct('phase', true))
legend({'$F_{n_x} \rightarrow D_{n_x}$', '$F_{n_x} \rightarrow D_{n_y}$', '$F_{n_x} \rightarrow D_{n_z}$'})
exportFig('id_nass_coupling', 'normal-normal')
%% Save all transfer function
save('../mat/identified_tf.mat', 'G_ty', 'G_ry', 'G_rz', 'G_hexa', 'G_nass')