diff --git a/mat/K_fb.mat b/mat/K_fb.mat index d08aaed..d8f0750 100644 Binary files a/mat/K_fb.mat and b/mat/K_fb.mat differ diff --git a/mat/config.mat b/mat/config.mat index fb46783..b7c98d8 100644 Binary files a/mat/config.mat and b/mat/config.mat differ diff --git a/mat/controllers.mat b/mat/controllers.mat index 28d2766..53615cb 100644 Binary files a/mat/controllers.mat and b/mat/controllers.mat differ diff --git a/mat/inputs.mat b/mat/inputs.mat index dcef1fd..8e74795 100644 Binary files a/mat/inputs.mat and b/mat/inputs.mat differ diff --git a/mat/perturbations.mat b/mat/perturbations.mat index 6606250..bdc319c 100644 Binary files a/mat/perturbations.mat and b/mat/perturbations.mat differ diff --git a/mat/stages.mat b/mat/stages.mat index 561cf2c..7503010 100644 Binary files a/mat/stages.mat and b/mat/stages.mat differ diff --git a/src/computePsdDispl.m b/src/computePsdDispl.m index aa97514..786f96e 100644 --- a/src/computePsdDispl.m +++ b/src/computePsdDispl.m @@ -1,12 +1,12 @@ % computePsdDispl % :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+: :eval no :results none % :END: % <> -% 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) diff --git a/src/computeSetpoint.m b/src/computeSetpoint.m index df69a3d..5c0f92e 100644 --- a/src/computeSetpoint.m +++ b/src/computeSetpoint.m @@ -1,12 +1,12 @@ % computeSetpoint % :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+: :eval no :results none % :END: % <> -% 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) diff --git a/src/converErrorBasis.m b/src/converErrorBasis.m index 3a33109..b8b6321 100644 --- a/src/converErrorBasis.m +++ b/src/converErrorBasis.m @@ -1,12 +1,12 @@ % converErrorBasis % :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+: :eval no :results none % :END: % <> -% 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) diff --git a/src/generateDiagPidControl.m b/src/generateDiagPidControl.m index 406eea8..f2a71fe 100644 --- a/src/generateDiagPidControl.m +++ b/src/generateDiagPidControl.m @@ -1,12 +1,12 @@ % generateDiagPidControl % :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+: :eval no :results none % :END: % <> -% 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) diff --git a/src/init_simulation.m b/src/init_simulation.m deleted file mode 100644 index f271b41..0000000 --- a/src/init_simulation.m +++ /dev/null @@ -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: -% <> - -% 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'); diff --git a/src/initializeAxisc.m b/src/initializeAxisc.m index e5e0bd8..8e1d4b1 100644 --- a/src/initializeAxisc.m +++ b/src/initializeAxisc.m @@ -1,10 +1,10 @@ % Center of gravity compensation -% :PROPERTIES: -% :header-args:matlab+: :tangle ../src/initializeAxisc.m -% :header-args:matlab+: :comments org :mkdirp yes -% :header-args:matlab+: :eval no :results none -% :END: -% <> +% :PROPERTIES: +% :header-args:matlab+: :tangle ../src/initializeAxisc.m +% :header-args:matlab+: :comments org :mkdirp yes +% :header-args:matlab+: :eval no :results none +% :END: +% <> % This Matlab function is accessible [[file:../src/initializeAxisc.m][here]]. diff --git a/src/initializeCedratPiezo.m b/src/initializeCedratPiezo.m index 60d4285..6441f1a 100644 --- a/src/initializeCedratPiezo.m +++ b/src/initializeCedratPiezo.m @@ -1,10 +1,10 @@ % Cedrat Actuator -% :PROPERTIES: -% :header-args:matlab+: :tangle ../src/initializeCedratPiezo.m -% :header-args:matlab+: :comments org :mkdirp yes -% :header-args:matlab+: :eval no :results none -% :END: -% <> +% :PROPERTIES: +% :header-args:matlab+: :tangle ../src/initializeCedratPiezo.m +% :header-args:matlab+: :comments org :mkdirp yes +% :header-args:matlab+: :eval no :results none +% :END: +% <> % This Matlab function is accessible [[file:../src/initializeCedratPiezo.m][here]]. @@ -25,8 +25,8 @@ function [cedrat] = initializeCedratPiezo(opts_param) cedrat.k = 10e7; % Linear Stiffness of each "blade" [N/m] cedrat.ka = 10e7; % Linear Stiffness of the stack [N/m] - cedrat.c = 0.1*sqrt(50*cedrat.k); % [N/(m/s)] - cedrat.ca = 0.1*sqrt(50*cedrat.ka); % [N/(m/s)] + cedrat.c = 0.1*sqrt(1*cedrat.k); % [N/(m/s)] + cedrat.ca = 0.1*sqrt(1*cedrat.ka); % [N/(m/s)] cedrat.L = 80; % Total Width of the Actuator[mm] cedrat.H = 45; % Total Height of the Actuator [mm] diff --git a/src/initializeExperiment.m b/src/initializeExperiment.m index 3f2f01f..1857f4a 100644 --- a/src/initializeExperiment.m +++ b/src/initializeExperiment.m @@ -1,22 +1,16 @@ % Experiment -% :PROPERTIES: -% :header-args:matlab+: :tangle ../src/initializeExperiment.m -% :header-args:matlab+: :comments org :mkdirp yes -% :header-args:matlab+: :eval no :results none -% :END: -% <> +% :PROPERTIES: +% :header-args:matlab+: :tangle ../src/initializeExperiment.m +% :header-args:matlab+: :comments org :mkdirp yes +% :header-args:matlab+: :eval no :results none +% :END: +% <> % This Matlab function is accessible [[file:../src/initializeExperiment.m][here]]. function [] = initializeExperiment(exp_name, sys_mass) if strcmp(exp_name, 'tomography') - opts_sim = struct(... - 'Tsim', 5, ... - 'cl_time', 5 ... - ); - initializeSimConf(opts_sim); - if strcmp(sys_mass, 'light') opts_inputs = struct(... 'Dw', true, ... diff --git a/src/initializeGranite.m b/src/initializeGranite.m index 657a701..0eae77f 100644 --- a/src/initializeGranite.m +++ b/src/initializeGranite.m @@ -1,10 +1,10 @@ % Granite -% :PROPERTIES: -% :header-args:matlab+: :tangle ../src/initializeGranite.m -% :header-args:matlab+: :comments org :mkdirp yes -% :header-args:matlab+: :eval no :results none -% :END: -% <> +% :PROPERTIES: +% :header-args:matlab+: :tangle ../src/initializeGranite.m +% :header-args:matlab+: :comments org :mkdirp yes +% :header-args:matlab+: :eval no :results none +% :END: +% <> % This Matlab function is accessible [[file:../src/initializeGranite.m][here]]. diff --git a/src/initializeGround.m b/src/initializeGround.m index a4d17f1..a10aac2 100644 --- a/src/initializeGround.m +++ b/src/initializeGround.m @@ -1,10 +1,10 @@ % Ground -% :PROPERTIES: -% :header-args:matlab+: :tangle ../src/initializeGround.m -% :header-args:matlab+: :comments org :mkdirp yes -% :header-args:matlab+: :eval no :results none -% :END: -% <> +% :PROPERTIES: +% :header-args:matlab+: :tangle ../src/initializeGround.m +% :header-args:matlab+: :comments org :mkdirp yes +% :header-args:matlab+: :eval no :results none +% :END: +% <> % This Matlab function is accessible [[file:../src/initializeGround.m][here]]. diff --git a/src/initializeInputs.m b/src/initializeInputs.m index 3417fce..3b7b31e 100644 --- a/src/initializeInputs.m +++ b/src/initializeInputs.m @@ -1,10 +1,12 @@ -% Inputs -% :PROPERTIES: -% :header-args:matlab+: :tangle ../src/initializeInputs.m -% :header-args:matlab+: :comments org :mkdirp yes -% :header-args:matlab+: :eval no :results none -% :END: -% <> +% TODO Inputs +% :PROPERTIES: +% :header-args:matlab+: :tangle ../src/initializeInputs.m +% :header-args:matlab+: :comments org :mkdirp yes +% :header-args:matlab+: :eval no :results none +% :END: +% <> + +% - [ ] *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]]. diff --git a/src/initializeMicroHexapod.m b/src/initializeMicroHexapod.m index f78609d..47c3c9d 100644 --- a/src/initializeMicroHexapod.m +++ b/src/initializeMicroHexapod.m @@ -1,10 +1,10 @@ % Micro Hexapod -% :PROPERTIES: -% :header-args:matlab+: :tangle ../src/initializeMicroHexapod.m -% :header-args:matlab+: :comments org :mkdirp yes -% :header-args:matlab+: :eval no :results none -% :END: -% <> +% :PROPERTIES: +% :header-args:matlab+: :tangle ../src/initializeMicroHexapod.m +% :header-args:matlab+: :comments org :mkdirp yes +% :header-args:matlab+: :eval no :results none +% :END: +% <> % This Matlab function is accessible [[file:../src/initializeMicroHexapod.m][here]]. diff --git a/src/initializeMirror.m b/src/initializeMirror.m index 8e7b7f4..4f280ee 100644 --- a/src/initializeMirror.m +++ b/src/initializeMirror.m @@ -1,10 +1,10 @@ % Mirror -% :PROPERTIES: -% :header-args:matlab+: :tangle ../src/initializeMirror.m -% :header-args:matlab+: :comments org :mkdirp yes -% :header-args:matlab+: :eval no :results none -% :END: -% <> +% :PROPERTIES: +% :header-args:matlab+: :tangle ../src/initializeMirror.m +% :header-args:matlab+: :comments org :mkdirp yes +% :header-args:matlab+: :eval no :results none +% :END: +% <> % This Matlab function is accessible [[file:../src/initializeMirror.m][here]]. diff --git a/src/initializeNanoHexapod.m b/src/initializeNanoHexapod.m index 0c8682e..846289e 100644 --- a/src/initializeNanoHexapod.m +++ b/src/initializeNanoHexapod.m @@ -1,10 +1,10 @@ % Nano Hexapod -% :PROPERTIES: -% :header-args:matlab+: :tangle ../src/initializeNanoHexapod.m -% :header-args:matlab+: :comments org :mkdirp yes -% :header-args:matlab+: :eval no :results none -% :END: -% <> +% :PROPERTIES: +% :header-args:matlab+: :tangle ../src/initializeNanoHexapod.m +% :header-args:matlab+: :comments org :mkdirp yes +% :header-args:matlab+: :eval no :results none +% :END: +% <> % This Matlab function is accessible [[file:../src/initializeNanoHexapod.m][here]]. diff --git a/src/initializeRy.m b/src/initializeRy.m index 821cd5b..eb88acd 100644 --- a/src/initializeRy.m +++ b/src/initializeRy.m @@ -1,10 +1,10 @@ % Tilt Stage -% :PROPERTIES: -% :header-args:matlab+: :tangle ../src/initializeRy.m -% :header-args:matlab+: :comments org :mkdirp yes -% :header-args:matlab+: :eval no :results none -% :END: -% <> +% :PROPERTIES: +% :header-args:matlab+: :tangle ../src/initializeRy.m +% :header-args:matlab+: :comments org :mkdirp yes +% :header-args:matlab+: :eval no :results none +% :END: +% <> % This Matlab function is accessible [[file:../src/initializeRy.m][here]]. diff --git a/src/initializeRz.m b/src/initializeRz.m index c2c456b..c33dd8b 100644 --- a/src/initializeRz.m +++ b/src/initializeRz.m @@ -1,10 +1,10 @@ % Spindle -% :PROPERTIES: -% :header-args:matlab+: :tangle ../src/initializeRz.m -% :header-args:matlab+: :comments org :mkdirp yes -% :header-args:matlab+: :eval no :results none -% :END: -% <> +% :PROPERTIES: +% :header-args:matlab+: :tangle ../src/initializeRz.m +% :header-args:matlab+: :comments org :mkdirp yes +% :header-args:matlab+: :eval no :results none +% :END: +% <> % This Matlab function is accessible [[file:../src/initializeRz.m][here]]. diff --git a/src/initializeSample.m b/src/initializeSample.m index 9b7676b..f950007 100644 --- a/src/initializeSample.m +++ b/src/initializeSample.m @@ -1,10 +1,10 @@ % Sample -% :PROPERTIES: -% :header-args:matlab+: :tangle ../src/initializeSample.m -% :header-args:matlab+: :comments org :mkdirp yes -% :header-args:matlab+: :eval no :results none -% :END: -% <> +% :PROPERTIES: +% :header-args:matlab+: :tangle ../src/initializeSample.m +% :header-args:matlab+: :comments org :mkdirp yes +% :header-args:matlab+: :eval no :results none +% :END: +% <> % This Matlab function is accessible [[file:../src/initializeSample.m][here]]. diff --git a/src/initializeSimConf.m b/src/initializeSimConf.m deleted file mode 100644 index 234e641..0000000 --- a/src/initializeSimConf.m +++ /dev/null @@ -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: -% <> - -% 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 diff --git a/src/initializeTy.m b/src/initializeTy.m index ccbce0f..f710994 100644 --- a/src/initializeTy.m +++ b/src/initializeTy.m @@ -1,10 +1,10 @@ % Translation Stage -% :PROPERTIES: -% :header-args:matlab+: :tangle ../src/initializeTy.m -% :header-args:matlab+: :comments org :mkdirp yes -% :header-args:matlab+: :eval no :results none -% :END: -% <> +% :PROPERTIES: +% :header-args:matlab+: :tangle ../src/initializeTy.m +% :header-args:matlab+: :comments org :mkdirp yes +% :header-args:matlab+: :eval no :results none +% :END: +% <> % This Matlab function is accessible [[file:../src/initializeTy.m][here]]. diff --git a/src/project_startup.m b/src/project_startup.m index 92f186a..f7204f9 100644 --- a/src/project_startup.m +++ b/src/project_startup.m @@ -3,12 +3,6 @@ % When the project opens, a startup script is ran. % 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; projectRoot = project.RootFolder; diff --git a/src/runSimulation.m b/src/runSimulation.m index 9a151ef..24737e1 100644 --- a/src/runSimulation.m +++ b/src/runSimulation.m @@ -1,56 +1,56 @@ % runSimulation % :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+: :eval no :results none % :END: % <> -% 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) %% Load the controller and save it for the simulation if strcmp(ctrl_type, 'cl') && strcmp(act_damp, 'none') - K_obj = load('./mat/K_fb.mat'); - K = K_obj.(sprintf('K_%s_%s', sys_mass, sys_name)); %#ok - save('./mat/controllers.mat', 'K'); + K_obj = load('./mat/K_fb.mat'); + K = K_obj.(sprintf('K_%s_%s', sys_mass, sys_name)); %#ok + save('./mat/controllers.mat', 'K'); elseif strcmp(ctrl_type, 'cl') && strcmp(act_damp, 'iff') - K_obj = load('./mat/K_fb_iff.mat'); - K = K_obj.(sprintf('K_%s_%s_iff', sys_mass, sys_name)); %#ok - save('./mat/controllers.mat', 'K'); + K_obj = load('./mat/K_fb_iff.mat'); + K = K_obj.(sprintf('K_%s_%s_iff', sys_mass, sys_name)); %#ok + save('./mat/controllers.mat', 'K'); elseif strcmp(ctrl_type, 'ol') - K = tf(zeros(6)); %#ok - save('./mat/controllers.mat', 'K'); + K = tf(zeros(6)); %#ok + save('./mat/controllers.mat', 'K'); else - error('ctrl_type should be cl or ol'); + error('ctrl_type should be cl or ol'); end %% Active Damping if strcmp(act_damp, 'iff') - K_iff_crit = load('./mat/K_iff_crit.mat'); - K_iff = K_iff_crit.(sprintf('K_iff_%s_%s', sys_mass, sys_name)); %#ok - save('./mat/controllers.mat', 'K_iff', '-append'); + K_iff_crit = load('./mat/K_iff_crit.mat'); + K_iff = K_iff_crit.(sprintf('K_iff_%s_%s', sys_mass, sys_name)); %#ok + save('./mat/controllers.mat', 'K_iff', '-append'); elseif strcmp(act_damp, 'none') - K_iff = tf(zeros(6)); %#ok - save('./mat/controllers.mat', 'K_iff', '-append'); + K_iff = tf(zeros(6)); %#ok + save('./mat/controllers.mat', 'K_iff', '-append'); end %% if strcmp(sys_name, 'pz') initializeNanoHexapod(struct('actuator', 'piezo')); elseif strcmp(sys_name, 'vc') - initializeNanoHexapod(struct('actuator', 'lorentz')); + initializeNanoHexapod(struct('actuator', 'lorentz')); else - error('sys_name should be pz or vc'); + error('sys_name should be pz or vc'); end if strcmp(sys_mass, 'light') initializeSample(struct('mass', 1)); elseif strcmp(sys_mass, 'heavy') - initializeSample(struct('mass', 50)); + initializeSample(struct('mass', 50)); else - error('sys_mass should be light or heavy'); + error('sys_mass should be light or heavy'); end %% Run the simulation