nass-simscape/identification/id_micro_station_comp_meas.m
Thomas Dehaeze 14259c7e67 [WIP] Change inputs.mat elements
Create new identification simulink
2018-10-12 18:17:03 +02:00

101 lines
2.9 KiB
Matlab

%% 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'}, 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;
linkaxes([ax1,ax2],'x');
if save_fig; exportFig('comp_meas_g_g', 'normal-normal', struct('path', 'identification')); 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;
linkaxes([ax1,ax2],'x');
if save_fig; exportFig('comp_meas_m_m', 'normal-normal', struct('path', 'identification')); 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;
linkaxes([ax1,ax2],'x');
if save_fig; exportFig('comp_meas_m_g', 'normal-normal', struct('path', 'identification')); end