Configurable Model: stages (solid/flexible)

This commit is contained in:
2020-02-17 18:21:20 +01:00
parent 9a5841f3c0
commit aa2f3254c2
50 changed files with 779 additions and 106 deletions
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -1 +1 @@
../figs/
../figs
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+405 -57
View File
@@ -42,7 +42,6 @@
:END:
* Introduction :ignore:
The full Simscape Model is represented in Figure [[fig:simscape_picture]].
#+name: fig:simscape_picture
@@ -56,6 +55,59 @@ Each stage is configured (geometry, mass properties, dynamic properties ...) usi
These functions are defined below.
* Simscape Configuration
:PROPERTIES:
:header-args:matlab+: :tangle ../src/initializeSimscapeConfiguration.m
:header-args:matlab+: :comments none :mkdirp yes :eval no
:END:
<<sec:initializeSimscapeConfiguration>>
** Function description
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
function [] = initializeSimscapeConfiguration(args)
#+end_src
** Optional Parameters
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
arguments
args.gravity logical {mustBeNumericOrLogical} = true
end
#+end_src
** Structure initialization
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
conf_simscape = struct();
#+end_src
** Add Type
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
if args.gravity
conf_simscape.type = 1;
else
conf_simscape.type = 2;
end
#+end_src
** Save the Structure
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
save('./mat/conf_simscape.mat', 'conf_simscape');
#+end_src
* Ground
:PROPERTIES:
:header-args:matlab+: :tangle ../src/initializeGround.m
@@ -87,21 +139,55 @@ The model of the Ground is composed of:
:UNNUMBERED: t
:END:
#+begin_src matlab
function [ground] = initializeGround()
function [ground] = initializeGround(args)
#+end_src
** Function content
** Optional Parameters
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
arguments
args.type char {mustBeMember(args.type,{'none', 'solid'})} = 'solid'
end
#+end_src
** Structure initialization
:PROPERTIES:
:UNNUMBERED: t
:END:
First, we initialize the =granite= structure.
#+begin_src matlab
ground = struct();
#+end_src
We set the shape and density of the ground solid element.
** Add Type
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
ground.shape = [2, 2, 0.5]; % [m]
ground.density = 2800; % [kg/m3]
switch args.type
case 'none'
ground.type = 0;
case 'solid'
ground.type = 1;
end
#+end_src
** Ground Solid properties
:PROPERTIES:
:UNNUMBERED: t
:END:
We set the shape and density of the ground solid element.
#+begin_src matlab
ground.shape = [2, 2, 0.5]; % [m]
ground.density = 2800; % [kg/m3]
#+end_src
** Save the Structure
:PROPERTIES:
:UNNUMBERED: t
:END:
The =ground= structure is saved.
#+begin_src matlab
save('./mat/stages.mat', 'ground', '-append');
@@ -148,15 +234,17 @@ The output =sample_pos= corresponds to the impact point of the X-ray.
:UNNUMBERED: t
:END:
#+begin_src matlab
arguments
args.density (1,1) double {mustBeNumeric, mustBeNonnegative} = 2800 % Density [kg/m3]
args.x0 (1,1) double {mustBeNumeric} = 0 % Rest position of the Joint in the X direction [m]
args.y0 (1,1) double {mustBeNumeric} = 0 % Rest position of the Joint in the Y direction [m]
args.z0 (1,1) double {mustBeNumeric} = 0 % Rest position of the Joint in the Z direction [m]
end
arguments
args.type char {mustBeMember(args.type,{'rigid', 'flexible', 'none'})} = 'flexible'
args.density (1,1) double {mustBeNumeric, mustBeNonnegative} = 2800 % Density [kg/m3]
args.x0 (1,1) double {mustBeNumeric} = 0 % Rest position of the Joint in the X direction [m]
args.y0 (1,1) double {mustBeNumeric} = 0 % Rest position of the Joint in the Y direction [m]
args.z0 (1,1) double {mustBeNumeric} = 0 % Rest position of the Joint in the Z direction [m]
end
#+end_src
** Function content
** Structure initialization
:PROPERTIES:
:UNNUMBERED: t
:END:
@@ -165,6 +253,25 @@ First, we initialize the =granite= structure.
granite = struct();
#+end_src
** Add Granite Type
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
switch args.type
case 'none'
granite.type = 0;
case 'rigid'
granite.type = 1;
case 'flexible'
granite.type = 2;
end
#+end_src
** Function content
:PROPERTIES:
:UNNUMBERED: t
:END:
Properties of the Material and link to the geometry of the granite.
#+begin_src matlab
granite.density = args.density; % [kg/m3]
@@ -197,6 +304,10 @@ Z-offset for the initial position of the sample with respect to the granite top
granite.sample_pos = 0.8; % [m]
#+end_src
** Save the Structure
:PROPERTIES:
:UNNUMBERED: t
:END:
The =granite= structure is saved.
#+begin_src matlab
save('./mat/stages.mat', 'granite', '-append');
@@ -247,18 +358,19 @@ The Simscape model of the Translation stage consist of:
:END:
#+begin_src matlab
arguments
args.x11 (1,1) double {mustBeNumeric} = 0 % [m]
args.z11 (1,1) double {mustBeNumeric} = 0 % [m]
args.x21 (1,1) double {mustBeNumeric} = 0 % [m]
args.z21 (1,1) double {mustBeNumeric} = 0 % [m]
args.x12 (1,1) double {mustBeNumeric} = 0 % [m]
args.z12 (1,1) double {mustBeNumeric} = 0 % [m]
args.x22 (1,1) double {mustBeNumeric} = 0 % [m]
args.z22 (1,1) double {mustBeNumeric} = 0 % [m]
args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible'
args.x11 (1,1) double {mustBeNumeric} = 0 % [m]
args.z11 (1,1) double {mustBeNumeric} = 0 % [m]
args.x21 (1,1) double {mustBeNumeric} = 0 % [m]
args.z21 (1,1) double {mustBeNumeric} = 0 % [m]
args.x12 (1,1) double {mustBeNumeric} = 0 % [m]
args.z12 (1,1) double {mustBeNumeric} = 0 % [m]
args.x22 (1,1) double {mustBeNumeric} = 0 % [m]
args.z22 (1,1) double {mustBeNumeric} = 0 % [m]
end
#+end_src
** Function content
** Structure initialization
:PROPERTIES:
:UNNUMBERED: t
:END:
@@ -267,6 +379,27 @@ First, we initialize the =ty= structure.
ty = struct();
#+end_src
** Add Translation Stage Type
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
switch args.type
case 'none'
ty.type = 0;
case 'rigid'
ty.type = 1;
case 'flexible'
ty.type = 2;
end
#+end_src
** Function content
:PROPERTIES:
:UNNUMBERED: t
:END:
Define the density of the materials as well as the geometry (STEP files).
#+begin_src matlab
% Ty Granite frame
@@ -330,6 +463,10 @@ Equilibrium position of the joints.
ty.z0_22 = args.z22;
#+end_src
** Save the Structure
:PROPERTIES:
:UNNUMBERED: t
:END:
The =ty= structure is saved.
#+begin_src matlab
save('./mat/stages.mat', 'ty', '-append');
@@ -380,22 +517,23 @@ The Simscape model of the Tilt stage is composed of:
:END:
#+begin_src matlab
arguments
args.x11 (1,1) double {mustBeNumeric} = 0 % [m]
args.y11 (1,1) double {mustBeNumeric} = 0 % [m]
args.z11 (1,1) double {mustBeNumeric} = 0 % [m]
args.x12 (1,1) double {mustBeNumeric} = 0 % [m]
args.y12 (1,1) double {mustBeNumeric} = 0 % [m]
args.z12 (1,1) double {mustBeNumeric} = 0 % [m]
args.x21 (1,1) double {mustBeNumeric} = 0 % [m]
args.y21 (1,1) double {mustBeNumeric} = 0 % [m]
args.z21 (1,1) double {mustBeNumeric} = 0 % [m]
args.x22 (1,1) double {mustBeNumeric} = 0 % [m]
args.y22 (1,1) double {mustBeNumeric} = 0 % [m]
args.z22 (1,1) double {mustBeNumeric} = 0 % [m]
args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible'
args.x11 (1,1) double {mustBeNumeric} = 0 % [m]
args.y11 (1,1) double {mustBeNumeric} = 0 % [m]
args.z11 (1,1) double {mustBeNumeric} = 0 % [m]
args.x12 (1,1) double {mustBeNumeric} = 0 % [m]
args.y12 (1,1) double {mustBeNumeric} = 0 % [m]
args.z12 (1,1) double {mustBeNumeric} = 0 % [m]
args.x21 (1,1) double {mustBeNumeric} = 0 % [m]
args.y21 (1,1) double {mustBeNumeric} = 0 % [m]
args.z21 (1,1) double {mustBeNumeric} = 0 % [m]
args.x22 (1,1) double {mustBeNumeric} = 0 % [m]
args.y22 (1,1) double {mustBeNumeric} = 0 % [m]
args.z22 (1,1) double {mustBeNumeric} = 0 % [m]
end
#+end_src
** Function content
** Structure initialization
:PROPERTIES:
:UNNUMBERED: t
:END:
@@ -404,6 +542,28 @@ First, we initialize the =ry= structure.
ry = struct();
#+end_src
** Add Tilt Type
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
switch args.type
case 'none'
ry.type = 0;
case 'rigid'
ry.type = 1;
case 'flexible'
ry.type = 2;
end
#+end_src
** Function content
:PROPERTIES:
:UNNUMBERED: t
:END:
Properties of the Material and link to the geometry of the Tilt stage.
#+begin_src matlab
% Ry - Guide for the tilt stage
@@ -460,6 +620,10 @@ Z-Offset so that the center of rotation matches the sample center;
ry.z_offset = 0.58178; % [m]
#+end_src
** Save the Structure
:PROPERTIES:
:UNNUMBERED: t
:END:
The =ty= structure is saved.
#+begin_src matlab
save('./mat/stages.mat', 'ry', '-append');
@@ -506,15 +670,16 @@ The Simscape model of the Spindle is composed of:
:END:
#+begin_src matlab
arguments
args.x0 (1,1) double {mustBeNumeric} = 0 % Equilibrium position of the Joint [m]
args.y0 (1,1) double {mustBeNumeric} = 0 % Equilibrium position of the Joint [m]
args.z0 (1,1) double {mustBeNumeric} = 0 % Equilibrium position of the Joint [m]
args.rx0 (1,1) double {mustBeNumeric} = 0 % Equilibrium position of the Joint [rad]
args.ry0 (1,1) double {mustBeNumeric} = 0 % Equilibrium position of the Joint [rad]
args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible'
args.x0 (1,1) double {mustBeNumeric} = 0 % Equilibrium position of the Joint [m]
args.y0 (1,1) double {mustBeNumeric} = 0 % Equilibrium position of the Joint [m]
args.z0 (1,1) double {mustBeNumeric} = 0 % Equilibrium position of the Joint [m]
args.rx0 (1,1) double {mustBeNumeric} = 0 % Equilibrium position of the Joint [rad]
args.ry0 (1,1) double {mustBeNumeric} = 0 % Equilibrium position of the Joint [rad]
end
#+end_src
** Function content
** Structure initialization
:PROPERTIES:
:UNNUMBERED: t
:END:
@@ -523,6 +688,26 @@ First, we initialize the =rz= structure.
rz = struct();
#+end_src
** Add Spindle Type
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
switch args.type
case 'none'
rz.type = 0;
case 'rigid'
rz.type = 1;
case 'flexible'
rz.type = 2;
end
#+end_src
** Function content
:PROPERTIES:
:UNNUMBERED: t
:END:
Properties of the Material and link to the geometry of the spindle.
#+begin_src matlab
% Spindle - Slip Ring
@@ -563,6 +748,10 @@ Equilibrium position of the joints.
rz.ry0 = args.ry0;
#+end_src
** Save the Structure
:PROPERTIES:
:UNNUMBERED: t
:END:
The =rz= structure is saved.
#+begin_src matlab
save('./mat/stages.mat', 'rz', '-append');
@@ -661,6 +850,10 @@ Equilibrium position of the each joint.
micro_hexapod.dLeq = args.dLeq;
#+end_src
** Save the Structure
:PROPERTIES:
:UNNUMBERED: t
:END:
The =micro_hexapod= structure is saved.
#+begin_src matlab
save('./mat/stages.mat', 'micro_hexapod', '-append');
@@ -697,16 +890,20 @@ The Simscape model of the Center of gravity compensator is composed of:
:UNNUMBERED: t
:END:
#+begin_src matlab
function [axisc] = initializeAxisc()
function [axisc] = initializeAxisc(args)
#+end_src
** Optional Parameters
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
arguments
args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible'
end
#+end_src
** Function content
** Structure initialization
:PROPERTIES:
:UNNUMBERED: t
:END:
@@ -715,6 +912,25 @@ First, we initialize the =axisc= structure.
axisc = struct();
#+end_src
** Add Type
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
switch args.type
case 'none'
axisc.type = 0;
case 'rigid'
axisc.type = 1;
case 'flexible'
axisc.type = 2;
end
#+end_src
** Function content
:PROPERTIES:
:UNNUMBERED: t
:END:
Properties of the Material and link to the geometry files.
#+begin_src matlab
% Structure
@@ -734,6 +950,10 @@ Properties of the Material and link to the geometry files.
axisc.gear.STEP = './STEPS/axisc/axisc_gear.STEP';
#+end_src
** Save the Structure
:PROPERTIES:
:UNNUMBERED: t
:END:
The =axisc= structure is saved.
#+begin_src matlab
save('./mat/stages.mat', 'axisc', '-append');
@@ -778,12 +998,13 @@ The output =mirror_center= corresponds to the center of the Sphere and is the po
:END:
#+begin_src matlab
arguments
args.shape char {mustBeMember(args.shape,{'spherical', 'conical'})} = 'spherical'
args.angle (1,1) double {mustBeNumeric, mustBePositive} = 45 % [deg]
args.type char {mustBeMember(args.type,{'none', 'rigid'})} = 'rigid'
args.shape char {mustBeMember(args.shape,{'spherical', 'conical'})} = 'spherical'
args.angle (1,1) double {mustBeNumeric, mustBePositive} = 45 % [deg]
end
#+end_src
** Function content
** Structure initialization
:PROPERTIES:
:UNNUMBERED: t
:END:
@@ -792,13 +1013,41 @@ First, we initialize the =mirror= structure.
mirror = struct();
#+end_src
** Add Mirror Type
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
switch args.type
case 'none'
mirror.type = 0;
case 'rigid'
mirror.type = 1;
end
#+end_src
** Function content
:PROPERTIES:
:UNNUMBERED: t
:END:
We define the geometrical values.
#+begin_src matlab
mirror.h = 50; % Height of the mirror [mm]
mirror.thickness = 25; % Thickness of the plate supporting the sample [mm]
mirror.hole_rad = 120; % radius of the hole in the mirror [mm]
mirror.support_rad = 100; % radius of the support plate [mm]
mirror.jacobian = 150; % point of interest offset in z (above the top surfave) [mm]
% point of interest offset in z (above the top surfave) [mm]
switch args.type
case 'none'
mirror.jacobian = 200;
case 'rigid'
mirror.jacobian = 200 - mirror.h;
end
mirror.rad = 180; % radius of the mirror (at the bottom surface) [mm]
#+end_src
@@ -841,6 +1090,10 @@ Finally, we close the shape.
mirror.shape = [mirror.shape; 0 mirror.h];
#+end_src
** Save the Structure
:PROPERTIES:
:UNNUMBERED: t
:END:
The =mirror= structure is saved.
#+begin_src matlab
save('./mat/stages.mat', 'mirror', '-append');
@@ -942,6 +1195,10 @@ The =mirror= structure is saved.
nano_hexapod.dLeq = args.dLeq;
#+end_src
** Save the Structure
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
save('./mat/stages.mat', 'nano_hexapod', '-append');
#+end_src
@@ -989,18 +1246,19 @@ The Simscape model of the sample environment is composed of:
:END:
#+begin_src matlab
arguments
args.radius (1,1) double {mustBeNumeric, mustBePositive} = 0.1 % [m]
args.height (1,1) double {mustBeNumeric, mustBePositive} = 0.3 % [m]
args.mass (1,1) double {mustBeNumeric, mustBePositive} = 50 % [kg]
args.freq (1,1) double {mustBeNumeric, mustBePositive} = 100 % [Hz]
args.offset (1,1) double {mustBeNumeric} = 0 % [m]
args.x0 (1,1) double {mustBeNumeric} = 0 % [m]
args.y0 (1,1) double {mustBeNumeric} = 0 % [m]
args.z0 (1,1) double {mustBeNumeric} = 0 % [m]
args.type char {mustBeMember(args.type,{'rigid', 'flexible', 'none'})} = 'flexible'
args.radius (1,1) double {mustBeNumeric, mustBePositive} = 0.1 % [m]
args.height (1,1) double {mustBeNumeric, mustBePositive} = 0.3 % [m]
args.mass (1,1) double {mustBeNumeric, mustBePositive} = 50 % [kg]
args.freq (1,1) double {mustBeNumeric, mustBePositive} = 100 % [Hz]
args.offset (1,1) double {mustBeNumeric} = 0 % [m]
args.x0 (1,1) double {mustBeNumeric} = 0 % [m]
args.y0 (1,1) double {mustBeNumeric} = 0 % [m]
args.z0 (1,1) double {mustBeNumeric} = 0 % [m]
end
#+end_src
** Function content
** Structure initialization
:PROPERTIES:
:UNNUMBERED: t
:END:
@@ -1009,6 +1267,25 @@ First, we initialize the =sample= structure.
sample = struct();
#+end_src
** Add Sample Type
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
switch args.type
case 'none'
sample.type = 0;
case 'rigid'
sample.type = 1;
case 'flexible'
sample.type = 2;
end
#+end_src
** Function content
:PROPERTIES:
:UNNUMBERED: t
:END:
We define the geometrical parameters of the sample as well as its mass and position.
#+begin_src matlab
sample.radius = args.radius; % [m]
@@ -1038,11 +1315,82 @@ Equilibrium position of the Cartesian joint corresponding to the sample fixation
sample.z0 = args.z0; % [m]
#+end_src
** Save the Structure
:PROPERTIES:
:UNNUMBERED: t
:END:
The =sample= structure is saved.
#+begin_src matlab
save('./mat/stages.mat', 'sample', '-append');
#+end_src
* Initialize Controller
:PROPERTIES:
:header-args:matlab+: :tangle ../src/initializeController.m
:header-args:matlab+: :comments none :mkdirp yes :eval no
:END:
<<sec:initializeController>>
** Function Declaration and Documentation
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
function [] = initializeController(args)
#+end_src
** Optional Parameters
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
arguments
args.type char {mustBeMember(args.type,{'open-loop', 'iff', 'dvf'})} = 'open-loop'
args.K (6,6) = ss(zeros(6, 6))
end
#+end_src
** Structure initialization
:PROPERTIES:
:UNNUMBERED: t
:END:
First, we initialize the =controller= structure.
#+begin_src matlab
controller = struct();
#+end_src
** Controller Type
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
switch args.type
case 'open-loop'
controller.type = 1;
case 'dvf'
controller.type = 2;
case 'iff'
controller.type = 3;
end
#+end_src
** Control Law
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
controller.K = args.K;
#+end_src
** Save the Structure
:PROPERTIES:
:UNNUMBERED: t
:END:
The =controller= structure is saved.
#+begin_src matlab
save('./mat/controller.mat', 'controller');
#+end_src
* Generate Reference Signals
:PROPERTIES:
:header-args:matlab+: :tangle ../src/initializeReferences.m
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.