Remove preprocessIdTf. Improve identification scripts

This commit is contained in:
Thomas Dehaeze
2018-10-03 13:55:09 +02:00
parent 223aeae32d
commit 496dd15586
26 changed files with 353 additions and 513 deletions

View File

@@ -1,8 +1,6 @@
function [G, G_raw] = identifyG(opts_param)
%% Default values for opts
opts = struct('f_low', 0.1, ...
'f_high', 10000 ...
);
opts = struct();
%% Populate opts with input parameters
if exist('opts_param','var')
@@ -16,19 +14,15 @@ function [G, G_raw] = identifyG(opts_param)
options.SampleTime = 0;
%% Name of the Simulink File
mdl = 'Micro_Station_Identification';
mdl = 'sim_nano_station';
%% Centralized control (Cartesian coordinates)
% Input/Output definition
io(1) = linio([mdl, '/Micro-Station/Fn'], 1,'input');
io(1) = linio([mdl, '/Micro-Station/Fn'], 1,'openinput');
io(2) = linio([mdl, '/Micro-Station/Sample'],1,'output');
% Run the linearization
G_raw = linearize(mdl,io, 0);
G_raw.InputName = {'Fnx', 'Fny', 'Fnz', 'Mnx', 'Mny', 'Mnz'};
G_raw.OutputName = {'Dx', 'Dy', 'Dz', 'Rx', 'Ry', 'Rz'};
G = preprocessIdTf(G_raw, opts.f_low, opts.f_high);
G = linearize(mdl,io, 0);
G.InputName = {'Fnx', 'Fny', 'Fnz', 'Mnx', 'Mny', 'Mnz'};
G.OutputName = {'Dx', 'Dy', 'Dz', 'Rx', 'Ry', 'Rz'};
end

View File

@@ -1,9 +1,6 @@
function [Gd, Gd_raw] = identifyGd(opts_param)
%% Default values for opts
opts = struct('cl', true, ... % CL or OL
'f_low', 0.1, ...
'f_high', 10000 ...
);
opts = struct('cl', true);
%% Populate opts with input parameters
if exist('opts_param','var')
@@ -18,22 +15,21 @@ function [Gd, Gd_raw] = identifyGd(opts_param)
%% Name of the Simulink File
if opts.cl
% Make sure that the loop is closed
initializeSimConf(struct('cl_time', 0));
mdl = 'Assemblage';
else
mdl = 'Micro_Station_Identification';
mdl = 'sim_nano_station';
end
%% Centralized control (Cartesian coordinates)
% Input/Output definition
io(1) = linio([mdl, '/Micro-Station/Gm'], 1,'input');
io(2) = linio([mdl, '/Micro-Station/Sample'],1,'output');
io(1) = linio([mdl, '/Micro-Station/Gm'], 1,'openinput');
io(2) = linio([mdl, '/Micro-Station/Fs_ext'], 1,'openinput');
io(3) = linio([mdl, '/Micro-Station/Sample'], 1,'output');
% Run the linearization
Gd_raw = linearize(mdl,io, 0);
Gd_raw.InputName = {'Dgx', 'Dgy', 'Dgz'};
Gd_raw.OutputName = {'Dx', 'Dy', 'Dz', 'Rx', 'Ry', 'Rz'};
Gd = preprocessIdTf(Gd_raw, opts.f_low, opts.f_high);
Gd.InputName = {'Dgx', 'Dgy', 'Dgz'};
Gd = linearize(mdl,io, 0);
Gd.InputName = {'Dgx', 'Dgy', 'Dgz', 'Fsx', 'Fsy', 'Fsz'};
Gd.OutputName = {'Dx', 'Dy', 'Dz', 'Rx', 'Ry', 'Rz'};
end

View File

@@ -1,8 +1,6 @@
function [G_cart, G_cart_raw] = identifyNass(opts_param)
%% Default values for opts
opts = struct('f_low', 1,...
'f_high', 10000 ...
);
opts = struct();
%% Populate opts with input parameters
if exist('opts_param','var')
@@ -16,17 +14,15 @@ function [G_cart, G_cart_raw] = identifyNass(opts_param)
options.SampleTime = 0;
%% Name of the Simulink File
mdl = 'Micro_Station_Identification';
mdl = 'sim_nano_station';
%% Centralized control (Cartesian coordinates)
% Input/Output definition
io(1) = linio([mdl, '/Micro-Station/Fn'], 1,'input');
io(2) = linio([mdl, '/Micro-Station/Nano_Hexapod'],1,'output');
io(1) = linio([mdl, '/Micro-Station/Fn'], 1, 'openinput');
io(2) = linio([mdl, '/Micro-Station/Nano_Hexapod'], 1, 'output');
% Run the linearization
G_cart_raw = linearize(mdl,io, 0);
G_cart = preprocessIdTf(G_cart_raw, opts.f_low, opts.f_high);
G_cart = linearize(mdl,io, 0);
% Input/Output names
G_cart.InputName = {'Fnx', 'Fny', 'Fnz', 'Mnx', 'Mny', 'Mnz'};

View File

@@ -1,5 +0,0 @@
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