[WIP] Change inputs.mat elements

Create new identification simulink
This commit is contained in:
Thomas Dehaeze 2018-10-12 18:17:03 +02:00
parent 782129a31d
commit 14259c7e67
26 changed files with 60 additions and 68 deletions

Binary file not shown.

BIN
Micro_Station.slx Normal file

Binary file not shown.

View File

@ -1,12 +1,3 @@
%% Add folders to Matlab Path
% addpath('./analysis/');
% addpath('./control/');
% addpath('./identification/');
% addpath('./initialize/');
% addpath('./src/');
% addpath('./stewart-simscape/');
% addpath('./active_damping/');
%% %%
freqs = logspace(-1, 3, 1000); freqs = logspace(-1, 3, 1000);
save_fig = false; save_fig = false;

View File

@ -11,21 +11,27 @@ options = linearizeOptions;
options.SampleTime = 0; options.SampleTime = 0;
%% Name of the Simulink File %% Name of the Simulink File
mdl = 'sim_micro_station'; mdl = 'simscape_id_micro_station';
%% Micro-Hexapod %% Micro-Hexapod
% Input/Output definition % Input/Output definition
io(1) = linio([mdl, '/Micro-Station/Fm_ext'],1,'openinput'); io(1) = linio([mdl, '/Micro-Station/Fm_ext'],1,'openinput');
io(2) = linio([mdl, '/Micro-Station/Fg_ext'],1,'openinput'); io(2) = linio([mdl, '/Micro-Station/Fg_ext'],1,'openinput');
io(3) = linio([mdl, '/Micro-Station/Dm_inertial'],1,'output'); io(3) = linio([mdl, '/Micro-Station/Dm_inertial'],1,'output');
io(4) = linio([mdl, '/Micro-Station/Dg_inertial'],1,'output'); io(4) = linio([mdl, '/Micro-Station/Ty_inertial'],1,'output');
io(5) = linio([mdl, '/Micro-Station/Ry_inertial'],1,'output');
io(6) = linio([mdl, '/Micro-Station/Dg_inertial'],1,'output');
% Run the linearization % Run the linearization
G_ms = linearize(mdl, io, 0); G_ms = linearize(mdl, io, 0);
% Input/Output names % Input/Output names
G_ms.InputName = {'Fmx', 'Fmy', 'Fmz', 'Fgx', 'Fgy', 'Fgz'}; G_ms.InputName = {'Fmx', 'Fmy', 'Fmz',...
G_ms.OutputName = {'Dmx', 'Dmy', 'Dmz', 'Dgx', 'Dgy', 'Dgz'}; 'Fgx', 'Fgy', 'Fgz'};
G_ms.OutputName = {'Dmx', 'Dmy', 'Dmz', ...
'Tyx', 'Tyy', 'Tyz', ...
'Ryx', 'Ryy', 'Ryz', ...
'Dgx', 'Dgy', 'Dgz'};
%% Save the obtained transfer functions %% Save the obtained transfer functions
save('./mat/id_micro_station.mat', 'G_ms'); save('./mat/id_micro_station.mat', 'G_ms');

View File

