diff --git a/Assemblage.slx b/Assemblage.slx index c2360d0..3163c73 100644 Binary files a/Assemblage.slx and b/Assemblage.slx differ diff --git a/Micro_Station.slx b/Micro_Station.slx new file mode 100644 index 0000000..67e80a9 Binary files /dev/null and b/Micro_Station.slx differ diff --git a/config.m b/config.m index 7099b22..cadb56c 100644 --- a/config.m +++ b/config.m @@ -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); save_fig = false; diff --git a/identification/id_micro_station.m b/identification/id_micro_station.m index 8a3d86d..dd7e2df 100644 --- a/identification/id_micro_station.m +++ b/identification/id_micro_station.m @@ -11,21 +11,27 @@ options = linearizeOptions; options.SampleTime = 0; %% Name of the Simulink File -mdl = 'sim_micro_station'; +mdl = 'simscape_id_micro_station'; %% Micro-Hexapod % Input/Output definition io(1) = linio([mdl, '/Micro-Station/Fm_ext'],1,'openinput'); io(2) = linio([mdl, '/Micro-Station/Fg_ext'],1,'openinput'); 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 G_ms = linearize(mdl, io, 0); % Input/Output names -G_ms.InputName = {'Fmx', 'Fmy', 'Fmz', 'Fgx', 'Fgy', 'Fgz'}; -G_ms.OutputName = {'Dmx', 'Dmy', 'Dmz', 'Dgx', 'Dgy', 'Dgz'}; +G_ms.InputName = {'Fmx', 'Fmy', 'Fmz',... + 'Fgx', 'Fgy', 'Fgz'}; +G_ms.OutputName = {'Dmx', 'Dmy', 'Dmz', ... + 'Tyx', 'Tyy', 'Tyz', ... + 'Ryx', 'Ryy', 'Ryz', ... + 'Dgx', 'Dgy', 'Dgz'}; %% Save the obtained transfer functions save('./mat/id_micro_station.mat', 'G_ms'); diff --git a/identification/id_micro_station_comp_meas.m b/identification/id_micro_station_comp_meas.m index 4d60ada..6a97556 100644 --- a/identification/id_micro_station_comp_meas.m +++ b/identification/id_micro_station_comp_meas.m @@ -23,7 +23,7 @@ figure; % Amplitude ax1 = subaxis(2,1,1); 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'))), '.'); set(gca,'xscale','log'); set(gca,'yscale','log'); ylabel('Amplitude [m/N]'); @@ -50,7 +50,7 @@ figure; % Amplitude ax1 = subaxis(2,1,1); 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'))), '.'); set(gca,'xscale','log'); set(gca,'yscale','log'); ylabel('Amplitude [m/N]'); @@ -60,7 +60,7 @@ hold off; % Phase ax2 = subaxis(2,1,2); 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'))), '.'); set(gca,'xscale','log'); ylim([-180, 180]); @@ -77,7 +77,7 @@ figure; % Amplitude ax1 = subaxis(2,1,1); 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'))), '.'); set(gca,'xscale','log'); set(gca,'yscale','log'); ylabel('Amplitude [m/N]'); @@ -87,7 +87,7 @@ hold off; % Phase ax2 = subaxis(2,1,2); 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'))), '.'); set(gca,'xscale','log'); ylim([-180, 180]); diff --git a/identification/sim_micro_station.slx b/identification/sim_micro_station.slx index 9577e75..b124c9b 100644 Binary files a/identification/sim_micro_station.slx and b/identification/sim_micro_station.slx differ diff --git a/identification/simscape_id_micro_station.slx b/identification/simscape_id_micro_station.slx new file mode 100644 index 0000000..20e6af3 Binary files /dev/null and b/identification/simscape_id_micro_station.slx differ diff --git a/init_data.m b/init_data.m index 555cda4..f4f8cbf 100644 --- a/init_data.m +++ b/init_data.m @@ -3,16 +3,16 @@ clear; close all; clc; %% Initialize simulation configuration opts_sim = struct(... - 'Tsim', 10 ... + 'Tsim', 5 ... ); initializeSimConf(opts_sim); %% Initialize Inputs opts_inputs = struct(... - 'ground_motion', false, ... + 'Dw', true, ... 'ry', false, ... - 'rz', false ... + 'Rz', true ... ); initializeInputs(opts_inputs); @@ -50,11 +50,6 @@ initializeMirror(struct('shape', 'spherical')); %% Initialize Sample 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 K = tf(zeros(6)); save('./mat/controller.mat', 'K'); diff --git a/init_simulation.m b/init_simulation.m index 8066088..cb4c7c2 100644 --- a/init_simulation.m +++ b/init_simulation.m @@ -6,9 +6,6 @@ load('./mat/sim_conf.mat', 'sim_conf'); %% Load SolidWorks Data load('./mat/solids.mat', 'solids'); -%% Load more data -load('./mat/simscape_data.mat'); - %% Load data of each stage load('./mat/stages.mat', 'ground', 'granite', 'ty', 'ry', 'rz', 'micro_hexapod', 'axisc', 'nano_hexapod', 'mirror', 'sample'); diff --git a/initialize/initializeAxisc.m b/initialize/initializeAxisc.m index 7bf58be..50b30c6 100644 --- a/initialize/initializeAxisc.m +++ b/initialize/initializeAxisc.m @@ -1,4 +1,4 @@ -function [] = initializeAxisc() +function [axisc] = initializeAxisc() %% axisc = struct(); diff --git a/initialize/initializeGround.m b/initialize/initializeGround.m index 79f9937..3a4e774 100644 --- a/initialize/initializeGround.m +++ b/initialize/initializeGround.m @@ -1,8 +1,10 @@ -function [] = initializeGround() +function [ground] = initializeGround() %% 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('./mat/stages.mat', 'ground', '-append'); diff --git a/initialize/initializeInputs.m b/initialize/initializeInputs.m index 82c4b94..a4aab4f 100644 --- a/initialize/initializeInputs.m +++ b/initialize/initializeInputs.m @@ -1,13 +1,13 @@ function [inputs] = initializeInputs(opts_param) %% Default values for opts - opts = struct('setpoint', false, ... - 'ground_motion', false, ... - 'ty', false, ... - 'ry', false, ... - 'rz', false, ... % If numerical value, rpm speed of the spindle - 'u_hexa', false, ... - 'mass', false, ... - 'n_hexa', false ... + opts = struct('setpoint', false, ... + 'Dw', false, ... + 'ty', false, ... + 'ry', false, ... + 'Rz', false, ... + 'u_hexa', false, ... + 'mass', false, ... + 'n_hexa', false ... ); %% Populate opts with input parameters @@ -27,19 +27,19 @@ function [inputs] = initializeInputs(opts_param) inputs = struct(); %% Ground motion - if islogical(opts.ground_motion) && opts.ground_motion == true + if islogical(opts.Dw) && opts.Dw == 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 islogical(opts.ground_motion) && opts.ground_motion == false - ground_motion = zeros(length(time_vector), 3); + Dw = 1/sqrt(2)*100*random('norm', 0, 1, length(time_vector), 3); + Dw(:, 1) = lsim(Wxg, Dw(:, 1), time_vector); + Dw(:, 2) = lsim(Wxg, Dw(:, 2), time_vector); + Dw(:, 3) = lsim(Wxg, Dw(:, 3), time_vector); + elseif islogical(opts.Dw) && opts.Dw == false + Dw = zeros(length(time_vector), 3); else - ground_motion = opts.ground_motion; + Dw = opts.Dw; end - inputs.ground_motion = timeseries(ground_motion, time_vector); + inputs.Dw = timeseries(Dw, time_vector); %% Translation stage [m] if islogical(opts.ty) && opts.ty == true @@ -64,17 +64,17 @@ function [inputs] = initializeInputs(opts_param) inputs.ry = timeseries(ry, time_vector); %% Spindle [rad] - if islogical(opts.rz) && opts.rz == true - rz = 2*pi*0.5*time_vector; - 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; + if islogical(opts.Rz) && opts.Rz == true + Rz = 2*pi*0.5*time_vector; + 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; + Rz = opts.Rz; end - inputs.rz = timeseries(rz, time_vector); + inputs.Rz = timeseries(Rz, time_vector); %% Micro Hexapod if islogical(opts.u_hexa) && opts.setpoint == true @@ -89,15 +89,15 @@ function [inputs] = initializeInputs(opts_param) %% Center of gravity compensation 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 - axisc = zeros(length(time_vector), 2); - axisc(:, 2) = pi*ones(length(time_vector), 1); + Rm = zeros(length(time_vector), 2); + Rm(:, 2) = pi*ones(length(time_vector), 1); else - axisc = opts.mass; + Rm = opts.mass; end - inputs.axisc = timeseries(axisc, time_vector); + inputs.Rm = timeseries(Rm, time_vector); %% Nano Hexapod if islogical(opts.n_hexa) && opts.setpoint == true diff --git a/initialize/initializeRy.m b/initialize/initializeRy.m index d5db1b9..10f5ba5 100644 --- a/initialize/initializeRy.m +++ b/initialize/initializeRy.m @@ -1,13 +1,14 @@ -function [] = initializeRy() +function [ry] = initializeRy() %% ry = struct(); 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.rad = 555e6/4; % Stiffness in the top 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.rad = 10*(1/5)*sqrt(ry.k.rad/ry.m); diff --git a/initialize/initializeRz.m b/initialize/initializeRz.m index 92e3ecb..76d81ef 100644 --- a/initialize/initializeRz.m +++ b/initialize/initializeRz.m @@ -1,4 +1,4 @@ -function [] = initializeRz() +function [rz] = initializeRz() %% rz = struct(); @@ -6,8 +6,8 @@ function [] = initializeRz() rz.k.ax = 2e9; % Axial 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.tilt = 1e2; % TODO [N*m/deg] rz.c.ax = 10*(1/5)*sqrt(rz.k.ax/rz.m); rz.c.rad = 10*(1/5)*sqrt(rz.k.rad/rz.m); diff --git a/initialize/initializeTy.m b/initialize/initializeTy.m index 6f0da0d..7cef6e5 100644 --- a/initialize/initializeTy.m +++ b/initialize/initializeTy.m @@ -4,8 +4,8 @@ function [ty] = initializeTy() ty.m = 250; % [kg] - ty.k.ax = 1e7/4; % Axial Stiffness for each of the 4 guidance (y) [N/m] - ty.k.rad = 9e9/4; % Radial Stiffness for each of the 4 guidance (x-z) [N/m] + ty.k.ax = 1e7/4; % Axial Stiffness for each of the 4 guidance (y) [N/m] + ty.k.rad = 9e9/4; % Radial Stiffness for each of the 4 guidance (x-z) [N/m] ty.c.ax = 100*(1/5)*sqrt(ty.k.ax/ty.m); ty.c.rad = 100*(1/5)*sqrt(ty.k.rad/ty.m); diff --git a/mat/K_iff.mat b/mat/K_iff.mat index 995e31c..982a366 100644 Binary files a/mat/K_iff.mat and b/mat/K_iff.mat differ diff --git a/mat/config.mat b/mat/config.mat index 3eaada7..b2c9dc7 100644 Binary files a/mat/config.mat and b/mat/config.mat differ diff --git a/mat/controller.mat b/mat/controller.mat index 6fbb4e3..ad5fdb4 100644 Binary files a/mat/controller.mat and b/mat/controller.mat differ diff --git a/mat/id_micro_station.mat b/mat/id_micro_station.mat index 79321b1..8155ac3 100644 Binary files a/mat/id_micro_station.mat and b/mat/id_micro_station.mat differ diff --git a/mat/inputs.mat b/mat/inputs.mat index 84094c1..6b7eb53 100644 Binary files a/mat/inputs.mat and b/mat/inputs.mat differ diff --git a/mat/sim_conf.mat b/mat/sim_conf.mat index d9c4623..8aaac97 100644 Binary files a/mat/sim_conf.mat and b/mat/sim_conf.mat differ diff --git a/mat/simscape_data.mat b/mat/simscape_data.mat deleted file mode 100644 index d052ab9..0000000 Binary files a/mat/simscape_data.mat and /dev/null differ diff --git a/mat/solids.mat b/mat/solids.mat index b83d5e8..334d828 100644 Binary files a/mat/solids.mat and b/mat/solids.mat differ diff --git a/mat/stages.mat b/mat/stages.mat index 19e78df..928fc2b 100644 Binary files a/mat/stages.mat and b/mat/stages.mat differ diff --git a/mat/weight_Wxg.mat b/mat/weight_Wxg.mat index b1680cb..a02769c 100644 Binary files a/mat/weight_Wxg.mat and b/mat/weight_Wxg.mat differ diff --git a/micro_station_test.slx b/micro_station_test.slx new file mode 100644 index 0000000..dbf6359 Binary files /dev/null and b/micro_station_test.slx differ