[major changes] Add some control on the system

Add many scripts to:
- define all the inputs for various experiments
- plot the time and frequency data
- identify the plant
This commit is contained in:
Thomas Dehaeze
2018-06-07 18:27:02 +02:00
parent 1335f23dc5
commit 5587309cfa
23 changed files with 309 additions and 12 deletions

View File

@@ -23,9 +23,9 @@ measure_dirs = {{'tx', 'tx'}, {'ty', 'ty'}, {'tz', 'tz'}};
measures = getAllMeasure(m_object, 'marble', 'hexa', measure_dirs, meas_opts);
%%
load('../data/id_G_h_h.mat', 'G_h_h');
load('../data/id_G_g_g.mat', 'G_g_g');
load('../data/id_G_h_g.mat', 'G_h_g');
load('../mat/id_G_h_h.mat', 'G_h_h');
load('../mat/id_G_g_g.mat', 'G_g_g');
load('../mat/id_G_h_g.mat', 'G_h_g');
%%
freqs = logspace(-1, 3, 2000);

View File

@@ -0,0 +1,48 @@
%% Script Description
%
%%
clear;
close all;
clc
%% Define options for bode plots
bode_opts = bodeoptions;
bode_opts.Title.FontSize = 12;
bode_opts.XLabel.FontSize = 12;
bode_opts.YLabel.FontSize = 12;
bode_opts.FreqUnits = 'Hz';
bode_opts.MagUnits = 'abs';
bode_opts.MagScale = 'log';
bode_opts.PhaseWrapping = 'on';
bode_opts.PhaseVisible = 'on';
%% Options for preprocessing the identified transfer functions
f_low = 10;
f_high = 1000;
%% Options for Linearized
options = linearizeOptions;
options.SampleTime = 0;
%% Name of the Simulink File
mdl = 'Assemblage';
%% Y-Translation Stage
% Input/Output definition
io(1) = linio([mdl, '/Fnass_cart'],1,'input');
io(2) = linio([mdl, '/Sample'],1,'output');
% Run the linearization
G_f_to_d = linearize(mdl,io, 0);
% Input/Output names
G_f_to_d.InputName = {'Fy'};
G_f_to_d.OutputName = {'Dy'};
% Bode Plot of the linearized function
figure;
bode(G_f_to_d(2, 2), bode_opts)
%%
save('../mat/G_f_to_d.mat', 'G_f_to_d');

View File

@@ -80,6 +80,6 @@ figure;
bode(G_h_g(2, 2), bode_opts)
%%
save('../data/id_G_h_h.mat', 'G_h_h');
save('../data/id_G_g_g.mat', 'G_g_g');
save('../data/id_G_h_g.mat', 'G_h_g');
save('../mat/id_G_h_h.mat', 'G_h_h');
save('../mat/id_G_g_g.mat', 'G_g_g');
save('../mat/id_G_h_g.mat', 'G_h_g');

View File

@@ -19,7 +19,7 @@ bode_opts.PhaseWrapping = 'on';
bode_opts.PhaseVisible = 'off';
%% Load Data
load('./data/identified_tf.mat');
load('../mat/identified_tf.mat');
%% Y-Translation Stage
figure;

View File

@@ -128,7 +128,7 @@ figure;
bode(G_nass, bode_opts)
%% Save all transfer function
save('./data/identified_tf.mat', 'G_ty', 'G_ry', 'G_rz', 'G_hexa', 'G_nass')
save('../mat/identified_tf.mat', 'G_ty', 'G_ry', 'G_rz', 'G_hexa', 'G_nass')
%% Functions
function G = preprocessIdTf(G0, f_low, f_high)