[WIP] Change inputs.mat elements
Create new identification simulink
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -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;
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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]);
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+3
-8
@@ -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');
|
||||
|
||||
@@ -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');
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
function [] = initializeAxisc()
|
||||
function [axisc] = initializeAxisc()
|
||||
%%
|
||||
axisc = struct();
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
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.
Binary file not shown.
Reference in New Issue
Block a user