Change the way control is generated. Add script to test control

This commit is contained in:
Thomas Dehaeze
2018-06-21 11:45:02 +02:00
parent 156dd833bd
commit 601078cdab
7 changed files with 159 additions and 15 deletions

39
src/identifyGd.m Normal file
View File

@@ -0,0 +1,39 @@
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 ...
);
%% Populate opts with input parameters
if exist('opts_param','var')
for opt = fieldnames(opts_param)'
opts.(opt{1}) = opts_param.(opt{1});
end
end
%% Options for Linearized
options = linearizeOptions;
options.SampleTime = 0;
%% Name of the Simulink File
if opts.cl
mdl = 'Assemblage';
else
mdl = 'Micro_Station_Identification';
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');
% 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.OutputName = {'Dx', 'Dy', 'Dz', 'Rx', 'Ry', 'Rz'};
end