diff --git a/matlab/nass_model.slx b/matlab/nass_model.slx index 7cfaa77..ebbffa8 100644 Binary files a/matlab/nass_model.slx and b/matlab/nass_model.slx differ diff --git a/org/simscape_subsystems.org b/org/simscape_subsystems.org index 979760e..e6034d2 100644 --- a/org/simscape_subsystems.org +++ b/org/simscape_subsystems.org @@ -1229,7 +1229,7 @@ The =mirror= structure is saved. :END: #+begin_src matlab arguments - args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible' + args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible', 'init'})} = 'flexible' % initializeFramesPositions args.H (1,1) double {mustBeNumeric, mustBePositive} = 90e-3 args.MO_B (1,1) double {mustBeNumeric} = 175e-3 @@ -1303,6 +1303,8 @@ The =mirror= structure is saved. nano_hexapod.type = 1; case 'flexible' nano_hexapod.type = 2; + case 'init' + nano_hexapod.type = 4; end #+end_src diff --git a/org/stage_initialization.org b/org/stage_initialization.org new file mode 100644 index 0000000..d023c67 --- /dev/null +++ b/org/stage_initialization.org @@ -0,0 +1,151 @@ +#+TITLE: Evaluating the Plant Uncertainty in various experimental conditions +:DRAWER: +#+STARTUP: overview + +#+LANGUAGE: en +#+EMAIL: dehaeze.thomas@gmail.com +#+AUTHOR: Dehaeze Thomas + +#+HTML_LINK_HOME: ./index.html +#+HTML_LINK_UP: ./index.html + +#+HTML_HEAD: +#+HTML_HEAD: +#+HTML_HEAD: +#+HTML_HEAD: +#+HTML_HEAD: +#+HTML_HEAD: +#+HTML_HEAD: + +#+HTML_MATHJAX: align: center tagside: right font: TeX + +#+PROPERTY: header-args:matlab :session *MATLAB* +#+PROPERTY: header-args:matlab+ :comments org +#+PROPERTY: header-args:matlab+ :results none +#+PROPERTY: header-args:matlab+ :exports both +#+PROPERTY: header-args:matlab+ :eval no-export +#+PROPERTY: header-args:matlab+ :output-dir figs +#+PROPERTY: header-args:matlab+ :tangle no +#+PROPERTY: header-args:matlab+ :mkdirp yes + +#+PROPERTY: header-args:shell :eval no-export + +#+PROPERTY: header-args:latex :headers '("\\usepackage{tikz}" "\\usepackage{import}" "\\import{$HOME/Cloud/thesis/latex/org/}{config.tex}") +#+PROPERTY: header-args:latex+ :imagemagick t :fit yes +#+PROPERTY: header-args:latex+ :iminoptions -scale 100% -density 150 +#+PROPERTY: header-args:latex+ :imoutoptions -quality 100 +#+PROPERTY: header-args:latex+ :results raw replace :buffer no +#+PROPERTY: header-args:latex+ :eval no-export +#+PROPERTY: header-args:latex+ :exports both +#+PROPERTY: header-args:latex+ :mkdirp yes +#+PROPERTY: header-args:latex+ :output-dir figs +:END: + +* Matlab Init :noexport:ignore: +#+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name) +<> +#+end_src + +#+begin_src matlab :exports none :results silent :noweb yes +<> +#+end_src + +#+begin_src matlab :tangle no + simulinkproject('../'); +#+end_src + +#+begin_src matlab + open('nass_model.slx') +#+end_src + +* Initialization +#+begin_src matlab + initializeGround(); + initializeGranite('type', 'init'); + initializeTy('type', 'init'); + initializeRy('type', 'init'); + initializeRz('type', 'init'); + initializeMicroHexapod('type', 'init'); + initializeAxisc(); + initializeMirror(); + initializeNanoHexapod('type', 'init'); + initializeSample('type', 'init'); +#+end_src + +#+begin_src matlab + initializeReferences(); + initializeDisturbances('enable', false); + initializeController(); +#+end_src + +#+begin_src matlab + initializeSimscapeConfiguration('gravity', true); + initializeLoggingConfiguration('log', 'all'); +#+end_src + +* Simulation +#+begin_src matlab + load('mat/conf_simulink.mat'); + set_param(conf_simulink, 'StopTime', '0.5'); +#+end_src + +#+begin_src matlab + sim('nass_model'); +#+end_src + +Verification that nothing is moving +#+begin_src matlab :exports none + figure; + ax1 = subplot(2, 3, 1); + hold on; + plot(simout.Em.En.Time, simout.Em.En.Data(:, 1)) + hold off; + xlabel('Time [s]'); + ylabel('Dx [m]'); + + ax2 = subplot(2, 3, 2); + hold on; + plot(simout.Em.En.Time, simout.Em.En.Data(:, 2)) + hold off; + xlabel('Time [s]'); + ylabel('Dy [m]'); + + ax3 = subplot(2, 3, 3); + hold on; + plot(simout.Em.En.Time, simout.Em.En.Data(:, 3)) + hold off; + xlabel('Time [s]'); + ylabel('Dz [m]'); + + ax4 = subplot(2, 3, 4); + hold on; + plot(simout.Em.En.Time, simout.Em.En.Data(:, 4)) + hold off; + xlabel('Time [s]'); + ylabel('Rx [rad]'); + + ax5 = subplot(2, 3, 5); + hold on; + plot(simout.Em.En.Time, simout.Em.En.Data(:, 5)) + hold off; + xlabel('Time [s]'); + ylabel('Ry [rad]'); + + ax6 = subplot(2, 3, 6); + hold on; + plot(simout.Em.En.Time, simout.Em.En.Data(:, 6)) + hold off; + xlabel('Time [s]'); + ylabel('Rz [rad]'); +#+end_src + +Measured Force in each leg +#+begin_src matlab + Fgm + Ftym + Fym + Fzm + Fhm + Fnm + Fsm +#+end_src diff --git a/src/initializeNanoHexapod.m b/src/initializeNanoHexapod.m index 4faf5fd..6e89411 100644 --- a/src/initializeNanoHexapod.m +++ b/src/initializeNanoHexapod.m @@ -1,7 +1,7 @@ function [nano_hexapod] = initializeNanoHexapod(args) arguments - args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible' + args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible', 'init'})} = 'flexible' % initializeFramesPositions args.H (1,1) double {mustBeNumeric, mustBePositive} = 90e-3 args.MO_B (1,1) double {mustBeNumeric} = 175e-3 @@ -61,6 +61,8 @@ switch args.type nano_hexapod.type = 1; case 'flexible' nano_hexapod.type = 2; + case 'init' + nano_hexapod.type = 4; end save('./mat/stages.mat', 'nano_hexapod', '-append');