Update all the functions

This commit is contained in:
Thomas Dehaeze 2019-12-06 12:03:34 +01:00
parent 7032f05ef5
commit f73becd5c9
27 changed files with 111 additions and 184 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,12 +1,12 @@
% computePsdDispl % computePsdDispl
% :PROPERTIES: % :PROPERTIES:
% :header-args:matlab+: :tangle src/computePsdDispl.m % :header-args:matlab+: :tangle ../src/computePsdDispl.m
% :header-args:matlab+: :comments org :mkdirp yes % :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none % :header-args:matlab+: :eval no :results none
% :END: % :END:
% <<sec:computePsdDispl>> % <<sec:computePsdDispl>>
% This Matlab function is accessible [[file:src/computePsdDispl.m][here]]. % This Matlab function is accessible [[file:../src/computePsdDispl.m][here]].
function [psd_object] = computePsdDispl(sys_data, t_init, n_av) function [psd_object] = computePsdDispl(sys_data, t_init, n_av)

View File

@ -1,12 +1,12 @@
% computeSetpoint % computeSetpoint
% :PROPERTIES: % :PROPERTIES:
% :header-args:matlab+: :tangle src/computeSetpoint.m % :header-args:matlab+: :tangle ../src/computeSetpoint.m
% :header-args:matlab+: :comments org :mkdirp yes % :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none % :header-args:matlab+: :eval no :results none
% :END: % :END:
% <<sec:computeSetpoint>> % <<sec:computeSetpoint>>
% This Matlab function is accessible [[file:src/computeSetpoint.m][here]]. % This Matlab function is accessible [[file:../src/computeSetpoint.m][here]].
function setpoint = computeSetpoint(ty, ry, rz) function setpoint = computeSetpoint(ty, ry, rz)

View File

@ -1,12 +1,12 @@
% converErrorBasis % converErrorBasis
% :PROPERTIES: % :PROPERTIES:
% :header-args:matlab+: :tangle src/converErrorBasis.m % :header-args:matlab+: :tangle ../src/converErrorBasis.m
% :header-args:matlab+: :comments org :mkdirp yes % :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none % :header-args:matlab+: :eval no :results none
% :END: % :END:
% <<sec:converErrorBasis>> % <<sec:converErrorBasis>>
% This Matlab function is accessible [[file:src/converErrorBasis.m][here]]. % This Matlab function is accessible [[file:../src/converErrorBasis.m][here]].
function error_nass = convertErrorBasis(pos, setpoint, ty, ry, rz) function error_nass = convertErrorBasis(pos, setpoint, ty, ry, rz)

View File

@ -1,12 +1,12 @@
% generateDiagPidControl % generateDiagPidControl
% :PROPERTIES: % :PROPERTIES:
% :header-args:matlab+: :tangle src/generateDiagPidControl.m % :header-args:matlab+: :tangle ../src/generateDiagPidControl.m
% :header-args:matlab+: :comments org :mkdirp yes % :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none % :header-args:matlab+: :eval no :results none
% :END: % :END:
% <<sec:generateDiagPidControl>> % <<sec:generateDiagPidControl>>
% This Matlab function is accessible [[file:src/generateDiagPidControl.m][here]]. % This Matlab function is accessible [[file:../src/generateDiagPidControl.m][here]].
function [K] = generateDiagPidControl(G, fs) function [K] = generateDiagPidControl(G, fs)

View File

@ -1,19 +0,0 @@
% Simulation Initialization
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/init_simulation.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:init_simulation>>
% This Matlab script is accessible [[file:../src/init_simulation.m][here]].
% This script runs just before the simulation is started.
% It is used to load the simulation configuration and the controllers used for the simulation.
%% Load all the data used for the simulation
load('sim_conf.mat');
%% Load Controller
load('controllers.mat');

View File

