Add inertial sensor on the simscape model. Ident. same as Marc.

The identification now uses inertial sensors.
Also, we compare the identification with the measurement results.
This commit is contained in:
Thomas Dehaeze 2018-06-07 13:49:42 +02:00
parent d59349f5d4
commit 88b903e8d2
4 changed files with 174 additions and 27 deletions

Binary file not shown.

2
Data.m
View File

@ -18,7 +18,7 @@ ground.shape = [2, 2, 0.5]; % m
granite = struct();
granite.m = smiData.Solid(5).mass;
granite.k.ax = 1e10; % x-y-z Stiffness of the granite [N/m]
granite.k.ax = 1e8; % x-y-z Stiffness of the granite [N/m]
granite.ksi.ax = 10;
granite = updateDamping(granite);

View File

@ -0,0 +1,139 @@
%% Script Description
%
%%
clear;
close all;
clc
%% Get Measurement Object
% load('~/ownCloud/Measurements/2017-11-17 - Marc/data/2017_11_17.mat', 'm_object')
load([char(java.lang.System.getProperty('user.home')), '\ownCloud\Measurements\2018-01-12 - Marc\data\2018_01_12_pc.mat'], 'm_object')
%% Get Measurements
% Define Options for measurements
meas_opts = struct( ...
'coh_min', 50, ...
'freq_min', 20 ...
);
measure_dirs = {{'tx', 'tx'}, {'ty', 'ty'}, {'tz', 'tz'}};
% Get measures
measures = getAllMeasure(m_object, 'marble', 'hexa', measure_dirs, meas_opts);
%%
load('../data/id_G_h_h.mat', 'G_h_h');
load('../data/id_G_g_g.mat', 'G_g_g');
load('../data/id_G_h_g.mat', 'G_h_g');
%%
freqs = logspace(-1, 3, 2000);
%% Granite to Granite
figure;
hold on;
plot(measures.Fmx.Dmx.freq_filt, abs(measures.Fmx.Dmx.resp_filt))
plot(freqs, abs(squeeze(freqresp(G_g_g(1, 1), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [$Hz$]'); ylabel('Amplitude [$m/N$]');
legend({'meas.', 'id.'}, 'location', 'northwest');
title('Transfer function: $F(Granite)_x \rightarrow D(granite)_x$');
exportFig('comp_model_meas_Fmx_Dmx');
%
figure;
hold on;
plot(measures.Fmy.Dmy.freq_filt, abs(measures.Fmy.Dmy.resp_filt))
plot(freqs, abs(squeeze(freqresp(G_g_g(2, 2), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [$Hz$]'); ylabel('Amplitude [$m/N$]');
legend({'meas.', 'id.'}, 'location', 'northwest');
title('Transfer function: $F(Granite)_y \rightarrow D(granite)_y$');
exportFig('comp_model_meas_Fmy_Dmy');
%
figure;
hold on;
plot(measures.Fmz.Dmz.freq_filt, abs(measures.Fmz.Dmz.resp_filt))
plot(freqs, abs(squeeze(freqresp(G_g_g(3, 3), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [$Hz$]'); ylabel('Amplitude [$m/N$]');
legend({'meas.', 'id.'}, 'location', 'northwest');
title('Transfer function: $F(Granite)_z \rightarrow D(granite)_z$');
exportFig('comp_model_meas_Fmz_Dmz');
%% Hexapod to Hexapod
figure;
hold on;
plot(measures.Fhx.Dhx.freq_filt, abs(measures.Fhx.Dhx.resp_filt))
plot(freqs, abs(squeeze(freqresp(G_h_h(1, 1), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [$Hz$]'); ylabel('Amplitude [$m/N$]');
legend({'meas.', 'id.'}, 'location', 'northwest');
title('Transfer function: $F(\mu Hexapod)_x \rightarrow D(\mu Hexapod)_x$');
exportFig('comp_model_meas_Fhx_Dhx');
%
figure;
hold on;
plot(measures.Fhy.Dhy.freq_filt, abs(measures.Fhy.Dhy.resp_filt))
plot(freqs, abs(squeeze(freqresp(G_h_h(2, 2), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [$Hz$]'); ylabel('Amplitude [$m/N$]');
legend({'meas.', 'id.'}, 'location', 'northwest');
title('Transfer function: $F(\mu Hexapod)_y \rightarrow D(\mu Hexapod)_y$');
exportFig('comp_model_meas_Fhy_Dhy');
%
figure;
hold on;
plot(measures.Fhz.Dhz.freq_filt, abs(measures.Fhz.Dhz.resp_filt))
plot(freqs, abs(squeeze(freqresp(G_h_h(3, 3), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [$Hz$]'); ylabel('Amplitude [$m/N$]');
legend({'meas.', 'id.'}, 'location', 'northwest');
title('Transfer function: $F(\mu Hexapod)_z \rightarrow D(\mu Hexapod)_z$');
exportFig('comp_model_meas_Fhz_Dhz');
%% Hexapod to Granite
figure;
hold on;
plot(measures.Fhx.Dmx.freq_filt, abs(measures.Fhx.Dmx.resp_filt))
plot(freqs, abs(squeeze(freqresp(G_h_g(1, 1), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [$Hz$]'); ylabel('Amplitude [$m/N$]');
legend({'meas.', 'id.'}, 'location', 'northwest');
title('Transfer function: $F(\mu Hexapod)_x \rightarrow D(Granite)_x$');
exportFig('comp_model_meas_Fhx_Dmx');
%
figure;
hold on;
plot(measures.Fhy.Dmy.freq_filt, abs(measures.Fhy.Dmy.resp_filt))
plot(freqs, abs(squeeze(freqresp(G_h_g(2, 2), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [$Hz$]'); ylabel('Amplitude [$m/N$]');
legend({'meas.', 'id.'}, 'location', 'northwest');
title('Transfer function: $F(\mu Hexapod)_y \rightarrow D(Granite)_y$');
exportFig('comp_model_meas_Fhy_Dmy');
%
figure;
hold on;
plot(measures.Fhz.Dmz.freq_filt, abs(measures.Fhz.Dmz.resp_filt))
plot(freqs, abs(squeeze(freqresp(G_h_g(3, 3), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [$Hz$]'); ylabel('Amplitude [$m/N$]');
legend({'meas.', 'id.'}, 'location', 'northwest');
title('Transfer function: $F(\mu Hexapod)_z \rightarrow D(Granite)_z$');
exportFig('comp_model_meas_Fhz_Dmz');

View File

@ -19,10 +19,6 @@ bode_opts.MagScale = 'log';
bode_opts.PhaseWrapping = 'on';
bode_opts.PhaseVisible = 'on';
%% Options for preprocessing the identified transfer functions
f_low = 10;
f_high = 1000;
%% Options for Linearized
options = linearizeOptions;
options.SampleTime = 0;
@ -33,45 +29,57 @@ mdl = 'Assemblage';
%% Micro-Hexapod
% Input/Output definition
io(1) = linio([mdl, '/Fhexa_cart'],1,'input');
io(2) = linio([mdl, '/Micro_Hexapod'],1,'output');
io(2) = linio([mdl, '/meas_micro_hexapod'],1,'output');
% Run the linearization
G_micro_hexapod_raw = linearize(mdl,io, 0);
% Post-process the linearized function
G_micro_hexapod = preprocessIdTf(G_micro_hexapod_raw, f_low, f_high);
G_h_h = linearize(mdl,io, 0);
G_h_h = G_h_h(1:3, 1:3);
G_h_h = minreal(G_h_h);
% Input/Output names
G_micro_hexapod.InputName = {'Fy'};
G_micro_hexapod.OutputName = {'Dy'};
G_h_h.InputName = {'Fux', 'Fuy', 'Fuz'};
G_h_h.OutputName = {'Dux', 'Duy', 'Duz'};
% Bode Plot of the linearized function
figure;
bode(G_micro_hexapod(1, 1), bode_opts)
bode(G_h_h(1, 1), bode_opts)
%% Granite
% Input/Output definition
io(1) = linio([mdl, '/Granite_F'],1,'input');
io(2) = linio([mdl, '/Granite'],1,'output');
io(2) = linio([mdl, '/meas_granite'],1,'output');
% Run the linearization
G_micro_hexapod_raw = linearize(mdl,io, 0);
% Post-process the linearized function
G_micro_hexapod = preprocessIdTf(G_micro_hexapod_raw, f_low, f_high);
G_g_g = linearize(mdl,io, 0);
G_g_g = minreal(G_g_g);
% Input/Output names
G_micro_hexapod.InputName = {'Fy'};
G_micro_hexapod.OutputName = {'Dy'};
G_g_g.InputName = {'Fgx', 'Fgy', 'Fgz'};
G_g_g.OutputName = {'Dgx', 'Dgy', 'Dgz'};
% Bode Plot of the linearized function
figure;
bode(G_micro_hexapod(1, 1), bode_opts)
bode(G_h_h(2, 2), bode_opts)
%% Micro Hexapod to Granite
% Input/Output definition
io(1) = linio([mdl, '/Fhexa_cart'],1,'input');
io(2) = linio([mdl, '/meas_granite'],1,'output');
%% Functions
function G = preprocessIdTf(G0, f_low, f_high)
[~,G1] = freqsep(G0, 2*pi*f_low);
[G2,~] = freqsep(G1, 2*pi*f_high);
G = minreal(G2);
end
% Run the linearization
G_h_g = linearize(mdl,io, 0);
G_h_g = G_h_g(1:3, 1:3);
G_h_g = minreal(G_h_g);
% Input/Output names
G_h_g.InputName = {'Fhx', 'Fhy', 'Fhz'};
G_h_g.OutputName = {'Dgx', 'Dgy', 'Dgz'};
% Bode Plot of the linearized function
figure;
bode(G_h_g(2, 2), bode_opts)
%%
save('../data/id_G_h_h.mat', 'G_h_h');
save('../data/id_G_g_g.mat', 'G_g_g');
save('../data/id_G_h_g.mat', 'G_h_g');