Add metrology element (change of base, computation of error)
Lot's of new things: - try to use less .mat files - computation of setpoint and error in the cartesian frame fixed to the granite - change of base to have the errors w.r.t. the NASS base - add script to plot setpoint, position and error
This commit is contained in:
55
identification/id_flexible_rigid.m
Normal file
55
identification/id_flexible_rigid.m
Normal file
@@ -0,0 +1,55 @@
|
||||
%% Script Description
|
||||
% Determine if we take into account the flexibilities,
|
||||
% does that changes a lot
|
||||
|
||||
%%
|
||||
clear; close all; clc;
|
||||
|
||||
%% Initialize all the stage by default
|
||||
run init_data.m
|
||||
|
||||
%% Options for Linearized
|
||||
options = linearizeOptions;
|
||||
options.SampleTime = 0;
|
||||
|
||||
%% Name of the Simulink File
|
||||
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/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
|
||||
initializeTy();
|
||||
|
||||
G_ms_flexible = linearize(mdl, io, 0);
|
||||
|
||||
% Input/Output names
|
||||
G_ms_flexible.InputName = {'Fmx', 'Fmy', 'Fmz',...
|
||||
'Fgx', 'Fgy', 'Fgz'};
|
||||
G_ms_flexible.OutputName = {'Dmx', 'Dmy', 'Dmz', ...
|
||||
'Tyx', 'Tyy', 'Tyz', ...
|
||||
'Ryx', 'Ryy', 'Ryz', ...
|
||||
'Dgx', 'Dgy', 'Dgz'};
|
||||
|
||||
%% Run the linearization
|
||||
initializeTy(struct('rigid', true));
|
||||
|
||||
G_ms_ty_rigid = linearize(mdl, io, 0);
|
||||
|
||||
% Input/Output names
|
||||
G_ms_ty_rigid.InputName = {'Fmx', 'Fmy', 'Fmz',...
|
||||
'Fgx', 'Fgy', 'Fgz'};
|
||||
G_ms_ty_rigid.OutputName = {'Dmx', 'Dmy', 'Dmz', ...
|
||||
'Tyx', 'Tyy', 'Tyz', ...
|
||||
'Ryx', 'Ryy', 'Ryz', ...
|
||||
'Dgx', 'Dgy', 'Dgz'};
|
||||
|
||||
%% Save the obtained transfer functions
|
||||
save('./mat/id_micro_station_flexibility.mat', 'G_ms_flexible', 'G_ms_ty_rigid');
|
99
identification/id_flexible_rigid_plots.m
Normal file
99
identification/id_flexible_rigid_plots.m
Normal file
@@ -0,0 +1,99 @@
|
||||
%% Script Description
|
||||
% Determine if we take into account the flexibilities,
|
||||
% does that changes a lot
|
||||
|
||||
%%
|
||||
clear; close all; clc;
|
||||
|
||||
%% Load Configuration file
|
||||
load('./mat/config.mat', 'save_fig', 'freqs');
|
||||
|
||||
%% Load the obtained transfer functions
|
||||
load('./mat/id_micro_station_flexibility.mat', 'G_ms_flexible', 'G_ms_ty_rigid');
|
||||
|
||||
%% Get Measurement Object
|
||||
load('2018_01_12.mat', 'm_object');
|
||||
|
||||
% Get Measurements Data
|
||||
opts = struct('freq_min', 10, 'est_backend', 'idfrd');
|
||||
meas_sys = getDynamicTFs(m_object, 'marble', 'hexa', {{'tx', 'tx'},{'ty', 'ty'},{'tz', 'tz'}}, opts);
|
||||
|
||||
%%
|
||||
dir = 'y';
|
||||
|
||||
figure;
|
||||
% Amplitude
|
||||
ax1 = subaxis(2,1,1);
|
||||
hold on;
|
||||
plot(freqs, abs(squeeze(freqresp(G_ms_flexible(['Dg' dir], ['Fg' dir]), freqs, 'Hz'))));
|
||||
plot(freqs, abs(squeeze(freqresp(G_ms_ty_rigid(['Dg' dir], ['Fg' dir]), freqs, 'Hz'))), '--');
|
||||
set(gca,'xscale','log'); set(gca,'yscale','log');
|
||||
ylabel('Amplitude [m/N]');
|
||||
set(gca, 'XTickLabel',[]);
|
||||
legend({'Flexible', 'Ty - Rigid'});
|
||||
hold off;
|
||||
% Phase
|
||||
ax2 = subaxis(2,1,2);
|
||||
hold on;
|
||||
plot(freqs, 180/pi*angle(squeeze(freqresp(G_ms_flexible(['Dg' dir], ['Fg' dir]), freqs, 'Hz'))));
|
||||
plot(freqs, 180/pi*angle(squeeze(freqresp(G_ms_ty_rigid(['Dg' dir], ['Fg' dir]), freqs, 'Hz'))), '--');
|
||||
set(gca,'xscale','log');
|
||||
ylim([-180, 180]);
|
||||
yticks([-180, -90, 0, 90, 180]);
|
||||
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
|
||||
hold off;
|
||||
linkaxes([ax1,ax2],'x');
|
||||
|
||||
%%
|
||||
dir = 'y';
|
||||
|
||||
figure;
|
||||
% Amplitude
|
||||
ax1 = subaxis(2,1,1);
|
||||
hold on;
|
||||
plot(freqs, abs(squeeze(freqresp(G_ms_flexible(['Dm' dir], ['Fm' dir]), freqs, 'Hz'))));
|
||||
plot(freqs, abs(squeeze(freqresp(G_ms_ty_rigid(['Dm' dir], ['Fm' dir]), freqs, 'Hz'))), '--');
|
||||
set(gca,'xscale','log'); set(gca,'yscale','log');
|
||||
ylabel('Amplitude [m/N]');
|
||||
set(gca, 'XTickLabel',[]);
|
||||
legend({'Flexible', 'Ty - Rigid'});
|
||||
hold off;
|
||||
% Phase
|
||||
ax2 = subaxis(2,1,2);
|
||||
hold on;
|
||||
plot(freqs, 180/pi*angle(squeeze(freqresp(G_ms_flexible(['Dm' dir], ['Fm' dir]), freqs, 'Hz'))));
|
||||
plot(freqs, 180/pi*angle(squeeze(freqresp(G_ms_ty_rigid(['Dm' dir], ['Fm' dir]), freqs, 'Hz'))), '--');
|
||||
set(gca,'xscale','log');
|
||||
ylim([-180, 180]);
|
||||
yticks([-180, -90, 0, 90, 180]);
|
||||
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
|
||||
hold off;
|
||||
linkaxes([ax1,ax2],'x');
|
||||
|
||||
%%
|
||||
dir = 'z';
|
||||
|
||||
figure;
|
||||
% Amplitude
|
||||
ax1 = subaxis(2,1,1);
|
||||
hold on;
|
||||
plot(freqs, abs(squeeze(freqresp(G_ms_flexible(['Dg' dir], ['Fm' dir]), freqs, 'Hz'))));
|
||||
plot(freqs, abs(squeeze(freqresp(G_ms_ty_rigid(['Dg' dir], ['Fm' dir]), freqs, 'Hz'))), '--');
|
||||
plot(freqs, abs(squeeze(freqresp(meas_sys(['Dm' dir], ['Fh' dir]), freqs, 'Hz'))), '.');
|
||||
set(gca,'xscale','log'); set(gca,'yscale','log');
|
||||
ylabel('Amplitude [m/N]');
|
||||
set(gca, 'XTickLabel',[]);
|
||||
legend({'Flexible', 'Ty - Rigid'});
|
||||
hold off;
|
||||
% Phase
|
||||
ax2 = subaxis(2,1,2);
|
||||
hold on;
|
||||
plot(freqs, 180/pi*angle(squeeze(freqresp(G_ms_flexible(['Dg' dir], ['Fm' dir]), freqs, 'Hz'))));
|
||||
plot(freqs, 180/pi*angle(squeeze(freqresp(G_ms_ty_rigid(['Dg' dir], ['Fm' dir]), freqs, 'Hz'))), '--');
|
||||
plot(freqs, 180/pi*angle(squeeze(freqresp(meas_sys(['Dm' dir], ['Fh' dir]), freqs, 'Hz'))), '.');
|
||||
set(gca,'xscale','log');
|
||||
ylim([-180, 180]);
|
||||
yticks([-180, -90, 0, 90, 180]);
|
||||
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
|
||||
hold off;
|
||||
linkaxes([ax1,ax2],'x');
|
@@ -16,85 +16,90 @@ load('2018_01_12.mat', 'm_object');
|
||||
|
||||
%% Get Measurements Data
|
||||
opts = struct('freq_min', 10, 'est_backend', 'idfrd');
|
||||
meas_sys = getDynamicTFs(m_object, 'marble', 'hexa', {'tx', 'tx'}, opts);
|
||||
meas_sys = getDynamicTFs(m_object, 'marble', 'hexa', {{'tx', 'tx'},{'ty', 'ty'},{'tz', 'tz'}}, opts);
|
||||
|
||||
%% Granite to Granite
|
||||
figure;
|
||||
% Amplitude
|
||||
ax1 = subaxis(2,1,1);
|
||||
hold on;
|
||||
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]');
|
||||
set(gca, 'XTickLabel',[]);
|
||||
legend({'Model', 'Meas.'});
|
||||
hold off;
|
||||
% Phase
|
||||
ax2 = subaxis(2,1,2);
|
||||
hold on;
|
||||
plot(freqs, 180/pi*angle(squeeze(freqresp(G_ms('Dgz', 'Fgz'), freqs, 'Hz'))));
|
||||
plot(freqs, 180/pi*angle(squeeze(freqresp(meas_sys('Dmx', 'Fmx'), freqs, 'Hz'))), '.');
|
||||
set(gca,'xscale','log');
|
||||
ylim([-180, 180]);
|
||||
yticks([-180, -90, 0, 90, 180]);
|
||||
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
|
||||
hold off;
|
||||
for dir = 'xyz'
|
||||
figure;
|
||||
% Amplitude
|
||||
ax1 = subaxis(2,1,1);
|
||||
hold on;
|
||||
plot(freqs, abs(squeeze(freqresp(G_ms(['Dg' dir], ['Fg' dir]), freqs, 'Hz'))));
|
||||
plot(freqs, abs(squeeze(freqresp(meas_sys(['Dm' dir], ['Fm' dir]), freqs, 'Hz'))), '.');
|
||||
set(gca,'xscale','log'); set(gca,'yscale','log');
|
||||
ylabel('Amplitude [m/N]');
|
||||
set(gca, 'XTickLabel',[]);
|
||||
legend({'Model', 'Meas.'});
|
||||
hold off;
|
||||
% Phase
|
||||
ax2 = subaxis(2,1,2);
|
||||
hold on;
|
||||
plot(freqs, 180/pi*angle(squeeze(freqresp(G_ms(['Dg' dir], ['Fg' dir]), freqs, 'Hz'))));
|
||||
plot(freqs, 180/pi*angle(squeeze(freqresp(meas_sys(['Dm' dir], ['Fm' dir]), freqs, 'Hz'))), '.');
|
||||
set(gca,'xscale','log');
|
||||
ylim([-180, 180]);
|
||||
yticks([-180, -90, 0, 90, 180]);
|
||||
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
|
||||
hold off;
|
||||
linkaxes([ax1,ax2],'x');
|
||||
|
||||
linkaxes([ax1,ax2],'x');
|
||||
|
||||
if save_fig; exportFig('comp_meas_g_g', 'normal-normal', struct('path', 'identification')); end
|
||||
if save_fig; exportFig(['comp_meas_g_g_' dir], 'normal-normal', struct('path', 'identification')); end
|
||||
end
|
||||
|
||||
%% Hexapod to Hexapod
|
||||
figure;
|
||||
% Amplitude
|
||||
ax1 = subaxis(2,1,1);
|
||||
hold on;
|
||||
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]');
|
||||
set(gca, 'XTickLabel',[]);
|
||||
legend({'Model', 'Meas.'});
|
||||
hold off;
|
||||
% Phase
|
||||
ax2 = subaxis(2,1,2);
|
||||
hold on;
|
||||
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]);
|
||||
yticks([-180, -90, 0, 90, 180]);
|
||||
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
|
||||
hold off;
|
||||
for dir = 'xyz'
|
||||
figure;
|
||||
% Amplitude
|
||||
ax1 = subaxis(2,1,1);
|
||||
hold on;
|
||||
plot(freqs, abs(squeeze(freqresp(G_ms(['Dm' dir], ['Fm' dir]), freqs, 'Hz'))));
|
||||
plot(freqs, abs(squeeze(freqresp(meas_sys(['Dh' dir], ['Fh' dir]), freqs, 'Hz'))), '.');
|
||||
set(gca,'xscale','log'); set(gca,'yscale','log');
|
||||
ylabel('Amplitude [m/N]');
|
||||
set(gca, 'XTickLabel',[]);
|
||||
legend({'Model', 'Meas.'});
|
||||
hold off;
|
||||
% Phase
|
||||
ax2 = subaxis(2,1,2);
|
||||
hold on;
|
||||
plot(freqs, 180/pi*angle(squeeze(freqresp(G_ms(['Dm' dir], ['Fm' dir]), freqs, 'Hz'))));
|
||||
plot(freqs, 180/pi*angle(squeeze(freqresp(meas_sys(['Dh' dir], ['Fh' dir]), freqs, 'Hz'))), '.');
|
||||
set(gca,'xscale','log');
|
||||
ylim([-180, 180]);
|
||||
yticks([-180, -90, 0, 90, 180]);
|
||||
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
|
||||
hold off;
|
||||
|
||||
linkaxes([ax1,ax2],'x');
|
||||
|
||||
if save_fig; exportFig('comp_meas_m_m', 'normal-normal', struct('path', 'identification')); end
|
||||
linkaxes([ax1,ax2],'x');
|
||||
|
||||
if save_fig; exportFig(['comp_meas_m_m_' dir], 'normal-normal', struct('path', 'identification')); end
|
||||
end
|
||||
|
||||
%% Hexapod to Granite
|
||||
figure;
|
||||
% Amplitude
|
||||
ax1 = subaxis(2,1,1);
|
||||
hold on;
|
||||
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]');
|
||||
set(gca, 'XTickLabel',[]);
|
||||
legend({'Model', 'Meas.'});
|
||||
hold off;
|
||||
% Phase
|
||||
ax2 = subaxis(2,1,2);
|
||||
hold on;
|
||||
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]);
|
||||
yticks([-180, -90, 0, 90, 180]);
|
||||
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
|
||||
hold off;
|
||||
for dir = 'xyz'
|
||||
figure;
|
||||
% Amplitude
|
||||
ax1 = subaxis(2,1,1);
|
||||
hold on;
|
||||
plot(freqs, abs(squeeze(freqresp(G_ms(['Dm' dir], ['Fg' dir]), freqs, 'Hz'))));
|
||||
plot(freqs, abs(squeeze(freqresp(meas_sys(['Dh' dir], ['Fm' dir]), freqs, 'Hz'))), '.');
|
||||
set(gca,'xscale','log'); set(gca,'yscale','log');
|
||||
ylabel('Amplitude [m/N]');
|
||||
set(gca, 'XTickLabel',[]);
|
||||
legend({'Model', 'Meas.'});
|
||||
hold off;
|
||||
% Phase
|
||||
ax2 = subaxis(2,1,2);
|
||||
hold on;
|
||||
plot(freqs, 180/pi*angle(squeeze(freqresp(G_ms(['Dm' dir], ['Fg' dir]), freqs, 'Hz'))));
|
||||
plot(freqs, 180/pi*angle(squeeze(freqresp(meas_sys(['Dh' dir], ['Fm' dir]), freqs, 'Hz'))), '.');
|
||||
set(gca,'xscale','log');
|
||||
ylim([-180, 180]);
|
||||
yticks([-180, -90, 0, 90, 180]);
|
||||
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
|
||||
hold off;
|
||||
|
||||
linkaxes([ax1,ax2],'x');
|
||||
linkaxes([ax1,ax2],'x');
|
||||
|
||||
if save_fig; exportFig('comp_meas_m_g', 'normal-normal', struct('path', 'identification')); end
|
||||
if save_fig; exportFig(['comp_meas_m_g_' dir], 'normal-normal', struct('path', 'identification')); end
|
||||
end
|
||||
|
@@ -3,7 +3,7 @@ clear; close all; clc;
|
||||
|
||||
%%
|
||||
K_iff = tf(zeros(6));
|
||||
save('./mat/K_iff.mat', 'K_iff');
|
||||
save('./mat/controllers.mat', 'K_iff', '-append');
|
||||
|
||||
%% Light Sample
|
||||
initializeSample(struct('mass', 1));
|
||||
|
Binary file not shown.
Reference in New Issue
Block a user