nass-simscape/identification/id_stages.m

99 lines
2.7 KiB
Mathematica
Raw Normal View History

%% Script Description
% Run an identification of each stage from input to output
% Save all computed transfer functions into one .mat file
%%
clear; close all; clc;
2018-06-16 22:57:54 +02:00
%%
2018-06-21 11:43:46 +02:00
initializeSample(struct('mass', 20));
2018-06-16 22:57:54 +02:00
%% Options for preprocessing the identified transfer functions
f_low = 10; % [Hz]
f_high = 10000; % [Hz]
%% Options for Linearized
options = linearizeOptions;
options.SampleTime = 0;
%% Name of the Simulink File
2018-06-16 22:57:54 +02:00
mdl = 'Micro_Station_Identification';
%% Y-Translation Stage
% Input/Output definition
2018-06-16 22:57:54 +02:00
io(1) = linio([mdl, '/Micro-Station/Fy'], 1,'input');
io(2) = linio([mdl, '/Micro-Station/Translation y'],1,'output');
% Run the linearization
G_ty_raw = linearize(mdl,io, 0);
% Post-process the linearized function
G_ty = preprocessIdTf(G_ty_raw, f_low, f_high);
% Input/Output names
G_ty.InputName = {'Fy'};
G_ty.OutputName = {'Dy'};
%% Tilt Stage
% Input/Output definition
2018-06-16 22:57:54 +02:00
io(1) = linio([mdl, '/Micro-Station/Ry'], 1,'input');
io(2) = linio([mdl, '/Micro-Station/Tilt'],1,'output');
% Run the linearization
G_ry_raw = linearize(mdl,io, 0);
% Post-process the linearized function
G_ry = preprocessIdTf(G_ry_raw, f_low, f_high);
% Input/Output names
G_ry.InputName = {'My'};
G_ry.OutputName = {'Ry'};
%% Spindle
% Input/Output definition
2018-06-16 22:57:54 +02:00
io(1) = linio([mdl, '/Micro-Station/Rz'], 1,'input');
io(2) = linio([mdl, '/Micro-Station/Spindle'],1,'output');
% Run the linearization
G_rz_raw = linearize(mdl,io, 0);
% Post-process the linearized function
G_rz = preprocessIdTf(G_rz_raw, f_low, f_high);
% Input/Output names
G_rz.InputName = {'Mz'};
G_rz.OutputName = {'Rz'};
%% Hexapod Symetrie
% Input/Output definition
2018-06-16 22:57:54 +02:00
io(1) = linio([mdl, '/Micro-Station/Fm'], 1,'input');
io(2) = linio([mdl, '/Micro-Station/Micro_Hexapod'],1,'output');
% Run the linearization
G_hexa_raw = linearize(mdl,io, 0);
% Post-process the linearized function
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', 'Rhexa_x', 'Rhexa_y', 'Rhexa_z'};
%% NASS
% Input/Output definition
2018-06-16 22:57:54 +02:00
io(1) = linio([mdl, '/Micro-Station/Fn'], 1,'input');
io(2) = linio([mdl, '/Micro-Station/Nano_Hexapod'],1,'output');
% Run the linearization
2018-06-21 11:43:46 +02:00
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'};
2018-06-21 11:43:46 +02:00
G_nass.OutputName = {'Dnass_x', 'Dnass_y', 'Dnass_z', 'Rnass_x', 'Rnass_y', 'Rnass_z'};
%% Save all transfer function
2018-06-21 11:43:46 +02:00
save('./mat/identified_tf.mat', 'G_ty', 'G_ry', 'G_rz', 'G_hexa', 'G_nass')