nass-simscape/org/experiments.org

554 lines
18 KiB
Org Mode

#+TITLE: Simulation of Scientific Experiments
:DRAWER:
#+STARTUP: overview
#+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:
* Introduction :ignore:
The goal here is to simulate some scientific experiments with the Simscape model when no control is applied to the nano-hexapod.
This has several goals:
- Validate the model
- Estimate the expected error motion for the experiments
- Estimate the stroke that we may need for the nano-hexapod
- Compare with experiments when control is applied
The document in organized as follow:
- In section [[sec:simscape_model]] the Simscape model is initialized
- In section [[sec:tomo_no_dist]] a tomography experiment is performed where the sample is aligned with the rotation axis. No disturbance is included
- In section [[sec:tomo_dist]], the same is done but with disturbance included
- In section [[sec:tomo_hexa_trans]] the micro-hexapod translate the sample such that its center of mass is no longer aligned with the rotation axis. No disturbance is included
- In section [[sec:ty_scans]], scans with the translation stage are simulated with no perturbation included
* Matlab Init :noexport:ignore:
#+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name)
<<matlab-dir>>
#+end_src
#+begin_src matlab :exports none :results silent :noweb yes
<<matlab-init>>
#+end_src
#+begin_src matlab :tangle no
simulinkproject('../');
#+end_src
#+begin_src matlab
open('nass_model.slx');
#+end_src
* Simscape Model
<<sec:simscape_model>>
We load the shared simulink configuration and we set the =StopTime=.
#+begin_src matlab
load('mat/conf_simulink.mat');
set_param(conf_simulink, 'StopTime', '2');
#+end_src
We first initialize all the stages.
The nano-hexapod is considered to be a rigid body.
#+begin_src matlab
initializeGround();
initializeGranite();
initializeTy();
initializeRy();
initializeRz();
initializeMicroHexapod();
initializeAxisc();
initializeMirror();
initializeNanoHexapod('type', 'rigid');
initializeSample('mass', 1);
#+end_src
We initialize the reference path for all the stages.
All stage is set to its zero position except the Spindle which is rotating at 60rpm.
#+begin_src matlab
initializeReferences('Rz_type', 'rotating', 'Rz_period', 1);
#+end_src
No controller is used (Open Loop).
#+begin_src matlab
initializeController('type', 'open-loop');
#+end_src
And we put some gravity.
#+begin_src matlab
initializeSimscapeConfiguration('gravity', false);
#+end_src
We log the signals for further analysis.
#+begin_src matlab
initializeLoggingConfiguration('log', 'all');
#+end_src
* Tomography Experiment with no disturbances
<<sec:tomo_no_dist>>
** Introduction :ignore:
In this section, a tomography experiment is performed with the sample aligned with the rotation axis.
No disturbance is included.
** Simulation Setup
And we initialize the disturbances to be equal to zero.
#+begin_src matlab
initializeDisturbances(...
'Dwx', false, ... % Ground Motion - X direction
'Dwy', false, ... % Ground Motion - Y direction
'Dwz', false, ... % Ground Motion - Z direction
'Fty_x', false, ... % Translation Stage - X direction
'Fty_z', false, ... % Translation Stage - Z direction
'Frz_z', false ... % Spindle - Z direction
);
#+end_src
We simulate the model.
#+begin_src matlab
sim('nass_model');
#+end_src
And we save the obtained data.
#+begin_src matlab
tomo_align_no_dist = simout;
save('./mat/experiment_tomography.mat', 'tomo_align_no_dist', '-append');
#+end_src
** Analysis
#+begin_src matlab
load('./mat/experiment_tomography.mat', 'tomo_align_no_dist');
#+end_src
#+begin_src matlab :exports none
figure;
ax1 = subplot(2, 3, 1);
hold on;
plot(tomo_align_no_dist.Em.Eg.Time, tomo_align_no_dist.Em.Eg.Data(:, 1))
hold off;
ylabel('Displacement $\epsilon_x$ [m]');
ax2 = subplot(2, 3, 2);
hold on;
plot(tomo_align_no_dist.Em.Eg.Time, tomo_align_no_dist.Em.Eg.Data(:, 2))
hold off;
ylabel('Displacement $\epsilon_y$ [m]');
ax3 = subplot(2, 3, 3);
hold on;
plot(tomo_align_no_dist.Em.Eg.Time, tomo_align_no_dist.Em.Eg.Data(:, 3))
hold off;
ylabel('Displacement $\epsilon_z$ [m]');
ax4 = subplot(2, 3, 4);
hold on;
plot(tomo_align_no_dist.Em.En.Time, tomo_align_no_dist.Em.En.Data(:, 4))
hold off;
ylabel('Rotation $\epsilon_{R_x}$ [rad]');
ax5 = subplot(2, 3, 5);
hold on;
plot(tomo_align_no_dist.Em.En.Time, tomo_align_no_dist.Em.En.Data(:, 5))
hold off;
xlabel('Time [s]');
ylabel('Rotation $\epsilon_{R_y}$ [rad]');
ax6 = subplot(2, 3, 6);
hold on;
plot(tomo_align_no_dist.Em.En.Time, tomo_align_no_dist.Em.En.Data(:, 6))
hold off;
ylabel('Rotation $\epsilon_{R_z}$ [rad]');
linkaxes([ax1,ax2,ax3,ax4,ax5,ax6],'x');
xlim([0.5, inf]);
#+end_src
#+HEADER: :tangle no :exports results :results none :noweb yes
#+begin_src matlab :var filepath="figs/exp_tomo_without_dist.pdf" :var figsize="full-tall" :post pdf2svg(file=*this*, ext="png")
<<plt-matlab>>
#+end_src
#+NAME: fig:exp_tomo_without_dist
#+CAPTION: X-Y-Z translation of the sample w.r.t. granite when performing tomography experiment with no disturbances ([[./figs/exp_tomo_without_dist.png][png]], [[./figs/exp_tomo_without_dist.pdf][pdf]])
[[file:figs/exp_tomo_without_dist.png]]
** Conclusion
#+begin_important
When everything is aligned, the resulting error motion is very small (nm range) and is quite negligible with respect to the error when disturbances are included.
This residual error motion probably comes from a small misalignment somewhere.
#+end_important
* Tomography Experiment with included perturbations
<<sec:tomo_dist>>
** Introduction :ignore:
In this section, we also perform a tomography experiment with the sample's center of mass aligned with the rotation axis.
However this time, we include perturbations such as ground motion and stage vibrations.
** Simulation Setup
We now activate the disturbances.
#+begin_src matlab
initializeDisturbances(...
'Dwx', true, ... % Ground Motion - X direction
'Dwy', true, ... % Ground Motion - Y direction
'Dwz', true, ... % Ground Motion - Z direction
'Fty_x', true, ... % Translation Stage - X direction
'Fty_z', true, ... % Translation Stage - Z direction
'Frz_z', true ... % Spindle - Z direction
);
#+end_src
We simulate the model.
#+begin_src matlab
sim('nass_model');
#+end_src
And we save the obtained data.
#+begin_src matlab
tomo_align_dist = simout;
save('./mat/experiment_tomography.mat', 'tomo_align_dist', '-append');
#+end_src
** Analysis
#+begin_src matlab
load('./mat/experiment_tomography.mat', 'tomo_align_dist', 'tomo_align_no_dist');
#+end_src
#+begin_src matlab :exports none
figure;
ax1 = subplot(2, 3, 1);
hold on;
plot(tomo_align_dist.Em.Eg.Time, tomo_align_dist.Em.Eg.Data(:, 1))
plot(tomo_align_no_dist.Em.Eg.Time, tomo_align_no_dist.Em.Eg.Data(:, 1))
hold off;
ylabel('Displacement $\epsilon_x$ [m]');
ax2 = subplot(2, 3, 2);
hold on;
plot(tomo_align_dist.Em.Eg.Time, tomo_align_dist.Em.Eg.Data(:, 2))
plot(tomo_align_no_dist.Em.Eg.Time, tomo_align_no_dist.Em.Eg.Data(:, 2))
hold off;
ylabel('Displacement $\epsilon_y$ [m]');
ax3 = subplot(2, 3, 3);
hold on;
plot(tomo_align_dist.Em.Eg.Time, tomo_align_dist.Em.Eg.Data(:, 3))
plot(tomo_align_no_dist.Em.Eg.Time, tomo_align_no_dist.Em.Eg.Data(:, 3))
hold off;
ylabel('Displacement $\epsilon_z$ [m]');
ax4 = subplot(2, 3, 4);
hold on;
plot(tomo_align_dist.Em.En.Time, tomo_align_dist.Em.En.Data(:, 4))
plot(tomo_align_no_dist.Em.En.Time, tomo_align_no_dist.Em.En.Data(:, 4))
hold off;
ylabel('Rotation $\epsilon_{R_x}$ [rad]');
ax5 = subplot(2, 3, 5);
hold on;
plot(tomo_align_dist.Em.En.Time, tomo_align_dist.Em.En.Data(:, 5))
plot(tomo_align_no_dist.Em.En.Time, tomo_align_no_dist.Em.En.Data(:, 5))
hold off;
xlabel('Time [s]');
ylabel('Rotation $\epsilon_{R_y}$ [rad]');
ax6 = subplot(2, 3, 6);
hold on;
plot(tomo_align_dist.Em.En.Time, tomo_align_dist.Em.En.Data(:, 6), 'DisplayName', 'Dist')
plot(tomo_align_no_dist.Em.En.Time, tomo_align_no_dist.Em.En.Data(:, 6), 'DisplayName', 'Ideal')
hold off;
ylabel('Rotation $\epsilon_{R_z}$ [rad]');
legend('location', 'northeast');
linkaxes([ax1,ax2,ax3,ax4,ax5,ax6],'x');
xlim([0.5, inf]);
#+end_src
#+HEADER: :tangle no :exports results :results none :noweb yes
#+begin_src matlab :var filepath="figs/exp_tomo_dist.pdf" :var figsize="full-tall" :post pdf2svg(file=*this*, ext="png")
<<plt-matlab>>
#+end_src
#+NAME: fig:exp_tomo_dist
#+CAPTION: X-Y-Z translations and rotations of the sample w.r.t. the granite when performing tomography experiment with disturbances ([[./figs/exp_tomo_dist.png][png]], [[./figs/exp_tomo_dist.pdf][pdf]])
[[file:figs/exp_tomo_dist.png]]
** Conclusion
#+begin_important
Error motion is what expected from the disturbance measurements.
#+end_important
* Tomography when the micro-hexapod is not centered
<<sec:tomo_hexa_trans>>
** Introduction :ignore:
In this section, the sample's center of mass is not aligned with the rotation axis anymore.
This is due to the fact that the micro-hexapod has performed some displacement.
No disturbances are included.
** Simulation Setup
We first set the wanted translation of the Micro Hexapod.
#+begin_src matlab
P_micro_hexapod = [0.01; 0; 0]; % [m]
#+end_src
We initialize the reference path.
#+begin_src matlab
initializeReferences('Dh_pos', [P_micro_hexapod; 0; 0; 0], 'Rz_type', 'rotating', 'Rz_period', 1);
#+end_src
We initialize the stages.
#+begin_src matlab
initializeMicroHexapod('AP', P_micro_hexapod);
#+end_src
And we initialize the disturbances to zero.
#+begin_src matlab
initializeDisturbances(...
'Dwx', false, ... % Ground Motion - X direction
'Dwy', false, ... % Ground Motion - Y direction
'Dwz', false, ... % Ground Motion - Z direction
'Fty_x', false, ... % Translation Stage - X direction
'Fty_z', false, ... % Translation Stage - Z direction
'Frz_z', false ... % Spindle - Z direction
);
#+end_src
We simulate the model.
#+begin_src matlab
sim('nass_model');
#+end_src
And we save the obtained data.
#+begin_src matlab
tomo_not_align = simout;
save('./mat/experiment_tomography.mat', 'tomo_not_align', '-append');
#+end_src
** Analysis
#+begin_src matlab
load('./mat/experiment_tomography.mat', 'tomo_not_align', 'tomo_align_no_dist');
#+end_src
#+begin_src matlab :exports none
figure;
ax1 = subplot(2, 3, 1);
hold on;
plot(tomo_not_align.Em.Eg.Time, tomo_not_align.Em.Eg.Data(:, 1))
plot(tomo_align_no_dist.Em.Eg.Time, tomo_align_no_dist.Em.Eg.Data(:, 1))
hold off;
ylabel('Displacement $\epsilon_x$ [m]');
ax2 = subplot(2, 3, 2);
hold on;
plot(tomo_not_align.Em.Eg.Time, tomo_not_align.Em.Eg.Data(:, 2))
plot(tomo_align_no_dist.Em.Eg.Time, tomo_align_no_dist.Em.Eg.Data(:, 2))
hold off;
ylabel('Displacement $\epsilon_y$ [m]');
ax3 = subplot(2, 3, 3);
hold on;
plot(tomo_not_align.Em.Eg.Time, tomo_not_align.Em.Eg.Data(:, 3))
plot(tomo_align_no_dist.Em.Eg.Time, tomo_align_no_dist.Em.Eg.Data(:, 3))
hold off;
ylabel('Displacement $\epsilon_z$ [m]');
ax4 = subplot(2, 3, 4);
hold on;
plot(tomo_not_align.Em.En.Time, tomo_not_align.Em.En.Data(:, 4))
plot(tomo_align_no_dist.Em.En.Time, tomo_align_no_dist.Em.En.Data(:, 4))
hold off;
ylabel('Rotation $\epsilon_{R_x}$ [rad]');
ax5 = subplot(2, 3, 5);
hold on;
plot(tomo_not_align.Em.En.Time, tomo_not_align.Em.En.Data(:, 5))
plot(tomo_align_no_dist.Em.En.Time, tomo_align_no_dist.Em.En.Data(:, 5))
hold off;
xlabel('Time [s]');
ylabel('Rotation $\epsilon_{R_y}$ [rad]');
ax6 = subplot(2, 3, 6);
hold on;
plot(tomo_not_align.Em.En.Time, tomo_not_align.Em.En.Data(:, 6), 'DisplayName', 'Offset')
plot(tomo_align_no_dist.Em.En.Time, tomo_align_no_dist.Em.En.Data(:, 6), 'DisplayName', 'Ideal')
hold off;
ylabel('Rotation $\epsilon_{R_z}$ [rad]');
legend('location', 'northeast');
linkaxes([ax1,ax2,ax3,ax4,ax5,ax6],'x');
xlim([0.5, inf]);
#+end_src
#+HEADER: :tangle no :exports results :results none :noweb yes
#+begin_src matlab :var filepath="figs/exp_tomo_offset.pdf" :var figsize="full-normal" :post pdf2svg(file=*this*, ext="png")
<<plt-matlab>>
#+end_src
#+NAME: fig:exp_tomo_offset
#+CAPTION: X-Y-Z translation of the sample w.r.t. granite when performing tomography experiment with no disturbances ([[./figs/exp_tomo_offset.png][png]], [[./figs/exp_tomo_offset.pdf][pdf]])
[[file:figs/exp_tomo_offset.png]]
** Conclusion
#+begin_important
The main motion error are 1Hz X-Y translations and constant Ry error.
This is mainly due to finite stiffness of the elements.
#+end_important
* Raster Scans with the translation stage
<<sec:ty_scans>>
** Introduction :ignore:
In this section, scans with the translation stage are performed.
** Simulation Setup
We initialize the stages.
#+begin_src matlab
initializeGround();
initializeGranite();
initializeTy();
initializeRy();
initializeRz();
initializeMicroHexapod();
initializeAxisc();
initializeMirror();
initializeNanoHexapod('type', 'rigid');
initializeSample('mass', 1);
#+end_src
And we initialize the disturbances to zero.
#+begin_src matlab
initializeDisturbances(...
'Dwx', false, ... % Ground Motion - X direction
'Dwy', false, ... % Ground Motion - Y direction
'Dwz', false, ... % Ground Motion - Z direction
'Fty_x', false, ... % Translation Stage - X direction
'Fty_z', false, ... % Translation Stage - Z direction
'Frz_z', false ... % Spindle - Z direction
);
#+end_src
We set the reference path to be a triangular signal for the Translation Stage.
#+begin_src matlab
initializeReferences('Dy_type', 'triangular', 'Dy_amplitude', 10e-3, 'Dy_period', 1);
#+end_src
We simulate the model.
#+begin_src matlab
sim('nass_model');
#+end_src
And we save the obtained data.
#+begin_src matlab
ty_scan_triangle = simout;
save('./mat/experiment_tomography.mat', 'ty_scan_triangle', '-append');
#+end_src
We now set the reference path to be a sinusoidal signal for the Translation Stage.
#+begin_src matlab
initializeReferences('Dy_type', 'sinusoidal', 'Dy_amplitude', 10e-3, 'Dy_period', 1);
#+end_src
We simulate the model.
#+begin_src matlab
sim('nass_model');
#+end_src
And we save the obtained data.
#+begin_src matlab
ty_scan_sinus = simout;
save('./mat/experiment_tomography.mat', 'ty_scan_sinus', '-append');
#+end_src
** Analysis
#+begin_src matlab
load('./mat/experiment_tomography.mat', 'ty_scan_triangle', 'ty_scan_sinus');
#+end_src
#+begin_src matlab :exports none
figure;
ax1 = subplot(2, 3, 1);
hold on;
plot(ty_scan_triangle.Em.Eg.Time, ty_scan_triangle.Em.Eg.Data(:, 1))
plot(ty_scan_sinus.Em.Eg.Time, ty_scan_sinus.Em.Eg.Data(:, 1))
hold off;
ylabel('Displacement $\epsilon_x$ [m]');
ax2 = subplot(2, 3, 2);
hold on;
plot(ty_scan_triangle.Em.Eg.Time, ty_scan_triangle.Em.Eg.Data(:, 2))
plot(ty_scan_sinus.Em.Eg.Time, ty_scan_sinus.Em.Eg.Data(:, 2))
hold off;
ylabel('Displacement $\epsilon_y$ [m]');
ax3 = subplot(2, 3, 3);
hold on;
plot(ty_scan_triangle.Em.Eg.Time, ty_scan_triangle.Em.Eg.Data(:, 3))
plot(ty_scan_sinus.Em.Eg.Time, ty_scan_sinus.Em.Eg.Data(:, 3))
hold off;
ylabel('Displacement $\epsilon_z$ [m]');
ax4 = subplot(2, 3, 4);
hold on;
plot(ty_scan_triangle.Em.En.Time, ty_scan_triangle.Em.En.Data(:, 4))
plot(ty_scan_sinus.Em.En.Time, ty_scan_sinus.Em.En.Data(:, 4))
hold off;
ylabel('Rotation $\epsilon_{R_x}$ [rad]');
ax5 = subplot(2, 3, 5);
hold on;
plot(ty_scan_triangle.Em.En.Time, ty_scan_triangle.Em.En.Data(:, 5))
plot(ty_scan_sinus.Em.En.Time, ty_scan_sinus.Em.En.Data(:, 5))
hold off;
xlabel('Time [s]');
ylabel('Rotation $\epsilon_{R_y}$ [rad]');
ax6 = subplot(2, 3, 6);
hold on;
plot(ty_scan_triangle.Em.En.Time, ty_scan_triangle.Em.En.Data(:, 6), 'DisplayName', 'triangle')
plot(ty_scan_sinus.Em.En.Time, ty_scan_sinus.Em.En.Data(:, 6), 'DisplayName', 'sinus')
hold off;
ylabel('Rotation $\epsilon_{R_z}$ [rad]');
legend('location', 'northeast');
linkaxes([ax1,ax2,ax3,ax4,ax5,ax6],'x');
xlim([0.5, inf]);
#+end_src
#+HEADER: :tangle no :exports results :results none :noweb yes
#+begin_src matlab :var filepath="figs/exp_ty_scan.pdf" :var figsize="full-tall" :post pdf2svg(file=*this*, ext="png")
<<plt-matlab>>
#+end_src
#+NAME: fig:exp_ty_scan
#+CAPTION: X-Y-Z translation of the sample w.r.t. granite when performing tomography experiment with no disturbances ([[./figs/exp_ty_scan.png][png]], [[./figs/exp_ty_scan.pdf][pdf]])
[[file:figs/exp_ty_scan.png]]
** Conclusion
#+begin_important
Scans with the translation stage induces some errors in the Y direction and Rx translations.
Also, scanning with a sinusoidal wave induces less position errors and at lower frequencies.
Thus, this should be preferred.
#+end_important