@ -23,7 +23,7 @@ figure;
% Amplitude % Amplitude
ax1 = subaxis(2,1,1); ax1 = subaxis(2,1,1);
hold on; hold on;
plot(freqs, abs(squeeze(freqresp(G_ms('Dgz', 'Fgz'), freqs, 'Hz')))); plot(freqs, abs(squeeze(freqresp(G_ms('Dgx', 'Fgx'), freqs, 'Hz'))));
plot(freqs, abs(squeeze(freqresp(meas_sys('Dmx', 'Fmx'), freqs, 'Hz'))), '.'); plot(freqs, abs(squeeze(freqresp(meas_sys('Dmx', 'Fmx'), freqs, 'Hz'))), '.');
set(gca,'xscale','log'); set(gca,'yscale','log'); set(gca,'xscale','log'); set(gca,'yscale','log');
ylabel('Amplitude [m/N]'); ylabel('Amplitude [m/N]');
@ -50,7 +50,7 @@ figure;
% Amplitude % Amplitude
ax1 = subaxis(2,1,1); ax1 = subaxis(2,1,1);
hold on; hold on;
plot(freqs, abs(squeeze(freqresp(G_ms('Dmz', 'Fmz'), freqs, 'Hz')))); plot(freqs, abs(squeeze(freqresp(G_ms('Dmx', 'Fmx'), freqs, 'Hz'))));
plot(freqs, abs(squeeze(freqresp(meas_sys('Dhx', 'Fhx'), freqs, 'Hz'))), '.'); plot(freqs, abs(squeeze(freqresp(meas_sys('Dhx', 'Fhx'), freqs, 'Hz'))), '.');
set(gca,'xscale','log'); set(gca,'yscale','log'); set(gca,'xscale','log'); set(gca,'yscale','log');
ylabel('Amplitude [m/N]'); ylabel('Amplitude [m/N]');
@ -60,7 +60,7 @@ hold off;
% Phase % Phase
ax2 = subaxis(2,1,2); ax2 = subaxis(2,1,2);
hold on; hold on;
plot(freqs, 180/pi*angle(squeeze(freqresp(G_ms('Dmz', 'Fmz'), freqs, 'Hz')))); plot(freqs, 180/pi*angle(squeeze(freqresp(G_ms('Dmx', 'Fmx'), freqs, 'Hz'))));
plot(freqs, 180/pi*angle(squeeze(freqresp(meas_sys('Dhx', 'Fhx'), freqs, 'Hz'))), '.'); plot(freqs, 180/pi*angle(squeeze(freqresp(meas_sys('Dhx', 'Fhx'), freqs, 'Hz'))), '.');
set(gca,'xscale','log'); set(gca,'xscale','log');
ylim([-180, 180]); ylim([-180, 180]);
@ -77,7 +77,7 @@ figure;
% Amplitude % Amplitude
ax1 = subaxis(2,1,1); ax1 = subaxis(2,1,1);
hold on; hold on;
plot(freqs, abs(squeeze(freqresp(G_ms('Dmz', 'Fgz'), freqs, 'Hz')))); plot(freqs, abs(squeeze(freqresp(G_ms('Dmx', 'Fgx'), freqs, 'Hz'))));
plot(freqs, abs(squeeze(freqresp(meas_sys('Dhx', 'Fmx'), freqs, 'Hz'))), '.'); plot(freqs, abs(squeeze(freqresp(meas_sys('Dhx', 'Fmx'), freqs, 'Hz'))), '.');
set(gca,'xscale','log'); set(gca,'yscale','log'); set(gca,'xscale','log'); set(gca,'yscale','log');
ylabel('Amplitude [m/N]'); ylabel('Amplitude [m/N]');
@ -87,7 +87,7 @@ hold off;
% Phase % Phase
ax2 = subaxis(2,1,2); ax2 = subaxis(2,1,2);
hold on; hold on;
plot(freqs, 180/pi*angle(squeeze(freqresp(G_ms('Dmz', 'Fgz'), freqs, 'Hz')))); plot(freqs, 180/pi*angle(squeeze(freqresp(G_ms('Dmx', 'Fgx'), freqs, 'Hz'))));
plot(freqs, 180/pi*angle(squeeze(freqresp(meas_sys('Dhx', 'Fmx'), freqs, 'Hz'))), '.'); plot(freqs, 180/pi*angle(squeeze(freqresp(meas_sys('Dhx', 'Fmx'), freqs, 'Hz'))), '.');
set(gca,'xscale','log'); set(gca,'xscale','log');
ylim([-180, 180]); ylim([-180, 180]);

Binary file not shown.

Binary file not shown.

View File

@ -3,16 +3,16 @@ clear; close all; clc;
%% Initialize simulation configuration %% Initialize simulation configuration
opts_sim = struct(... opts_sim = struct(...
'Tsim', 10 ... 'Tsim', 5 ...
); );
initializeSimConf(opts_sim); initializeSimConf(opts_sim);
%% Initialize Inputs %% Initialize Inputs
opts_inputs = struct(... opts_inputs = struct(...
'ground_motion', false, ... 'Dw', true, ...
'ry', false, ... 'ry', false, ...
'rz', false ... 'Rz', true ...
); );
initializeInputs(opts_inputs); initializeInputs(opts_inputs);
@ -50,11 +50,6 @@ initializeMirror(struct('shape', 'spherical'));
%% Initialize Sample %% Initialize Sample
initializeSample(struct('mass', 20)); initializeSample(struct('mass', 20));
%% Additionnal parameters
d_granite_sample = 0.80073; % [m] Z-offset from the top of the granite to the point of interest
save('./mat/simscape_data.mat', 'd_granite_sample');
%% Controllers %% Controllers
K = tf(zeros(6)); K = tf(zeros(6));
save('./mat/controller.mat', 'K'); save('./mat/controller.mat', 'K');

