Add script for showing all the possible displacement

This commit is contained in:
Thomas Dehaeze
2018-07-03 15:28:29 +02:00
parent 9a2102b5db
commit 80f3774166
7 changed files with 234 additions and 20 deletions

View File

@@ -4,7 +4,7 @@ function [inputs] = initializeInputs(opts_param)
'ground_motion', false, ...
'ty', false, ...
'ry', false, ...
'rz', false, ...
'rz', false, ... % If numerical value, rpm speed of the spindle
'u_hexa', false, ...
'mass', false, ...
'n_hexa', false ...
@@ -27,13 +27,13 @@ function [inputs] = initializeInputs(opts_param)
inputs = struct();
%% Ground motion
if opts.ground_motion == true
if islogical(opts.ground_motion) && opts.ground_motion == true
load('./mat/weight_Wxg.mat', 'Wxg');
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(:, 2) = lsim(Wxg, ground_motion(:, 2), time_vector);
ground_motion(:, 3) = lsim(Wxg, ground_motion(:, 3), time_vector);
elseif opts.ground_motion == false
elseif islogical(opts.ground_motion) && opts.ground_motion == false
ground_motion = zeros(length(time_vector), 3);
else
ground_motion = opts.ground_motion;
@@ -42,9 +42,9 @@ function [inputs] = initializeInputs(opts_param)
inputs.ground_motion = timeseries(ground_motion, time_vector);
%% Translation stage [m]
if opts.ty == true
if islogical(opts.ty) && opts.ty == true
ty = zeros(length(time_vector), 1);
elseif opts.ty == false
elseif islogical(opts.ty) && opts.ty == false
ty = zeros(length(time_vector), 1);
else
ty = opts.ty;
@@ -53,9 +53,9 @@ function [inputs] = initializeInputs(opts_param)
inputs.ty = timeseries(ty, time_vector);
%% Tilt Stage [rad]
if opts.ry == true
if islogical(opts.ry) && opts.ry == true
ry = 3*(2*pi/360)*sin(2*pi*0.2*time_vector);
elseif opts.ry == false
elseif islogical(opts.ry) && opts.ry == false
ry = zeros(length(time_vector), 1);
else
ry = opts.ry;
@@ -64,10 +64,12 @@ function [inputs] = initializeInputs(opts_param)
inputs.ry = timeseries(ry, time_vector);
%% Spindle [rad]
if opts.rz == true
if islogical(opts.rz) && opts.rz == true
rz = 2*pi*0.5*time_vector;
elseif opts.rz == true
elseif islogical(opts.rz) && opts.rz == false
rz = zeros(length(time_vector), 1);
elseif isnumeric(opts.rz) && length(opts.rz) == 1
rz = 2*pi*(opts.rz/60)*time_vector;
else
rz = opts.rz;
end
@@ -75,9 +77,9 @@ function [inputs] = initializeInputs(opts_param)
inputs.rz = timeseries(rz, time_vector);
%% Micro Hexapod
if opts.setpoint == true
if islogical(opts.u_hexa) && opts.setpoint == true
u_hexa = zeros(length(time_vector), 6);
elseif opts.setpoint == false
elseif islogical(opts.u_hexa) && opts.setpoint == false
u_hexa = zeros(length(time_vector), 6);
else
u_hexa = opts.u_hexa;
@@ -86,9 +88,9 @@ function [inputs] = initializeInputs(opts_param)
inputs.micro_hexapod = timeseries(u_hexa, time_vector);
%% Center of gravity compensation
if opts.setpoint == true
if islogical(opts.mass) && opts.setpoint == true
mass = zeros(length(time_vector), 2);
elseif opts.setpoint == false
elseif islogical(opts.mass) && opts.setpoint == false
mass = zeros(length(time_vector), 2);
else
mass = opts.mass;
@@ -97,9 +99,9 @@ function [inputs] = initializeInputs(opts_param)
inputs.axisc = timeseries(mass, time_vector);
%% Nano Hexapod
if opts.setpoint == true
if islogical(opts.n_hexa) && opts.setpoint == true
n_hexa = zeros(length(time_vector), 6);
elseif opts.setpoint == false
elseif islogical(opts.n_hexa) && opts.setpoint == false
n_hexa = zeros(length(time_vector), 6);
else
n_hexa = opts.n_hexa;
@@ -108,10 +110,10 @@ function [inputs] = initializeInputs(opts_param)
inputs.nano_hexapod = timeseries(n_hexa, time_vector);
%% Set point [m, rad]
if opts.setpoint == true
if islogical(opts.setpoint) && opts.setpoint == true
setpoint = zeros(length(time_vector), 6);
setpoint(ceil(10/sim_conf.Ts):end, 2) = 1e-6; % Step of 1 micro-meter in y direction
elseif opts.setpoint == false
elseif islogical(opts.setpoint) && opts.setpoint == false
setpoint = zeros(length(time_vector), 6);
else
setpoint = opts.setpoint;

View File

@@ -4,7 +4,7 @@ function [] = initializeSample(opts_param)
'height', 300,...
'mass', 50,...
'offset', 0,...
'color', [0.9 0.1 0.1] ...
'color', [0.45, 0.45, 0.45] ...
);
%% Populate opts with input parameters