Update initializeInputs by adding setpoints for all the stages

This commit is contained in:
Thomas Dehaeze 2018-06-21 14:16:08 +02:00
parent 9678f43e5f
commit 9a2102b5db

View File

@ -4,7 +4,10 @@ function [inputs] = initializeInputs(opts_param)
'ground_motion', false, ... 'ground_motion', false, ...
'ty', false, ... 'ty', false, ...
'ry', false, ... 'ry', false, ...
'rz', false ... 'rz', false, ...
'u_hexa', false, ...
'mass', false, ...
'n_hexa', false ...
); );
%% Populate opts with input parameters %% Populate opts with input parameters
@ -24,68 +27,99 @@ function [inputs] = initializeInputs(opts_param)
inputs = struct(); inputs = struct();
%% Ground motion %% Ground motion
if opts.ground_motion if opts.ground_motion == 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); ground_motion = 1/sqrt(2)*100*random('norm', 0, 1, length(time_vector), 3);
ground_motion(:, 1) = lsim(Wxg, ground_motion(:, 1), time_vector); ground_motion(:, 1) = lsim(Wxg, ground_motion(:, 1), time_vector);
ground_motion(:, 2) = lsim(Wxg, ground_motion(:, 2), time_vector); ground_motion(:, 2) = lsim(Wxg, ground_motion(:, 2), time_vector);
ground_motion(:, 3) = lsim(Wxg, ground_motion(:, 3), time_vector); ground_motion(:, 3) = lsim(Wxg, ground_motion(:, 3), time_vector);
else elseif opts.ground_motion == false
ground_motion = zeros(length(time_vector), 3); ground_motion = zeros(length(time_vector), 3);
else
ground_motion = opts.ground_motion;
end end
inputs.ground_motion = timeseries(ground_motion, time_vector); inputs.ground_motion = timeseries(ground_motion, time_vector);
%% Translation stage [m] %% Translation stage [m]
if opts.ty if opts.ty == true
ty = zeros(length(time_vector), 1);
elseif opts.ty == false
ty = zeros(length(time_vector), 1); ty = zeros(length(time_vector), 1);
else else
ty = zeros(length(time_vector), 1); ty = opts.ty;
end end
inputs.ty = timeseries(ty, time_vector); inputs.ty = timeseries(ty, time_vector);
%% Tilt Stage [rad] %% Tilt Stage [rad]
if opts.ry if opts.ry == true
ry = 3*(2*pi/360)*sin(2*pi*0.2*time_vector); ry = 3*(2*pi/360)*sin(2*pi*0.2*time_vector);
else elseif opts.ry == false
ry = zeros(length(time_vector), 1); ry = zeros(length(time_vector), 1);
else
ry = opts.ry;
end end
inputs.ry = timeseries(ry, time_vector); inputs.ry = timeseries(ry, time_vector);
%% Spindle [rad] %% Spindle [rad]
if opts.rz if opts.rz == true
rz = 2*pi*0.5*time_vector; rz = 2*pi*0.5*time_vector;
else elseif opts.rz == true
rz = zeros(length(time_vector), 1); rz = zeros(length(time_vector), 1);
else
rz = opts.rz;
end end
inputs.rz = timeseries(rz, time_vector); inputs.rz = timeseries(rz, time_vector);
%% Micro Hexapod %% Micro Hexapod
u_hexa = zeros(length(time_vector), 6); if opts.setpoint == true
u_hexa = zeros(length(time_vector), 6);
elseif opts.setpoint == false
u_hexa = zeros(length(time_vector), 6);
else
u_hexa = opts.u_hexa;
end
inputs.micro_hexapod = timeseries(u_hexa, time_vector); inputs.micro_hexapod = timeseries(u_hexa, time_vector);
%% Center of gravity compensation %% Center of gravity compensation
mass = zeros(length(time_vector), 2); if opts.setpoint == true
mass = zeros(length(time_vector), 2);
elseif opts.setpoint == false
mass = zeros(length(time_vector), 2);
else
mass = opts.mass;
end
inputs.axisc = timeseries(mass, time_vector); inputs.axisc = timeseries(mass, time_vector);
%% Nano Hexapod %% Nano Hexapod
n_hexa = zeros(length(time_vector), 6); if opts.setpoint == true
n_hexa = zeros(length(time_vector), 6);
elseif opts.setpoint == false
n_hexa = zeros(length(time_vector), 6);
else
n_hexa = opts.n_hexa;
end
inputs.nano_hexapod = timeseries(n_hexa, time_vector); inputs.nano_hexapod = timeseries(n_hexa, time_vector);
%% Set point [m, rad] %% Set point [m, rad]
if opts.setpoint if opts.setpoint == true
setpoint = zeros(length(time_vector), 6); setpoint = zeros(length(time_vector), 6);
setpoint(ceil(10/sim_conf.Ts):end, 2) = 1e-6; % Step of 1 micro-meter in y direction setpoint(ceil(10/sim_conf.Ts):end, 2) = 1e-6; % Step of 1 micro-meter in y direction
else elseif opts.setpoint == false
setpoint = zeros(length(time_vector), 6); setpoint = zeros(length(time_vector), 6);
else
setpoint = opts.setpoint;
end end
% The setpoint in rotation should be the same as the rotation of the Spindle
% Should change that. And think how to include all the setpoint of each stage in this
% global setpoint. Maybe do everything in simulink
setpoint(:, 6) = rz; setpoint(:, 6) = rz;
inputs.setpoint = timeseries(setpoint, time_vector); inputs.setpoint = timeseries(setpoint, time_vector);