View File

@ -6,9 +6,6 @@ load('./mat/sim_conf.mat', 'sim_conf');
%% Load SolidWorks Data %% Load SolidWorks Data
load('./mat/solids.mat', 'solids'); load('./mat/solids.mat', 'solids');
%% Load more data
load('./mat/simscape_data.mat');
%% Load data of each stage %% Load data of each stage
load('./mat/stages.mat', 'ground', 'granite', 'ty', 'ry', 'rz', 'micro_hexapod', 'axisc', 'nano_hexapod', 'mirror', 'sample'); load('./mat/stages.mat', 'ground', 'granite', 'ty', 'ry', 'rz', 'micro_hexapod', 'axisc', 'nano_hexapod', 'mirror', 'sample');

View File

@ -1,4 +1,4 @@
function [] = initializeAxisc() function [axisc] = initializeAxisc()
%% %%
axisc = struct(); axisc = struct();

View File

@ -1,8 +1,10 @@
function [] = initializeGround() function [ground] = initializeGround()
%% %%
ground = struct(); ground = struct();
ground.shape = [2, 2, 0.5]; % m ground.shape = [2, 2, 0.5]; % [m]
ground.density = 2800; % [kg/m3]
ground.color = [0.5, 0.5, 0.5];
%% Save %% Save
save('./mat/stages.mat', 'ground', '-append'); save('./mat/stages.mat', 'ground', '-append');

View File

