diff --git a/identification/matlab-old/id_G_cart_plots.m b/identification/matlab-old/id_G_cart_plots.m deleted file mode 100644 index c315252..0000000 --- a/identification/matlab-old/id_G_cart_plots.m +++ /dev/null @@ -1,115 +0,0 @@ -%% -clear; close all; clc; - -%% Load the transfer functions -load('./mat/G.mat', 'G_light_vc', 'G_light_pz', 'G_heavy_vc', 'G_heavy_pz'); - -%% Load Configuration file -load('./mat/config.mat', 'save_fig', 'freqs'); - -%% Plant -figure; -% Amplitude -ax1 = subplot(2,1,1); -hold on; -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_cart('Dx', 'Fnx'), freqs, 'Hz')))); -plot(freqs, abs(squeeze(freqresp(G_light_pz.G_cart('Dx', 'Fnx'), freqs, 'Hz')))); -set(gca,'ColorOrderIndex',1); -plot(freqs, abs(squeeze(freqresp(G_heavy_vc.G_cart('Dx', 'Fnx'), freqs, 'Hz'))), '--'); -plot(freqs, abs(squeeze(freqresp(G_heavy_pz.G_cart('Dx', 'Fnx'), freqs, 'Hz'))), '--'); -set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); -set(gca, 'XTickLabel',[]); -ylabel('Amplitude [m/N]'); -hold off; - -% Phase -ax2 = subplot(2,1,2); -hold on; -plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_vc.G_cart('Dx', 'Fnx'), freqs, 'Hz'))), 'DisplayName', 'VC - Light'); -plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_pz.G_cart('Dx', 'Fnx'), freqs, 'Hz'))), 'DisplayName', 'PZ - Light'); -set(gca,'ColorOrderIndex',1) -plot(freqs, 180/pi*angle(squeeze(freqresp(G_heavy_vc.G_cart('Dx', 'Fnx'), freqs, 'Hz'))), '--', 'DisplayName', 'VC - Heavy'); -plot(freqs, 180/pi*angle(squeeze(freqresp(G_heavy_pz.G_cart('Dx', 'Fnx'), freqs, 'Hz'))), '--', 'DisplayName', 'PZ - Heavy'); -set(gca,'xscale','log'); -yticks(-1800:90:1800); -ylim([-180 180]); -xlabel('Frequency [Hz]'); ylabel('Phase [deg]'); -legend('Location', 'southwest'); -hold off; - -linkaxes([ax1,ax2],'x'); - -if save_fig; exportFig('comp_models_plant_x_x', 'normal-normal', struct('path', 'identification')); end - -%% -figure; -% Amplitude -ax1 = subplot(2,1,1); -hold on; -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_cart('Dz', 'Fnz'), freqs, 'Hz')))); -plot(freqs, abs(squeeze(freqresp(G_light_pz.G_cart('Dz', 'Fnz'), freqs, 'Hz')))); -set(gca,'ColorOrderIndex',1); -plot(freqs, abs(squeeze(freqresp(G_heavy_vc.G_cart('Dz', 'Fnz'), freqs, 'Hz'))), '--'); -plot(freqs, abs(squeeze(freqresp(G_heavy_pz.G_cart('Dz', 'Fnz'), freqs, 'Hz'))), '--'); -set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); -set(gca, 'XTickLabel',[]); -ylabel('Amplitude [m/N]'); -hold off; - -% Phase -ax2 = subplot(2,1,2); -hold on; -plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_vc.G_cart('Dz', 'Fnz'), freqs, 'Hz'))), 'DisplayName', 'VC - Light'); -plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_pz.G_cart('Dz', 'Fnz'), freqs, 'Hz'))), 'DisplayName', 'PZ - Light'); -set(gca,'ColorOrderIndex',1) -plot(freqs, 180/pi*angle(squeeze(freqresp(G_heavy_vc.G_cart('Dz', 'Fnz'), freqs, 'Hz'))), '--', 'DisplayName', 'VC - Heavy'); -plot(freqs, 180/pi*angle(squeeze(freqresp(G_heavy_pz.G_cart('Dz', 'Fnz'), freqs, 'Hz'))), '--', 'DisplayName', 'PZ - Heavy'); -set(gca,'xscale','log'); -yticks(-1800:90:1800); -ylim([-180 180]); -xlabel('Frequency [Hz]'); ylabel('Phase [deg]'); -legend('Location', 'southwest'); -hold off; - -linkaxes([ax1,ax2],'x'); - -if save_fig; exportFig('comp_models_plant_z_z', 'normal-normal', struct('path', 'identification')); end - -%% Plot all the coupling -figure; - -for i_input = 1:3 - for i_output = 1:3 - subplot(3,3,3*(i_input-1)+i_output); - hold on; - plot(freqs, abs(squeeze(freqresp(G_light_vc.G_cart(i_output, i_input), freqs, 'Hz')))); - plot(freqs, abs(squeeze(freqresp(G_light_pz.G_cart(i_output, i_input), freqs, 'Hz')))); - set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); - xlim([freqs(1) freqs(end)]); ylim([1e-12, 1e-2]); - yticks([1e-12, 1e-8, 1e-4]); xticks([0.1 1 10 100 1000]); - if i_output > 1; set(gca,'yticklabel',[]); end - if i_input < 3; set(gca,'xticklabel',[]); end - hold off; - end -end - -if save_fig; exportFig('comp_models_plant_coupling_all', 'full-tall', struct('path', 'identification')); end - -%% Plot some coupling -figure; -hold on; -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_cart('Dx', 'Fnx'), freqs, 'Hz'))), 'DisplayName', 'VC - Light - $Fx \to Dx$'); -plot(freqs, abs(squeeze(freqresp(G_light_pz.G_cart('Dx', 'Fnx'), freqs, 'Hz'))), 'DisplayName', 'PZ - Light - $Fx \to Dx$'); -set(gca,'ColorOrderIndex',1); -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_cart('Dy', 'Fnx'), freqs, 'Hz'))), '--', 'DisplayName', 'VC - Heavy - $Fx \to Dy$'); -plot(freqs, abs(squeeze(freqresp(G_light_pz.G_cart('Dy', 'Fnx'), freqs, 'Hz'))), '--', 'DisplayName', 'PZ - Heavy - $Fx \to Dy$'); -set(gca,'ColorOrderIndex',1); -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_cart('Dz', 'Fnx'), freqs, 'Hz'))), '-.', 'DisplayName', 'VC - Heavy - $Fx \to Dz$'); -plot(freqs, abs(squeeze(freqresp(G_light_pz.G_cart('Dz', 'Fnx'), freqs, 'Hz'))), '-.', 'DisplayName', 'PZ - Heavy - $Fx \to Dz$'); -set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); -xlabel('Frequency [Hz]'); ylabel('Amplitude [m/m]'); -legend('Location', 'southwest'); -xticks('manual'); xlim([freqs(1) freqs(end)]); -hold off; - -if save_fig; exportFig('comp_models_plant_coupling', 'normal-normal', struct('path', 'identification')); end diff --git a/identification/matlab-old/id_G_d_plots.m b/identification/matlab-old/id_G_d_plots.m deleted file mode 100644 index f8b97a8..0000000 --- a/identification/matlab-old/id_G_d_plots.m +++ /dev/null @@ -1,77 +0,0 @@ -%% -clear; close all; clc; - -%% Load the identified transfer functions -load('./mat/G.mat', 'G_light_vc', 'G_light_pz', 'G_heavy_vc', 'G_heavy_pz'); - -%% Load Configuration file -load('./mat/config.mat', 'save_fig', 'freqs'); - -%% Transfer function from ground displacement to measured displacement -figure; -hold on; -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_dg('Dz', 'Dgz'), freqs, 'Hz'))), 'DisplayName', 'VC - Light'); -plot(freqs, abs(squeeze(freqresp(G_light_pz.G_dg('Dz', 'Dgz'), freqs, 'Hz'))), 'DisplayName', 'PZ - Light'); -set(gca,'ColorOrderIndex',1); -plot(freqs, abs(squeeze(freqresp(G_heavy_vc.G_dg('Dz', 'Dgz'), freqs, 'Hz'))), '--', 'DisplayName', 'VC - Heavy'); -plot(freqs, abs(squeeze(freqresp(G_heavy_pz.G_dg('Dz', 'Dgz'), freqs, 'Hz'))), '--', 'DisplayName', 'PZ - Heavy'); -set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); -ylabel('Amplitude [m/m]'); -hold off; -legend('Location', 'southwest'); - -if save_fig; exportFig('comp_models_xw_to_d', 'normal-normal', struct('path', 'identification')); end - -%% -figure; -hold on; -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_dg('Dx', 'Dgx'), freqs, 'Hz'))), 'DisplayName', 'VC - Light'); -plot(freqs, abs(squeeze(freqresp(G_light_pz.G_dg('Dx', 'Dgx'), freqs, 'Hz'))), 'DisplayName', 'PZ - Light'); -set(gca,'ColorOrderIndex',1); -plot(freqs, abs(squeeze(freqresp(G_heavy_vc.G_dg('Dx', 'Dgx'), freqs, 'Hz'))), '--', 'DisplayName', 'VC - Heavy'); -plot(freqs, abs(squeeze(freqresp(G_heavy_pz.G_dg('Dx', 'Dgx'), freqs, 'Hz'))), '--', 'DisplayName', 'PZ - Heavy'); -set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); -ylabel('Amplitude [m/m]'); -hold off; -legend('Location', 'southwest'); - -%% Transfer function from direct force to measured displacement -figure; -hold on; -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_fs('Dz', 'Fsz'), freqs, 'Hz'))), 'DisplayName', 'VC - Light'); -plot(freqs, abs(squeeze(freqresp(G_light_pz.G_fs('Dz', 'Fsz'), freqs, 'Hz'))), 'DisplayName', 'PZ - Light'); -set(gca,'ColorOrderIndex',1); -plot(freqs, abs(squeeze(freqresp(G_heavy_vc.G_fs('Dz', 'Fsz'), freqs, 'Hz'))), '--', 'DisplayName', 'VC - Heavy'); -plot(freqs, abs(squeeze(freqresp(G_heavy_pz.G_fs('Dz', 'Fsz'), freqs, 'Hz'))), '--', 'DisplayName', 'PZ - Heavy'); -set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); -ylabel('Amplitude [m/N]'); -hold off; -legend('Location', 'southwest'); - -if save_fig; exportFig('comp_models_fi_to_d', 'normal-normal', struct('path', 'identification')); end - -%% -figure; -hold on; -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_fs('Ry', 'Fsx'), freqs, 'Hz'))), 'DisplayName', 'VC - Light'); -plot(freqs, abs(squeeze(freqresp(G_light_pz.G_fs('Ry', 'Fsx'), freqs, 'Hz'))), 'DisplayName', 'PZ - Light'); -set(gca,'ColorOrderIndex',1); -plot(freqs, abs(squeeze(freqresp(G_heavy_vc.G_fs('Ry', 'Fsx'), freqs, 'Hz'))), '--', 'DisplayName', 'VC - Heavy'); -plot(freqs, abs(squeeze(freqresp(G_heavy_pz.G_fs('Ry', 'Fsx'), freqs, 'Hz'))), '--', 'DisplayName', 'PZ - Heavy'); -set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); -ylabel('Amplitude [m/N]'); -hold off; -legend('Location', 'southwest'); - -%% -figure; -hold on; -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_fs('Rz', 'Fsx'), freqs, 'Hz'))), 'DisplayName', 'VC - Light'); -plot(freqs, abs(squeeze(freqresp(G_light_pz.G_fs('Rz', 'Fsx'), freqs, 'Hz'))), 'DisplayName', 'PZ - Light'); -set(gca,'ColorOrderIndex',1); -plot(freqs, abs(squeeze(freqresp(G_heavy_vc.G_fs('Rz', 'Fsx'), freqs, 'Hz'))), '--', 'DisplayName', 'VC - Heavy'); -plot(freqs, abs(squeeze(freqresp(G_heavy_pz.G_fs('Rz', 'Fsx'), freqs, 'Hz'))), '--', 'DisplayName', 'PZ - Heavy'); -set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); -ylabel('Amplitude [m/N]'); -hold off; -legend('Location', 'southwest'); \ No newline at end of file diff --git a/identification/matlab-old/id_G_iff_plots.m b/identification/matlab-old/id_G_iff_plots.m deleted file mode 100644 index 2c0e6d9..0000000 --- a/identification/matlab-old/id_G_iff_plots.m +++ /dev/null @@ -1,57 +0,0 @@ -%% -clear; close all; clc; - -%% Load the identified transfer functions -load('./mat/G.mat', 'G_light_vc', 'G_light_pz', 'G_heavy_vc', 'G_heavy_pz'); - -%% Load Configuration file -load('./mat/config.mat', 'save_fig', 'freqs'); - -%% -figure; -% Amplitude -ax1 = subplot(2,1,1); -hold on; -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_iff('Fm1', 'F1'), freqs, 'Hz')))); -plot(freqs, abs(squeeze(freqresp(G_light_pz.G_iff('Fm1', 'F1'), freqs, 'Hz')))); -set(gca,'ColorOrderIndex',1); -plot(freqs, abs(squeeze(freqresp(G_heavy_vc.G_iff('Fm1', 'F1'), freqs, 'Hz'))), '--'); -plot(freqs, abs(squeeze(freqresp(G_heavy_pz.G_iff('Fm1', 'F1'), freqs, 'Hz'))), '--'); -set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); -set(gca, 'XTickLabel',[]); -ylabel('Amplitude [m/N]'); -hold off; - -% Phase -ax2 = subplot(2,1,2); -hold on; -plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_vc.G_iff('Fm1', 'F1'), freqs, 'Hz'))), 'DisplayName', 'VC - Light'); -plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_pz.G_iff('Fm1', 'F1'), freqs, 'Hz'))), 'DisplayName', 'PZ - Light'); -set(gca,'ColorOrderIndex',1) -plot(freqs, 180/pi*angle(squeeze(freqresp(G_heavy_vc.G_iff('Fm1', 'F1'), freqs, 'Hz'))), '--', 'DisplayName', 'VC - Heavy'); -plot(freqs, 180/pi*angle(squeeze(freqresp(G_heavy_pz.G_iff('Fm1', 'F1'), freqs, 'Hz'))), '--', 'DisplayName', 'PZ - Heavy'); -set(gca,'xscale','log'); -yticks(-180:90:180); -ylim([-180 180]); -xlabel('Frequency [Hz]'); ylabel('Phase [deg]'); -legend('Location', 'southwest'); -hold off; - -linkaxes([ax1,ax2],'x'); - -if save_fig; exportFig('G_iff', 'normal-normal', struct('path', 'identification')); end - -%% Coupling -figure; -hold on; -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_iff('Fm1', 'F1'), freqs, 'Hz'))), 'k-'); -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_iff('Fm2', 'F1'), freqs, 'Hz'))), 'k--'); -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_iff('Fm3', 'F1'), freqs, 'Hz'))), 'k--'); -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_iff('Fm4', 'F1'), freqs, 'Hz'))), 'k--'); -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_iff('Fm5', 'F1'), freqs, 'Hz'))), 'k--'); -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_iff('Fm6', 'F1'), freqs, 'Hz'))), 'k--'); -set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); -ylabel('Amplitude [m/N]'); xlabel('Frequency [Hz]'); -hold off; - -if save_fig; exportFig('G_iff_coupling', 'normal-normal', struct('path', 'identification')); end diff --git a/identification/matlab-old/id_flexible_rigid.m b/identification/matlab-old/id_flexible_rigid.m deleted file mode 100644 index 2c1d40e..0000000 --- a/identification/matlab-old/id_flexible_rigid.m +++ /dev/null @@ -1,55 +0,0 @@ -%% 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 = 'sim_micro_station_id'; - -%% 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'); diff --git a/identification/matlab-old/id_flexible_rigid_plots.m b/identification/matlab-old/id_flexible_rigid_plots.m deleted file mode 100644 index 9e6dbaf..0000000 --- a/identification/matlab-old/id_flexible_rigid_plots.m +++ /dev/null @@ -1,99 +0,0 @@ -%% 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 = subplot(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 = subplot(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 = subplot(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 = subplot(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 = subplot(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 = subplot(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'); diff --git a/identification/matlab-old/id_main.m b/identification/matlab-old/id_main.m deleted file mode 100644 index 6be661e..0000000 --- a/identification/matlab-old/id_main.m +++ /dev/null @@ -1,42 +0,0 @@ -%% -clear; close all; clc; - -%% Identification of the micro-station -% Compute the transfer functions -run id_micro_station.m - -% Plot de obtained transfer functions -run id_micro_station_plots.m - -% Compare the measurements of Marc with the model -run id_micro_station_comp_meas.m - -%% Identification of the nano-station -% Run the identification -run id_nano_station.m - -% Plot the plant for feedback control -run id_G_cart_plots.m - -% Plot the transfer function from disturbances to displacement -run id_G_d_plots.m - -% Plot the transfer function for IFF control -run id_G_iff_plots.m - -%% Identification of all the stages -% Compute the transfer functions of each stage from act. to sens. -run id_stages.m - -% Plot de obtained transfer functions -run id_stages_plots.m - -%% Identification of the variation of the plant -run id_plant_variation.m - -run id_plant_variation_plots.m - -%% Study the effect of the flexibility of each Stage -run id_flexible_rigid.m - -run id_flexible_rigid_plots.m diff --git a/identification/matlab-old/id_micro_station.m b/identification/matlab-old/id_micro_station.m deleted file mode 100644 index 47cc310..0000000 --- a/identification/matlab-old/id_micro_station.m +++ /dev/null @@ -1,37 +0,0 @@ -%% Script Description -% Make the same identification as Marc did -% Should comment out the nano-hexapod and sample before -% runing this script. - -%% -clear; close all; clc; - -%% Options for Linearized -options = linearizeOptions; -options.SampleTime = 0; - -%% Name of the Simulink File -mdl = 'sim_micro_station_id'; - -%% 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 -G_ms = linearize(mdl, io, 0); - -% Input/Output names -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/matlab-old/id_micro_station_comp_meas.m b/identification/matlab-old/id_micro_station_comp_meas.m deleted file mode 100644 index 3956426..0000000 --- a/identification/matlab-old/id_micro_station_comp_meas.m +++ /dev/null @@ -1,105 +0,0 @@ -%% Script Description -% Compare identification from the Simscape model -% with the identification on the real system. - -%% -clear; close all; clc; - -%% Load the obtained transfer functions -load('./mat/id_micro_station.mat', 'G_ms'); - -%% Load Configuration file -load('./mat/config.mat', 'save_fig', 'freqs'); - -%% 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); - -%% Granite to Granite -for dir = 'xyz' - figure; - % Amplitude - ax1 = subplot(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 = subplot(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'); - - if save_fig; exportFig(['comp_meas_g_g_' dir], 'normal-normal', struct('path', 'identification')); end -end - -%% Hexapod to Hexapod -for dir = 'xyz' - figure; - % Amplitude - ax1 = subplot(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 = subplot(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_' dir], 'normal-normal', struct('path', 'identification')); end -end - -%% Hexapod to Granite -for dir = 'xyz' - figure; - % Amplitude - ax1 = subplot(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 = subplot(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'); - - if save_fig; exportFig(['comp_meas_m_g_' dir], 'normal-normal', struct('path', 'identification')); end -end diff --git a/identification/matlab-old/id_micro_station_plots.m b/identification/matlab-old/id_micro_station_plots.m deleted file mode 100644 index 23d16d4..0000000 --- a/identification/matlab-old/id_micro_station_plots.m +++ /dev/null @@ -1,29 +0,0 @@ -%% -clear; close all; clc; - -%% Load the obtained transfer functions -load('./mat/id_micro_station.mat', 'G_ms'); - -%% Load Configuration file -load('./mat/config.mat', 'save_fig', 'freqs'); - -%% Micro-Hexapod -bodeFig({G_ms('Dmx', 'Fmx'), G_ms('Dmy', 'Fmy'), G_ms('Dmz', 'Fmz')}, freqs) -legend({'$F_{hx} \to D_{hx}$', '$F_{hy} \to D_{hy}$', '$F_{hz} \to D_{hz}$'}) -legend('location', 'southwest') - -if save_fig; exportFig('id_marc_m_m', 'normal-normal', struct('path', 'identification')); end - -%% Granite -bodeFig({G_ms('Dgx', 'Fgx'), G_ms('Dgy', 'Fgy'), G_ms('Dgz', 'Fgz')}, freqs) -legend({'$F_{gx} \to D_{gx}$', '$F_{gy} \to D_{gy}$', '$F_{gz} \to D_{gz}$'}) -legend('location', 'southwest') - -if save_fig; exportFig('id_marc_g_g', 'normal-normal', struct('path', 'identification')); end - -%% Micro Hexapod to Granite -bodeFig({G_ms('Dmx', 'Fgx'), G_ms('Dmy', 'Fgy'), G_ms('Dmz', 'Fgz')}, freqs) -legend({'$F_{hx} \to D_{gx}$', '$F_{hy} \to D_{gy}$', '$F_{hz} \to D_{gz}$'}) -legend('location', 'southwest') - -if save_fig; exportFig('id_marc_m_g', 'normal-normal', struct('path', 'identification')); end diff --git a/identification/matlab-old/id_nano_station.m b/identification/matlab-old/id_nano_station.m deleted file mode 100644 index ac5d3ed..0000000 --- a/identification/matlab-old/id_nano_station.m +++ /dev/null @@ -1,30 +0,0 @@ -%% -clear; close all; clc; - -%% -K = tf(zeros(6)); -K_iff = tf(zeros(6)); -save('./mat/controllers.mat', 'K', 'K_iff', '-append'); - -initializeInputs(); - -%% Light Sample -initializeSample(struct('mass', 1)); - -initializeNanoHexapod(struct('actuator', 'lorentz')); -G_light_vc = identifyPlant(); - -initializeNanoHexapod(struct('actuator', 'piezo')); -G_light_pz = identifyPlant(); - -%% Heavy Sample -initializeSample(struct('mass', 50)); - -initializeNanoHexapod(struct('actuator', 'lorentz')); -G_heavy_vc = identifyPlant(); - -initializeNanoHexapod(struct('actuator', 'piezo')); -G_heavy_pz = identifyPlant(); - -%% Save the obtained transfer functions -save('./mat/G.mat', 'G_light_vc', 'G_light_pz', 'G_heavy_vc', 'G_heavy_pz'); diff --git a/identification/matlab-old/id_plant_variation.m b/identification/matlab-old/id_plant_variation.m deleted file mode 100644 index de06306..0000000 --- a/identification/matlab-old/id_plant_variation.m +++ /dev/null @@ -1,28 +0,0 @@ -%% -clear; close all; clc; - -%% -K = tf(zeros(6)); -K_iff = tf(zeros(6)); -save('./mat/controllers.mat', 'K', 'K_iff', '-append'); - -%% Light Sample -initializeSample(struct('mass', 50)); -initializeNanoHexapod(struct('actuator', 'piezo')); - -%% Vertical Configuration -initializeInputs(); -G_vert_init = identifyPlant(); - -initializeInputs(struct('Rz', 90)); -G_vert_turn = identifyPlant(); - -%% Tilted configuration -initializeInputs(struct('Ry', 3)); -G_tilt_init = identifyPlant(); - -initializeInputs(struct('Ry', 3, 'Rz', 90)); -G_tilt_turn = identifyPlant(); - -%% Save -save('./mat/id_plant_variation.mat', 'G_vert_init', 'G_vert_turn', 'G_tilt_init', 'G_tilt_turn') diff --git a/identification/matlab-old/id_plant_variation_plots.m b/identification/matlab-old/id_plant_variation_plots.m deleted file mode 100644 index 7f8f360..0000000 --- a/identification/matlab-old/id_plant_variation_plots.m +++ /dev/null @@ -1,24 +0,0 @@ -%% -clear; close all; clc; - -%% Load -load('./mat/id_plant_variation.mat', 'G_vert_init', 'G_vert_turn', 'G_tilt_init', 'G_tilt_turn') - -%% -bodeFig({G_vert_init.G_dleg(1, 1), ... - G_vert_init.G_dleg(2, 2), ... - G_vert_init.G_dleg(3, 3), ... - G_vert_init.G_dleg(4, 4), ... - G_vert_init.G_dleg(5, 5), ... - G_vert_init.G_dleg(6, 6)}, struct('phase', true)); -xlim([1, 500]); - -%% -bodeFig({G_vert_init.G_dleg(1, 1), ... - G_vert_turn.G_dleg(1, 1),}, struct('phase', true)); -xlim([1, 500]); - -%% -bodeFig({G_vert_init.G_dleg(1, 1), ... - G_tilt_init.G_dleg(1, 1),}, struct('phase', true)); -xlim([1, 500]); diff --git a/identification/matlab-old/id_stages.m b/identification/matlab-old/id_stages.m deleted file mode 100644 index 92362fa..0000000 --- a/identification/matlab-old/id_stages.m +++ /dev/null @@ -1,79 +0,0 @@ -%% Script Description -% Run an identification of each stage from input to output -% Save all computed transfer functions into one .mat file - -%% -clear; close all; clc; - -%% -initializeSample(struct('mass', 20)); - -%% Options for Linearized -options = linearizeOptions; -options.SampleTime = 0; - -%% Name of the Simulink File -mdl = 'sim_nano_station_id'; - -%% Y-Translation Stage -% Input/Output definition -io(1) = linio([mdl, '/Micro-Station/Fy'], 1,'openinput'); -io(2) = linio([mdl, '/Micro-Station/Translation y'],1,'output'); - -% Run the linearization -G_ty = linearize(mdl,io, 0); - -% Input/Output names -G_ty.InputName = {'Fy'}; -G_ty.OutputName = {'Dy'}; - -%% Tilt Stage -% Input/Output definition -io(1) = linio([mdl, '/Micro-Station/Ry'], 1,'openinput'); -io(2) = linio([mdl, '/Micro-Station/Tilt'],1,'output'); - -% Run the linearization -G_ry = linearize(mdl,io, 0); - -% Input/Output names -G_ry.InputName = {'My'}; -G_ry.OutputName = {'Ry'}; - -%% Spindle -% Input/Output definition -io(1) = linio([mdl, '/Micro-Station/Rz'], 1,'openinput'); -io(2) = linio([mdl, '/Micro-Station/Spindle'],1,'output'); - -% Run the linearization -G_rz = linearize(mdl,io, 0); - -% Input/Output names -G_rz.InputName = {'Mz'}; -G_rz.OutputName = {'Rz'}; - -%% Hexapod Symetrie -% Input/Output definition -io(1) = linio([mdl, '/Micro-Station/Fm'], 1,'openinput'); -io(2) = linio([mdl, '/Micro-Station/Micro_Hexapod'],1,'output'); - -% Run the linearization -G_hexa = linearize(mdl,io, 0); - -% Input/Output names -G_hexa.InputName = {'Fhexa_x', 'Fhexa_y', 'Fhexa_z', 'Mhexa_x', 'Mhexa_y', 'Mhexa_z'}; -G_hexa.OutputName = {'Dhexa_x', 'Dhexa_y', 'Dhexa_z', 'Rhexa_x', 'Rhexa_y', 'Rhexa_z'}; - -%% NASS -% Input/Output definition -io(1) = linio([mdl, '/Micro-Station/Fn'], 1,'openinput'); -io(2) = linio([mdl, '/Micro-Station/Nano_Hexapod'],1,'output'); - -% Run the linearization -G_nass = linearize(mdl,io, 0); - -% Input/Output names -G_nass.InputName = {'Fnass_x', 'Fnass_y', 'Fnass_z', 'Mnass_x', 'Mnass_y', 'Mnass_z'}; -G_nass.OutputName = {'Dnass_x', 'Dnass_y', 'Dnass_z', 'Rnass_x', 'Rnass_y', 'Rnass_z'}; - -%% Save all transfer function -save('./mat/identified_tf.mat', 'G_ty', 'G_ry', 'G_rz', 'G_hexa', 'G_nass') diff --git a/identification/matlab-old/id_stages_plots.m b/identification/matlab-old/id_stages_plots.m deleted file mode 100644 index 6389bf3..0000000 --- a/identification/matlab-old/id_stages_plots.m +++ /dev/null @@ -1,50 +0,0 @@ -%% Script Description -% From the identification, plot all the -% transfer funcions. - -%% -clear; close all; clc - -%% Load Data -load('./mat/identified_tf.mat', 'G_ty', 'G_ry', 'G_rz', 'G_hexa', 'G_nass'); - -%% Y-Translation Stage -bodeFig({G_ty}, struct('phase', true)) -legend({'$F_{y} \to D_{y}$'}) -exportFig('id_ty', 'normal-normal', struct('path', 'identification')) - -%% Tilt Stage -bodeFig({G_ry}, struct('phase', true)) -legend({'$M_{y} \to R_{y}$'}) -exportFig('id_ry', 'normal-normal', struct('path', 'identification')) - -%% Spindle -bodeFig({G_rz}, struct('phase', true)) -legend({'$M_{z} \to R_{z}$'}) -exportFig('id_ry', 'normal-normal', struct('path', 'identification')) - -%% Hexapod Symetrie -bodeFig({G_hexa(1, 1), G_hexa(2, 2), G_hexa(3, 3)}, struct('phase', true)) -legend({'$F_{h_x} \to D_{h_x}$', '$F_{h_y} \to D_{h_y}$', '$F_{h_z} \to D_{h_z}$'}) -exportFig('id_hexapod_trans', 'normal-normal', struct('path', 'identification')) - -bodeFig({G_hexa(4, 4), G_hexa(5, 5), G_hexa(6, 6)}, struct('phase', true)) -legend({'$M_{h_x} \to R_{h_x}$', '$M_{h_y} \to R_{h_y}$', '$M_{h_z} \to R_{h_z}$'}) -exportFig('id_hexapod_rot', 'normal-normal', struct('path', 'identification')) - -bodeFig({G_hexa(1, 1), G_hexa(2, 1), G_hexa(3, 1)}, struct('phase', true)) -legend({'$F_{h_x} \to D_{h_x}$', '$F_{h_x} \to D_{h_y}$', '$F_{h_x} \to D_{h_z}$'}) -exportFig('id_hexapod_coupling', 'normal-normal', struct('path', 'identification')) - -%% NASS -bodeFig({G_nass(1, 1), G_nass(2, 2), G_nass(3, 3)}, struct('phase', true)) -legend({'$F_{n_x} \to D_{n_x}$', '$F_{n_y} \to D_{n_y}$', '$F_{n_z} \to D_{n_z}$'}) -exportFig('id_nass_trans', 'normal-normal', struct('path', 'identification')) - -bodeFig({G_nass(4, 4), G_nass(5, 5), G_nass(6, 6)}, struct('phase', true)) -legend({'$M_{n_x} \to R_{n_x}$', '$M_{n_y} \to R_{n_y}$', '$M_{n_z} \to R_{n_z}$'}) -exportFig('id_nass_rot', 'normal-normal', struct('path', 'identification')) - -bodeFig({G_nass(1, 1), G_nass(2, 1), G_nass(3, 1)}, struct('phase', true)) -legend({'$F_{n_x} \to D_{n_x}$', '$F_{n_x} \to D_{n_y}$', '$F_{n_x} \to D_{n_z}$'}) -exportFig('id_nass_coupling', 'normal-normal', struct('path', 'identification'))