@ -25,8 +25,8 @@ function [cedrat] = initializeCedratPiezo(opts_param)
cedrat.k = 10e7; % Linear Stiffness of each "blade" [N/m] cedrat.k = 10e7; % Linear Stiffness of each "blade" [N/m]
cedrat.ka = 10e7; % Linear Stiffness of the stack [N/m] cedrat.ka = 10e7; % Linear Stiffness of the stack [N/m]
cedrat.c = 0.1*sqrt(50*cedrat.k); % [N/(m/s)] cedrat.c = 0.1*sqrt(1*cedrat.k); % [N/(m/s)]
cedrat.ca = 0.1*sqrt(50*cedrat.ka); % [N/(m/s)] cedrat.ca = 0.1*sqrt(1*cedrat.ka); % [N/(m/s)]
cedrat.L = 80; % Total Width of the Actuator[mm] cedrat.L = 80; % Total Width of the Actuator[mm]
cedrat.H = 45; % Total Height of the Actuator [mm] cedrat.H = 45; % Total Height of the Actuator [mm]

View File

@ -11,12 +11,6 @@
function [] = initializeExperiment(exp_name, sys_mass) function [] = initializeExperiment(exp_name, sys_mass)
if strcmp(exp_name, 'tomography') if strcmp(exp_name, 'tomography')
opts_sim = struct(...
'Tsim', 5, ...
'cl_time', 5 ...
);
initializeSimConf(opts_sim);
if strcmp(sys_mass, 'light') if strcmp(sys_mass, 'light')
opts_inputs = struct(... opts_inputs = struct(...
'Dw', true, ... 'Dw', true, ...

View File

@ -1,4 +1,4 @@
% Inputs % TODO Inputs
% :PROPERTIES: % :PROPERTIES:
% :header-args:matlab+: :tangle ../src/initializeInputs.m % :header-args:matlab+: :tangle ../src/initializeInputs.m
% :header-args:matlab+: :comments org :mkdirp yes % :header-args:matlab+: :comments org :mkdirp yes
@ -6,6 +6,8 @@
% :END: % :END:
% <<sec:initializeInputs>> % <<sec:initializeInputs>>
% - [ ] *This function should not be used anymore*. Now there are two functions to initialize disturbances and references.
% This Matlab function is accessible [[file:../src/initializeInputs.m][here]]. % This Matlab function is accessible [[file:../src/initializeInputs.m][here]].

View File

@ -1,44 +0,0 @@
% Simulation Configuration
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/initializeSimConf.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:initializeSimConf>>
% This Matlab function is accessible [[file:../src/initializeSimConf.m][here]].
function [] = initializeSimConf(opts_param)
%% Default values for opts
opts = struct('Ts', 1e-4, ... % Sampling time [s]
'Tsim', 10, ... % Simulation time [s]
'cl_time', 0, ... % Close Loop time [s]
'gravity', false ... % Gravity along the z axis
);
%% Populate opts with input parameters
if exist('opts_param','var')
for opt = fieldnames(opts_param)'
opts.(opt{1}) = opts_param.(opt{1});
end
end
%%
sim_conf = struct();
%%
sim_conf.Ts = opts.Ts;
sim_conf.Tsim = opts.Tsim;
sim_conf.cl_time = opts.cl_time;
%% Gravity
if opts.gravity
sim_conf.g = -9.8; %#ok
else
sim_conf.g = 0; %#ok
end
%% Save
save('./mat/sim_conf.mat', 'sim_conf');
end

View File

@ -3,12 +3,6 @@
% When the project opens, a startup script is ran. % When the project opens, a startup script is ran.
% The startup script is defined below and is exported to the =project_startup.m= script. % The startup script is defined below and is exported to the =project_startup.m= script.
%%
freqs = logspace(-1, 3, 1000);
save_fig = false;
save('./mat/config.mat', 'freqs', 'save_fig');
%%
project = simulinkproject; project = simulinkproject;
projectRoot = project.RootFolder; projectRoot = project.RootFolder;

View File

@ -1,12 +1,12 @@
% runSimulation % runSimulation
% :PROPERTIES: % :PROPERTIES:
% :header-args:matlab+: :tangle src/runSimulation.m % :header-args:matlab+: :tangle ../src/runSimulation.m
% :header-args:matlab+: :comments org :mkdirp yes % :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none % :header-args:matlab+: :eval no :results none
% :END: % :END:
% <<sec:runSimulation>> % <<sec:runSimulation>>
% This Matlab function is accessible [[file:src/runSimulation.m][here]]. % This Matlab function is accessible [[file:../src/runSimulation.m][here]].
function [] = runSimulation(sys_name, sys_mass, ctrl_type, act_damp) function [] = runSimulation(sys_name, sys_mass, ctrl_type, act_damp)