@ -1,10 +1,10 @@
function [inputs] = initializeInputs(opts_param) function [inputs] = initializeInputs(opts_param)
%% Default values for opts %% Default values for opts
opts = struct('setpoint', false, ... opts = struct('setpoint', false, ...
'ground_motion', false, ... 'Dw', false, ...
'ty', false, ... 'ty', false, ...
'ry', false, ... 'ry', false, ...
'rz', false, ... % If numerical value, rpm speed of the spindle 'Rz', false, ...
'u_hexa', false, ... 'u_hexa', false, ...
'mass', false, ... 'mass', false, ...
'n_hexa', false ... 'n_hexa', false ...
@ -27,19 +27,19 @@ function [inputs] = initializeInputs(opts_param)
inputs = struct(); inputs = struct();
%% Ground motion %% Ground motion
if islogical(opts.ground_motion) && opts.ground_motion == true if islogical(opts.Dw) && opts.Dw == true
load('./mat/weight_Wxg.mat', 'Wxg'); load('./mat/weight_Wxg.mat', 'Wxg');
ground_motion = 1/sqrt(2)*100*random('norm', 0, 1, length(time_vector), 3); Dw = 1/sqrt(2)*100*random('norm', 0, 1, length(time_vector), 3);
ground_motion(:, 1) = lsim(Wxg, ground_motion(:, 1), time_vector); Dw(:, 1) = lsim(Wxg, Dw(:, 1), time_vector);
ground_motion(:, 2) = lsim(Wxg, ground_motion(:, 2), time_vector); Dw(:, 2) = lsim(Wxg, Dw(:, 2), time_vector);
ground_motion(:, 3) = lsim(Wxg, ground_motion(:, 3), time_vector); Dw(:, 3) = lsim(Wxg, Dw(:, 3), time_vector);
elseif islogical(opts.ground_motion) && opts.ground_motion == false elseif islogical(opts.Dw) && opts.Dw == false
ground_motion = zeros(length(time_vector), 3); Dw = zeros(length(time_vector), 3);
else else
ground_motion = opts.ground_motion; Dw = opts.Dw;
end end
inputs.ground_motion = timeseries(ground_motion, time_vector); inputs.Dw = timeseries(Dw, time_vector);
%% Translation stage [m] %% Translation stage [m]
if islogical(opts.ty) && opts.ty == true if islogical(opts.ty) && opts.ty == true
@ -64,17 +64,17 @@ function [inputs] = initializeInputs(opts_param)
inputs.ry = timeseries(ry, time_vector); inputs.ry = timeseries(ry, time_vector);
%% Spindle [rad] %% Spindle [rad]
if islogical(opts.rz) && opts.rz == true if islogical(opts.Rz) && opts.Rz == true
rz = 2*pi*0.5*time_vector; Rz = 2*pi*0.5*time_vector;
elseif islogical(opts.rz) && opts.rz == false elseif islogical(opts.Rz) && opts.Rz == false
rz = zeros(length(time_vector), 1); Rz = zeros(length(time_vector), 1);
elseif isnumeric(opts.rz) && length(opts.rz) == 1 elseif isnumeric(opts.Rz) && length(opts.Rz) == 1
rz = 2*pi*(opts.rz/60)*time_vector; Rz = 2*pi*(opts.Rz/60)*time_vector;
else else
rz = opts.rz; Rz = opts.Rz;
end end
inputs.rz = timeseries(rz, time_vector); inputs.Rz = timeseries(Rz, time_vector);
%% Micro Hexapod %% Micro Hexapod
if islogical(opts.u_hexa) && opts.setpoint == true if islogical(opts.u_hexa) && opts.setpoint == true
@ -89,15 +89,15 @@ function [inputs] = initializeInputs(opts_param)
%% Center of gravity compensation %% Center of gravity compensation
if islogical(opts.mass) && opts.setpoint == true if islogical(opts.mass) && opts.setpoint == true
axisc = zeros(length(time_vector), 2); Rm = zeros(length(time_vector), 2);
elseif islogical(opts.mass) && opts.setpoint == false elseif islogical(opts.mass) && opts.setpoint == false
axisc = zeros(length(time_vector), 2); Rm = zeros(length(time_vector), 2);
axisc(:, 2) = pi*ones(length(time_vector), 1); Rm(:, 2) = pi*ones(length(time_vector), 1);
else else
axisc = opts.mass; Rm = opts.mass;
end end
inputs.axisc = timeseries(axisc, time_vector); inputs.Rm = timeseries(Rm, time_vector);
%% Nano Hexapod %% Nano Hexapod
if islogical(opts.n_hexa) && opts.setpoint == true if islogical(opts.n_hexa) && opts.setpoint == true

View File

@ -1,13 +1,14 @@
function [] = initializeRy() function [ry] = initializeRy()
%% %%
ry = struct(); ry = struct();
ry.m = 200; % [kg] ry.m = 200; % [kg]
ry.k.tilt = 1e4; % Rotation stiffness around y [N*m/deg]
ry.k.h = 357e6/4; % Stiffness in the direction of the guidance [N/m] ry.k.h = 357e6/4; % Stiffness in the direction of the guidance [N/m]
ry.k.rad = 555e6/4; % Stiffness in the top direction [N/m] ry.k.rad = 555e6/4; % Stiffness in the top direction [N/m]
ry.k.rrad = 238e6/4; % Stiffness in the side direction [N/m] ry.k.rrad = 238e6/4; % Stiffness in the side direction [N/m]
ry.k.tilt = 1e4 ; % Rotation stiffness around y [N*m/deg]
ry.c.h = 10*(1/5)*sqrt(ry.k.h/ry.m); ry.c.h = 10*(1/5)*sqrt(ry.k.h/ry.m);
ry.c.rad = 10*(1/5)*sqrt(ry.k.rad/ry.m); ry.c.rad = 10*(1/5)*sqrt(ry.k.rad/ry.m);

View File

@ -1,4 +1,4 @@
function [] = initializeRz() function [rz] = initializeRz()
%% %%
rz = struct(); rz = struct();
@ -6,8 +6,8 @@ function [] = initializeRz()
rz.k.ax = 2e9; % Axial Stiffness [N/m] rz.k.ax = 2e9; % Axial Stiffness [N/m]
rz.k.rad = 7e8; % Radial Stiffness [N/m] rz.k.rad = 7e8; % Radial Stiffness [N/m]
rz.k.tilt = 1e2; % TODO [N*m/deg]
rz.k.rot = 1e2; % Rotational Stiffness [N*m/deg] rz.k.rot = 1e2; % Rotational Stiffness [N*m/deg]
rz.k.tilt = 1e2; % TODO [N*m/deg]
rz.c.ax = 10*(1/5)*sqrt(rz.k.ax/rz.m); rz.c.ax = 10*(1/5)*sqrt(rz.k.ax/rz.m);
rz.c.rad = 10*(1/5)*sqrt(rz.k.rad/rz.m); rz.c.rad = 10*(1/5)*sqrt(rz.k.rad/rz.m);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
micro_station_test.slx Normal file

Binary file not shown.