nass-simscape/docs/simscape_subsystems.html

2968 lines
92 KiB
HTML

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2020-07-31 ven. 17:58 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Subsystems used for the Simscape Models</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Dehaeze Thomas" />
<link rel="stylesheet" type="text/css" href="./css/htmlize.css"/>
<link rel="stylesheet" type="text/css" href="./css/readtheorg.css"/>
<script src="./js/jquery.min.js"></script>
<script src="./js/bootstrap.min.js"></script>
<script src="./js/jquery.stickytableheaders.min.js"></script>
<script src="./js/readtheorg.js"></script>
</head>
<body>
<div id="org-div-home-and-up">
<a accesskey="h" href="./index.html"> UP </a>
|
<a accesskey="H" href="./index.html"> HOME </a>
</div><div id="content">
<h1 class="title">Subsystems used for the Simscape Models</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org6171274">1. Simscape Configuration</a>
<ul>
<li><a href="#org7cb3c0a">Function description</a></li>
<li><a href="#org8dbc80b">Optional Parameters</a></li>
<li><a href="#org5d6b026">Structure initialization</a></li>
<li><a href="#org3b2b31f">Add Type</a></li>
<li><a href="#org202f2f5">Save the Structure</a></li>
</ul>
</li>
<li><a href="#orgdda6840">2. Logging Configuration</a>
<ul>
<li><a href="#orga023a16">Function description</a></li>
<li><a href="#org25d251a">Optional Parameters</a></li>
<li><a href="#orga9581dd">Structure initialization</a></li>
<li><a href="#org3ae8480">Add Type</a></li>
<li><a href="#org60d91f1">Sampling Time</a></li>
<li><a href="#orgb451471">Save the Structure</a></li>
</ul>
</li>
<li><a href="#org1bf1870">3. Ground</a>
<ul>
<li><a href="#org4068b6d">Simscape Model</a></li>
<li><a href="#orgb6fb069">Function description</a></li>
<li><a href="#org8f25332">Optional Parameters</a></li>
<li><a href="#org774f25f">Structure initialization</a></li>
<li><a href="#org1a1f93c">Add Type</a></li>
<li><a href="#org4c31ca5">Ground Solid properties</a></li>
<li><a href="#org542691f">Rotation Point</a></li>
<li><a href="#orgf253aaf">Save the Structure</a></li>
</ul>
</li>
<li><a href="#orga045749">4. Granite</a>
<ul>
<li><a href="#org146471f">Simscape Model</a></li>
<li><a href="#orgde2bd2e">Function description</a></li>
<li><a href="#org3b8d3dd">Optional Parameters</a></li>
<li><a href="#orgebcb93c">Structure initialization</a></li>
<li><a href="#org413c06d">Add Granite Type</a></li>
<li><a href="#org3bf8f39">Material and Geometry</a></li>
<li><a href="#orga217348">Stiffness and Damping properties</a></li>
<li><a href="#orgc6700d2">Equilibrium position of the each joint.</a></li>
<li><a href="#orgc3adc4d">Save the Structure</a></li>
</ul>
</li>
<li><a href="#orgf66b222">5. Translation Stage</a>
<ul>
<li><a href="#org12266d1">Simscape Model</a></li>
<li><a href="#org92d8f8c">Function description</a></li>
<li><a href="#org0d6169b">Optional Parameters</a></li>
<li><a href="#org6f61493">Structure initialization</a></li>
<li><a href="#org715e876">Add Translation Stage Type</a></li>
<li><a href="#org0e711bf">Material and Geometry</a></li>
<li><a href="#org91244ee">Stiffness and Damping properties</a></li>
<li><a href="#orgde10c01">Equilibrium position of the each joint.</a></li>
<li><a href="#org3c170b1">Save the Structure</a></li>
</ul>
</li>
<li><a href="#orga18d111">6. Tilt Stage</a>
<ul>
<li><a href="#org6747f87">Simscape Model</a></li>
<li><a href="#orgfaa4c42">Function description</a></li>
<li><a href="#orgea3cc30">Optional Parameters</a></li>
<li><a href="#org0931679">Structure initialization</a></li>
<li><a href="#orgea3a7ba">Add Tilt Type</a></li>
<li><a href="#orga619b23">Material and Geometry</a></li>
<li><a href="#orgf5f5a01">Stiffness and Damping properties</a></li>
<li><a href="#orgf9f78bc">Equilibrium position of the each joint.</a></li>
<li><a href="#org8c5ec78">Save the Structure</a></li>
</ul>
</li>
<li><a href="#org8d2c73d">7. Spindle</a>
<ul>
<li><a href="#orgbe8d781">Simscape Model</a></li>
<li><a href="#org027d02c">Function description</a></li>
<li><a href="#orgc7322bd">Optional Parameters</a></li>
<li><a href="#org9e9d235">Structure initialization</a></li>
<li><a href="#orge5b17ec">Add Spindle Type</a></li>
<li><a href="#org983c7f6">Material and Geometry</a></li>
<li><a href="#org382b0d7">Stiffness and Damping properties</a></li>
<li><a href="#org1bf65fa">Equilibrium position of the each joint.</a></li>
<li><a href="#org63987aa">Save the Structure</a></li>
</ul>
</li>
<li><a href="#org8ba04e2">8. Micro Hexapod</a>
<ul>
<li><a href="#org0e3daf2">Simscape Model</a></li>
<li><a href="#org417ab1a">Function description</a></li>
<li><a href="#orgfab542c">Optional Parameters</a></li>
<li><a href="#org0737b17">Function content</a></li>
<li><a href="#org106cc19">Add Type</a></li>
<li><a href="#org4eb0d4a">Save the Structure</a></li>
</ul>
</li>
<li><a href="#orga55d418">9. Center of gravity compensation</a>
<ul>
<li><a href="#org5d43556">Simscape Model</a></li>
<li><a href="#org9aabdd7">Function description</a></li>
<li><a href="#orge20b2d4">Optional Parameters</a></li>
<li><a href="#org86f3836">Structure initialization</a></li>
<li><a href="#org704283e">Add Type</a></li>
<li><a href="#org4190b86">Material and Geometry</a></li>
<li><a href="#org13006e5">Save the Structure</a></li>
</ul>
</li>
<li><a href="#org7586ab7">10. Mirror</a>
<ul>
<li><a href="#org55c7837">Simscape Model</a></li>
<li><a href="#orga32f53e">Function description</a></li>
<li><a href="#org4b6fb5d">Optional Parameters</a></li>
<li><a href="#org86bba59">Structure initialization</a></li>
<li><a href="#orgff14824">Add Mirror Type</a></li>
<li><a href="#org4ad73aa">Mass and Inertia</a></li>
<li><a href="#org7e63798">Stiffness and Damping properties</a></li>
<li><a href="#org7d51c2b">Equilibrium position of the each joint.</a></li>
<li><a href="#orgc381755">Geometry</a></li>
<li><a href="#org0b94a9c">Save the Structure</a></li>
</ul>
</li>
<li><a href="#org34337a8">11. Nano Hexapod</a>
<ul>
<li><a href="#org434641f">Simscape Model</a></li>
<li><a href="#orga87da5a">Function description</a></li>
<li><a href="#orgcfe66f4">Optional Parameters</a></li>
<li><a href="#org181d2af">Function content</a></li>
<li><a href="#org59a48c9">Add Type</a></li>
<li><a href="#org1dae879">Save the Structure</a></li>
</ul>
</li>
<li><a href="#org3d615a1">12. Sample</a>
<ul>
<li><a href="#org5268fd9">Simscape Model</a></li>
<li><a href="#org73bab13">Function description</a></li>
<li><a href="#org60239c5">Optional Parameters</a></li>
<li><a href="#org7441955">Structure initialization</a></li>
<li><a href="#org2bb1d24">Add Sample Type</a></li>
<li><a href="#orgb09a907">Material and Geometry</a></li>
<li><a href="#org228453f">Compute the Inertia</a></li>
<li><a href="#org01454e2">Stiffness and Damping properties</a></li>
<li><a href="#org8c04d7a">Equilibrium position of the each joint.</a></li>
<li><a href="#orgcc31def">Save the Structure</a></li>
</ul>
</li>
<li><a href="#orge9cbdc9">13. Initialize Controller</a>
<ul>
<li><a href="#orgf8f086e">Function Declaration and Documentation</a></li>
<li><a href="#org1eac675">Optional Parameters</a></li>
<li><a href="#org0e8536c">Structure initialization</a></li>
<li><a href="#org4207f98">Controller Type</a></li>
<li><a href="#org0b9e4dd">Save the Structure</a></li>
</ul>
</li>
<li><a href="#orgae5cb57">14. Generate Reference Signals</a>
<ul>
<li><a href="#orga062508">Function Declaration and Documentation</a></li>
<li><a href="#orgc42aa5f">Optional Parameters</a></li>
<li><a href="#orge94c0c2">Initialize Parameters</a></li>
<li><a href="#org5e56bf2">Translation Stage</a></li>
<li><a href="#orgfb9d278">Tilt Stage</a></li>
<li><a href="#org6fe10ff">Spindle</a></li>
<li><a href="#org1e01222">Micro Hexapod</a></li>
<li><a href="#org04d73dc">Axis Compensation</a></li>
<li><a href="#org26371bd">Nano Hexapod</a></li>
<li><a href="#org01d19da">Save</a></li>
</ul>
</li>
<li><a href="#org544c9dd">15. Initialize Disturbances</a>
<ul>
<li><a href="#org4eb2581">Function Declaration and Documentation</a></li>
<li><a href="#org69b114f">Optional Parameters</a></li>
<li><a href="#orgf744aeb">Load Data</a></li>
<li><a href="#org6c7d666">Parameters</a></li>
<li><a href="#orgb2108c4">Ground Motion</a></li>
<li><a href="#orgb70c65e">Translation Stage - X direction</a></li>
<li><a href="#org070255a">Translation Stage - Z direction</a></li>
<li><a href="#orgfd5f32b">Spindle - Z direction</a></li>
<li><a href="#orgba4d479">Direct Forces</a></li>
<li><a href="#orgf6d2198">Set initial value to zero</a></li>
<li><a href="#orgca8d4ed">Save</a></li>
</ul>
</li>
<li><a href="#orgefb8a5e">16. Initialize Position Errors</a>
<ul>
<li><a href="#org5e84eb6">Function Declaration and Documentation</a></li>
<li><a href="#org588a7a9">Optional Parameters</a></li>
<li><a href="#org9a662ce">Structure initialization</a></li>
<li><a href="#orgc890f7d">Type</a></li>
<li><a href="#org7d50228">Position Errors</a></li>
<li><a href="#orge5d3d7b">Save</a></li>
</ul>
</li>
<li><a href="#orgc87e890">17. Z-Axis Geophone</a></li>
<li><a href="#orgcbddbd1">18. Z-Axis Accelerometer</a></li>
</ul>
</div>
</div>
<p>
The full Simscape Model is represented in Figure <a href="#org742ece0">1</a>.
</p>
<div id="org742ece0" class="figure">
<p><img src="figs/images/simscape_picture.png" alt="simscape_picture.png" />
</p>
<p><span class="figure-number">Figure 1: </span>Screenshot of the Multi-Body Model representation</p>
</div>
<p>
This model is divided into multiple subsystems that are independent.
These subsystems are saved in separate files and imported in the main file using a block balled &ldquo;subsystem reference&rdquo;.
</p>
<p>
Each stage is configured (geometry, mass properties, dynamic properties &#x2026;) using one function.
</p>
<p>
These functions are defined below.
</p>
<div id="outline-container-org6171274" class="outline-2">
<h2 id="org6171274"><span class="section-number-2">1</span> Simscape Configuration</h2>
<div class="outline-text-2" id="text-1">
<p>
<a id="orgb590dcf"></a>
</p>
</div>
<div id="outline-container-org7cb3c0a" class="outline-3">
<h3 id="org7cb3c0a">Function description</h3>
<div class="outline-text-3" id="text-org7cb3c0a">
<div class="org-src-container">
<pre class="src src-matlab">function [] = initializeSimscapeConfiguration(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-org8dbc80b" class="outline-3">
<h3 id="org8dbc80b">Optional Parameters</h3>
<div class="outline-text-3" id="text-org8dbc80b">
<div class="org-src-container">
<pre class="src src-matlab">arguments
args.gravity logical {mustBeNumericOrLogical} = true
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org5d6b026" class="outline-3">
<h3 id="org5d6b026">Structure initialization</h3>
<div class="outline-text-3" id="text-org5d6b026">
<div class="org-src-container">
<pre class="src src-matlab">conf_simscape = struct();
</pre>
</div>
</div>
</div>
<div id="outline-container-org3b2b31f" class="outline-3">
<h3 id="org3b2b31f">Add Type</h3>
<div class="outline-text-3" id="text-org3b2b31f">
<div class="org-src-container">
<pre class="src src-matlab">if args.gravity
conf_simscape.type = 1;
else
conf_simscape.type = 2;
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org202f2f5" class="outline-3">
<h3 id="org202f2f5">Save the Structure</h3>
<div class="outline-text-3" id="text-org202f2f5">
<div class="org-src-container">
<pre class="src src-matlab">save('./mat/conf_simscape.mat', 'conf_simscape');
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgdda6840" class="outline-2">
<h2 id="orgdda6840"><span class="section-number-2">2</span> Logging Configuration</h2>
<div class="outline-text-2" id="text-2">
<p>
<a id="org1f9c6ac"></a>
</p>
</div>
<div id="outline-container-orga023a16" class="outline-3">
<h3 id="orga023a16">Function description</h3>
<div class="outline-text-3" id="text-orga023a16">
<div class="org-src-container">
<pre class="src src-matlab">function [] = initializeLoggingConfiguration(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-org25d251a" class="outline-3">
<h3 id="org25d251a">Optional Parameters</h3>
<div class="outline-text-3" id="text-org25d251a">
<div class="org-src-container">
<pre class="src src-matlab">arguments
args.log char {mustBeMember(args.log,{'none', 'all', 'forces'})} = 'none'
args.Ts (1,1) double {mustBeNumeric, mustBePositive} = 1e-3
end
</pre>
</div>
</div>
</div>
<div id="outline-container-orga9581dd" class="outline-3">
<h3 id="orga9581dd">Structure initialization</h3>
<div class="outline-text-3" id="text-orga9581dd">
<div class="org-src-container">
<pre class="src src-matlab">conf_log = struct();
</pre>
</div>
</div>
</div>
<div id="outline-container-org3ae8480" class="outline-3">
<h3 id="org3ae8480">Add Type</h3>
<div class="outline-text-3" id="text-org3ae8480">
<div class="org-src-container">
<pre class="src src-matlab">switch args.log
case 'none'
conf_log.type = 0;
case 'all'
conf_log.type = 1;
case 'forces'
conf_log.type = 2;
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org60d91f1" class="outline-3">
<h3 id="org60d91f1">Sampling Time</h3>
<div class="outline-text-3" id="text-org60d91f1">
<div class="org-src-container">
<pre class="src src-matlab">conf_log.Ts = args.Ts;
</pre>
</div>
</div>
</div>
<div id="outline-container-orgb451471" class="outline-3">
<h3 id="orgb451471">Save the Structure</h3>
<div class="outline-text-3" id="text-orgb451471">
<div class="org-src-container">
<pre class="src src-matlab">save('./mat/conf_log.mat', 'conf_log');
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org1bf1870" class="outline-2">
<h2 id="org1bf1870"><span class="section-number-2">3</span> Ground</h2>
<div class="outline-text-2" id="text-3">
<p>
<a id="orgbe1f388"></a>
</p>
</div>
<div id="outline-container-org4068b6d" class="outline-3">
<h3 id="org4068b6d">Simscape Model</h3>
<div class="outline-text-3" id="text-org4068b6d">
<p>
The model of the Ground is composed of:
</p>
<ul class="org-ul">
<li>A <b>Cartesian</b> joint that is used to simulation the ground motion</li>
<li>A solid that represents the ground on which the granite is located</li>
</ul>
<div id="org31eeec1" class="figure">
<p><img src="figs/images/simscape_model_ground.png" alt="simscape_model_ground.png" />
</p>
<p><span class="figure-number">Figure 2: </span>Simscape model for the Ground</p>
</div>
<div id="org342019d" class="figure">
<p><img src="figs/images/simscape_picture_ground.png" alt="simscape_picture_ground.png" />
</p>
<p><span class="figure-number">Figure 3: </span>Simscape picture for the Ground</p>
</div>
</div>
</div>
<div id="outline-container-orgb6fb069" class="outline-3">
<h3 id="orgb6fb069">Function description</h3>
<div class="outline-text-3" id="text-orgb6fb069">
<div class="org-src-container">
<pre class="src src-matlab">function [ground] = initializeGround(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-org8f25332" class="outline-3">
<h3 id="org8f25332">Optional Parameters</h3>
<div class="outline-text-3" id="text-org8f25332">
<div class="org-src-container">
<pre class="src src-matlab">arguments
args.type char {mustBeMember(args.type,{'none', 'rigid'})} = 'rigid'
args.rot_point (3,1) double {mustBeNumeric} = zeros(3,1) % Rotation point for the ground motion [m]
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org774f25f" class="outline-3">
<h3 id="org774f25f">Structure initialization</h3>
<div class="outline-text-3" id="text-org774f25f">
<p>
First, we initialize the <code>granite</code> structure.
</p>
<div class="org-src-container">
<pre class="src src-matlab">ground = struct();
</pre>
</div>
</div>
</div>
<div id="outline-container-org1a1f93c" class="outline-3">
<h3 id="org1a1f93c">Add Type</h3>
<div class="outline-text-3" id="text-org1a1f93c">
<div class="org-src-container">
<pre class="src src-matlab">switch args.type
case 'none'
ground.type = 0;
case 'rigid'
ground.type = 1;
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org4c31ca5" class="outline-3">
<h3 id="org4c31ca5">Ground Solid properties</h3>
<div class="outline-text-3" id="text-org4c31ca5">
<p>
We set the shape and density of the ground solid element.
</p>
<div class="org-src-container">
<pre class="src src-matlab">ground.shape = [2, 2, 0.5]; % [m]
ground.density = 2800; % [kg/m3]
</pre>
</div>
</div>
</div>
<div id="outline-container-org542691f" class="outline-3">
<h3 id="org542691f">Rotation Point</h3>
<div class="outline-text-3" id="text-org542691f">
<div class="org-src-container">
<pre class="src src-matlab">ground.rot_point = args.rot_point;
</pre>
</div>
</div>
</div>
<div id="outline-container-orgf253aaf" class="outline-3">
<h3 id="orgf253aaf">Save the Structure</h3>
<div class="outline-text-3" id="text-orgf253aaf">
<p>
The <code>ground</code> structure is saved.
</p>
<div class="org-src-container">
<pre class="src src-matlab">save('./mat/stages.mat', 'ground', '-append');
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orga045749" class="outline-2">
<h2 id="orga045749"><span class="section-number-2">4</span> Granite</h2>
<div class="outline-text-2" id="text-4">
<p>
<a id="org82dc444"></a>
</p>
</div>
<div id="outline-container-org146471f" class="outline-3">
<h3 id="org146471f">Simscape Model</h3>
<div class="outline-text-3" id="text-org146471f">
<p>
The Simscape model of the granite is composed of:
</p>
<ul class="org-ul">
<li>A cartesian joint such that the granite can vibrations along x, y and z axis</li>
<li>A solid</li>
</ul>
<p>
The output <code>sample_pos</code> corresponds to the impact point of the X-ray.
</p>
<div id="org3072cb3" class="figure">
<p><img src="figs/images/simscape_model_granite.png" alt="simscape_model_granite.png" />
</p>
<p><span class="figure-number">Figure 4: </span>Simscape model for the Granite</p>
</div>
<div id="org089e7b6" class="figure">
<p><img src="figs/images/simscape_picture_granite.png" alt="simscape_picture_granite.png" />
</p>
<p><span class="figure-number">Figure 5: </span>Simscape picture for the Granite</p>
</div>
</div>
</div>
<div id="outline-container-orgde2bd2e" class="outline-3">
<h3 id="orgde2bd2e">Function description</h3>
<div class="outline-text-3" id="text-orgde2bd2e">
<div class="org-src-container">
<pre class="src src-matlab">function [granite] = initializeGranite(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-org3b8d3dd" class="outline-3">
<h3 id="org3b8d3dd">Optional Parameters</h3>
<div class="outline-text-3" id="text-org3b8d3dd">
<div class="org-src-container">
<pre class="src src-matlab">arguments
args.type char {mustBeMember(args.type,{'rigid', 'flexible', 'none', 'modal-analysis', 'init'})} = 'flexible'
args.Foffset logical {mustBeNumericOrLogical} = false
args.density (1,1) double {mustBeNumeric, mustBeNonnegative} = 2800 % Density [kg/m3]
args.K (3,1) double {mustBeNumeric, mustBeNonnegative} = [4e9; 3e8; 8e8] % [N/m]
args.C (3,1) double {mustBeNumeric, mustBeNonnegative} = [4.0e5; 1.1e5; 9.0e5] % [N/(m/s)]
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
</pre>
</div>
</div>
</div>
<div id="outline-container-orgebcb93c" class="outline-3">
<h3 id="orgebcb93c">Structure initialization</h3>
<div class="outline-text-3" id="text-orgebcb93c">
<p>
First, we initialize the <code>granite</code> structure.
</p>
<div class="org-src-container">
<pre class="src src-matlab">granite = struct();
</pre>
</div>
</div>
</div>
<div id="outline-container-org413c06d" class="outline-3">
<h3 id="org413c06d">Add Granite Type</h3>
<div class="outline-text-3" id="text-org413c06d">
<div class="org-src-container">
<pre class="src src-matlab">switch args.type
case 'none'
granite.type = 0;
case 'rigid'
granite.type = 1;
case 'flexible'
granite.type = 2;
case 'modal-analysis'
granite.type = 3;
case 'init'
granite.type = 4;
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org3bf8f39" class="outline-3">
<h3 id="org3bf8f39">Material and Geometry</h3>
<div class="outline-text-3" id="text-org3bf8f39">
<p>
Properties of the Material and link to the geometry of the granite.
</p>
<div class="org-src-container">
<pre class="src src-matlab">granite.density = args.density; % [kg/m3]
granite.STEP = './STEPS/granite/granite.STEP';
</pre>
</div>
<p>
Z-offset for the initial position of the sample with respect to the granite top surface.
</p>
<div class="org-src-container">
<pre class="src src-matlab">granite.sample_pos = 0.8; % [m]
</pre>
</div>
</div>
</div>
<div id="outline-container-orga217348" class="outline-3">
<h3 id="orga217348">Stiffness and Damping properties</h3>
<div class="outline-text-3" id="text-orga217348">
<div class="org-src-container">
<pre class="src src-matlab">granite.K = args.K; % [N/m]
granite.C = args.C; % [N/(m/s)]
</pre>
</div>
</div>
</div>
<div id="outline-container-orgc6700d2" class="outline-3">
<h3 id="orgc6700d2">Equilibrium position of the each joint.</h3>
<div class="outline-text-3" id="text-orgc6700d2">
<div class="org-src-container">
<pre class="src src-matlab">if args.Foffset &amp;&amp; ~strcmp(args.type, 'none') &amp;&amp; ~strcmp(args.type, 'rigid') &amp;&amp; ~strcmp(args.type, 'init')
load('mat/Foffset.mat', 'Fgm');
granite.Deq = -Fgm'./granite.K;
else
granite.Deq = zeros(6,1);
end
</pre>
</div>
</div>
</div>
<div id="outline-container-orgc3adc4d" class="outline-3">
<h3 id="orgc3adc4d">Save the Structure</h3>
<div class="outline-text-3" id="text-orgc3adc4d">
<p>
The <code>granite</code> structure is saved.
</p>
<div class="org-src-container">
<pre class="src src-matlab">save('./mat/stages.mat', 'granite', '-append');
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgf66b222" class="outline-2">
<h2 id="orgf66b222"><span class="section-number-2">5</span> Translation Stage</h2>
<div class="outline-text-2" id="text-5">
<p>
<a id="orga6fcdbd"></a>
</p>
</div>
<div id="outline-container-org12266d1" class="outline-3">
<h3 id="org12266d1">Simscape Model</h3>
<div class="outline-text-3" id="text-org12266d1">
<p>
The Simscape model of the Translation stage consist of:
</p>
<ul class="org-ul">
<li>One rigid body for the fixed part of the translation stage</li>
<li>One rigid body for the moving part of the translation stage</li>
<li>Four 6-DOF Joints that only have some rigidity in the X and Z directions.
The rigidity in rotation comes from the fact that we use multiple joints that are located at different points</li>
<li>One 6-DOF joint that represent the Actuator.
It is used to impose the motion in the Y direction</li>
<li>One 6-DOF joint to inject force disturbance in the X and Z directions</li>
</ul>
<div id="orgb5e657d" class="figure">
<p><img src="figs/images/simscape_model_ty.png" alt="simscape_model_ty.png" />
</p>
<p><span class="figure-number">Figure 6: </span>Simscape model for the Translation Stage</p>
</div>
<div id="org55b7d60" class="figure">
<p><img src="figs/images/simscape_picture_ty.png" alt="simscape_picture_ty.png" />
</p>
<p><span class="figure-number">Figure 7: </span>Simscape picture for the Translation Stage</p>
</div>
</div>
</div>
<div id="outline-container-org92d8f8c" class="outline-3">
<h3 id="org92d8f8c">Function description</h3>
<div class="outline-text-3" id="text-org92d8f8c">
<div class="org-src-container">
<pre class="src src-matlab">function [ty] = initializeTy(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-org0d6169b" class="outline-3">
<h3 id="org0d6169b">Optional Parameters</h3>
<div class="outline-text-3" id="text-org0d6169b">
<div class="org-src-container">
<pre class="src src-matlab">arguments
args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible', 'modal-analysis', 'init'})} = 'flexible'
args.Foffset logical {mustBeNumericOrLogical} = false
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org6f61493" class="outline-3">
<h3 id="org6f61493">Structure initialization</h3>
<div class="outline-text-3" id="text-org6f61493">
<p>
First, we initialize the <code>ty</code> structure.
</p>
<div class="org-src-container">
<pre class="src src-matlab">ty = struct();
</pre>
</div>
</div>
</div>
<div id="outline-container-org715e876" class="outline-3">
<h3 id="org715e876">Add Translation Stage Type</h3>
<div class="outline-text-3" id="text-org715e876">
<div class="org-src-container">
<pre class="src src-matlab">switch args.type
case 'none'
ty.type = 0;
case 'rigid'
ty.type = 1;
case 'flexible'
ty.type = 2;
case 'modal-analysis'
ty.type = 3;
case 'init'
ty.type = 4;
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org0e711bf" class="outline-3">
<h3 id="org0e711bf">Material and Geometry</h3>
<div class="outline-text-3" id="text-org0e711bf">
<p>
Define the density of the materials as well as the geometry (STEP files).
</p>
<div class="org-src-container">
<pre class="src src-matlab">% Ty Granite frame
ty.granite_frame.density = 7800; % [kg/m3] =&gt; 43kg
ty.granite_frame.STEP = './STEPS/Ty/Ty_Granite_Frame.STEP';
% Guide Translation Ty
ty.guide.density = 7800; % [kg/m3] =&gt; 76kg
ty.guide.STEP = './STEPS/ty/Ty_Guide.STEP';
% Ty - Guide_Translation12
ty.guide12.density = 7800; % [kg/m3]
ty.guide12.STEP = './STEPS/Ty/Ty_Guide_12.STEP';
% Ty - Guide_Translation11
ty.guide11.density = 7800; % [kg/m3]
ty.guide11.STEP = './STEPS/ty/Ty_Guide_11.STEP';
% Ty - Guide_Translation22
ty.guide22.density = 7800; % [kg/m3]
ty.guide22.STEP = './STEPS/ty/Ty_Guide_22.STEP';
% Ty - Guide_Translation21
ty.guide21.density = 7800; % [kg/m3]
ty.guide21.STEP = './STEPS/Ty/Ty_Guide_21.STEP';
% Ty - Plateau translation
ty.frame.density = 7800; % [kg/m3]
ty.frame.STEP = './STEPS/ty/Ty_Stage.STEP';
% Ty Stator Part
ty.stator.density = 5400; % [kg/m3]
ty.stator.STEP = './STEPS/ty/Ty_Motor_Stator.STEP';
% Ty Rotor Part
ty.rotor.density = 5400; % [kg/m3]
ty.rotor.STEP = './STEPS/ty/Ty_Motor_Rotor.STEP';
</pre>
</div>
</div>
</div>
<div id="outline-container-org91244ee" class="outline-3">
<h3 id="org91244ee">Stiffness and Damping properties</h3>
<div class="outline-text-3" id="text-org91244ee">
<div class="org-src-container">
<pre class="src src-matlab">ty.K = [2e8; 1e8; 2e8; 6e7; 9e7; 6e7]; % [N/m, N*m/rad]
ty.C = [8e4; 5e4; 8e4; 2e4; 3e4; 2e4]; % [N/(m/s), N*m/(rad/s)]
</pre>
</div>
</div>
</div>
<div id="outline-container-orgde10c01" class="outline-3">
<h3 id="orgde10c01">Equilibrium position of the each joint.</h3>
<div class="outline-text-3" id="text-orgde10c01">
<div class="org-src-container">
<pre class="src src-matlab">if args.Foffset &amp;&amp; ~strcmp(args.type, 'none') &amp;&amp; ~strcmp(args.type, 'rigid') &amp;&amp; ~strcmp(args.type, 'init')
load('mat/Foffset.mat', 'Ftym');
ty.Deq = -Ftym'./ty.K;
else
ty.Deq = zeros(6,1);
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org3c170b1" class="outline-3">
<h3 id="org3c170b1">Save the Structure</h3>
<div class="outline-text-3" id="text-org3c170b1">
<p>
The <code>ty</code> structure is saved.
</p>
<div class="org-src-container">
<pre class="src src-matlab">save('./mat/stages.mat', 'ty', '-append');
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orga18d111" class="outline-2">
<h2 id="orga18d111"><span class="section-number-2">6</span> Tilt Stage</h2>
<div class="outline-text-2" id="text-6">
<p>
<a id="orga630083"></a>
</p>
</div>
<div id="outline-container-org6747f87" class="outline-3">
<h3 id="org6747f87">Simscape Model</h3>
<div class="outline-text-3" id="text-org6747f87">
<p>
The Simscape model of the Tilt stage is composed of:
</p>
<ul class="org-ul">
<li>Two solid bodies for the two part of the stage</li>
<li><b>Four</b> 6-DOF joints to model the flexibility of the stage.
These joints are virtually located along the rotation axis and are connecting the two solid bodies.
These joints have some translation stiffness in the u-v-w directions aligned with the joint.
The stiffness in rotation between the two solids is due to the fact that the 4 joints are connecting the two solids are different locations</li>
<li>A Bushing Joint used for the Actuator.
The Ry motion is imposed by the input.</li>
</ul>
<div id="orgee25bbf" class="figure">
<p><img src="figs/images/simscape_model_ry.png" alt="simscape_model_ry.png" />
</p>
<p><span class="figure-number">Figure 8: </span>Simscape model for the Tilt Stage</p>
</div>
<div id="orgcb39e81" class="figure">
<p><img src="figs/images/simscape_picture_ry.png" alt="simscape_picture_ry.png" />
</p>
<p><span class="figure-number">Figure 9: </span>Simscape picture for the Tilt Stage</p>
</div>
</div>
</div>
<div id="outline-container-orgfaa4c42" class="outline-3">
<h3 id="orgfaa4c42">Function description</h3>
<div class="outline-text-3" id="text-orgfaa4c42">
<div class="org-src-container">
<pre class="src src-matlab">function [ry] = initializeRy(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-orgea3cc30" class="outline-3">
<h3 id="orgea3cc30">Optional Parameters</h3>
<div class="outline-text-3" id="text-orgea3cc30">
<div class="org-src-container">
<pre class="src src-matlab">arguments
args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible', 'modal-analysis', 'init'})} = 'flexible'
args.Foffset logical {mustBeNumericOrLogical} = false
args.Ry_init (1,1) double {mustBeNumeric} = 0
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org0931679" class="outline-3">
<h3 id="org0931679">Structure initialization</h3>
<div class="outline-text-3" id="text-org0931679">
<p>
First, we initialize the <code>ry</code> structure.
</p>
<div class="org-src-container">
<pre class="src src-matlab">ry = struct();
</pre>
</div>
</div>
</div>
<div id="outline-container-orgea3a7ba" class="outline-3">
<h3 id="orgea3a7ba">Add Tilt Type</h3>
<div class="outline-text-3" id="text-orgea3a7ba">
<div class="org-src-container">
<pre class="src src-matlab">switch args.type
case 'none'
ry.type = 0;
case 'rigid'
ry.type = 1;
case 'flexible'
ry.type = 2;
case 'modal-analysis'
ry.type = 3;
case 'init'
ry.type = 4;
end
</pre>
</div>
</div>
</div>
<div id="outline-container-orga619b23" class="outline-3">
<h3 id="orga619b23">Material and Geometry</h3>
<div class="outline-text-3" id="text-orga619b23">
<p>
Properties of the Material and link to the geometry of the Tilt stage.
</p>
<div class="org-src-container">
<pre class="src src-matlab">% Ry - Guide for the tilt stage
ry.guide.density = 7800; % [kg/m3]
ry.guide.STEP = './STEPS/ry/Tilt_Guide.STEP';
% Ry - Rotor of the motor
ry.rotor.density = 2400; % [kg/m3]
ry.rotor.STEP = './STEPS/ry/Tilt_Motor_Axis.STEP';
% Ry - Motor
ry.motor.density = 3200; % [kg/m3]
ry.motor.STEP = './STEPS/ry/Tilt_Motor.STEP';
% Ry - Plateau Tilt
ry.stage.density = 7800; % [kg/m3]
ry.stage.STEP = './STEPS/ry/Tilt_Stage.STEP';
</pre>
</div>
<p>
Z-Offset so that the center of rotation matches the sample center;
</p>
<div class="org-src-container">
<pre class="src src-matlab">ry.z_offset = 0.58178; % [m]
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">ry.Ry_init = args.Ry_init; % [rad]
</pre>
</div>
</div>
</div>
<div id="outline-container-orgf5f5a01" class="outline-3">
<h3 id="orgf5f5a01">Stiffness and Damping properties</h3>
<div class="outline-text-3" id="text-orgf5f5a01">
<div class="org-src-container">
<pre class="src src-matlab">ry.K = [3.8e8; 4e8; 3.8e8; 1.2e8; 6e4; 1.2e8];
ry.C = [1e5; 1e5; 1e5; 3e4; 1e3; 3e4];
</pre>
</div>
</div>
</div>
<div id="outline-container-orgf9f78bc" class="outline-3">
<h3 id="orgf9f78bc">Equilibrium position of the each joint.</h3>
<div class="outline-text-3" id="text-orgf9f78bc">
<div class="org-src-container">
<pre class="src src-matlab">if args.Foffset &amp;&amp; ~strcmp(args.type, 'none') &amp;&amp; ~strcmp(args.type, 'rigid') &amp;&amp; ~strcmp(args.type, 'init')
load('mat/Foffset.mat', 'Fym');
ry.Deq = -Fym'./ry.K;
else
ry.Deq = zeros(6,1);
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org8c5ec78" class="outline-3">
<h3 id="org8c5ec78">Save the Structure</h3>
<div class="outline-text-3" id="text-org8c5ec78">
<p>
The <code>ry</code> structure is saved.
</p>
<div class="org-src-container">
<pre class="src src-matlab">save('./mat/stages.mat', 'ry', '-append');
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org8d2c73d" class="outline-2">
<h2 id="org8d2c73d"><span class="section-number-2">7</span> Spindle</h2>
<div class="outline-text-2" id="text-7">
<p>
<a id="org85f7685"></a>
</p>
</div>
<div id="outline-container-orgbe8d781" class="outline-3">
<h3 id="orgbe8d781">Simscape Model</h3>
<div class="outline-text-3" id="text-orgbe8d781">
<p>
The Simscape model of the Spindle is composed of:
</p>
<ul class="org-ul">
<li>Two rigid bodies: the stator and the rotor</li>
<li>A Bushing Joint that is used both as the actuator (the Rz motion is imposed by the input) and as the force perturbation in the Z direction.</li>
<li>The Bushing joint has some flexibility in the X-Y-Z directions as well as in Rx and Ry rotations</li>
</ul>
<div id="orgf8cd2b8" class="figure">
<p><img src="figs/images/simscape_model_rz.png" alt="simscape_model_rz.png" />
</p>
<p><span class="figure-number">Figure 10: </span>Simscape model for the Spindle</p>
</div>
<div id="org8f17d51" class="figure">
<p><img src="figs/images/simscape_picture_rz.png" alt="simscape_picture_rz.png" />
</p>
<p><span class="figure-number">Figure 11: </span>Simscape picture for the Spindle</p>
</div>
</div>
</div>
<div id="outline-container-org027d02c" class="outline-3">
<h3 id="org027d02c">Function description</h3>
<div class="outline-text-3" id="text-org027d02c">
<div class="org-src-container">
<pre class="src src-matlab">function [rz] = initializeRz(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-orgc7322bd" class="outline-3">
<h3 id="orgc7322bd">Optional Parameters</h3>
<div class="outline-text-3" id="text-orgc7322bd">
<div class="org-src-container">
<pre class="src src-matlab">arguments
args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible', 'modal-analysis', 'init'})} = 'flexible'
args.Foffset logical {mustBeNumericOrLogical} = false
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org9e9d235" class="outline-3">
<h3 id="org9e9d235">Structure initialization</h3>
<div class="outline-text-3" id="text-org9e9d235">
<p>
First, we initialize the <code>rz</code> structure.
</p>
<div class="org-src-container">
<pre class="src src-matlab">rz = struct();
</pre>
</div>
</div>
</div>
<div id="outline-container-orge5b17ec" class="outline-3">
<h3 id="orge5b17ec">Add Spindle Type</h3>
<div class="outline-text-3" id="text-orge5b17ec">
<div class="org-src-container">
<pre class="src src-matlab">switch args.type
case 'none'
rz.type = 0;
case 'rigid'
rz.type = 1;
case 'flexible'
rz.type = 2;
case 'modal-analysis'
rz.type = 3;
case 'init'
rz.type = 4;
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org983c7f6" class="outline-3">
<h3 id="org983c7f6">Material and Geometry</h3>
<div class="outline-text-3" id="text-org983c7f6">
<p>
Properties of the Material and link to the geometry of the spindle.
</p>
<div class="org-src-container">
<pre class="src src-matlab">% Spindle - Slip Ring
rz.slipring.density = 7800; % [kg/m3]
rz.slipring.STEP = './STEPS/rz/Spindle_Slip_Ring.STEP';
% Spindle - Rotor
rz.rotor.density = 7800; % [kg/m3]
rz.rotor.STEP = './STEPS/rz/Spindle_Rotor.STEP';
% Spindle - Stator
rz.stator.density = 7800; % [kg/m3]
rz.stator.STEP = './STEPS/rz/Spindle_Stator.STEP';
</pre>
</div>
</div>
</div>
<div id="outline-container-org382b0d7" class="outline-3">
<h3 id="org382b0d7">Stiffness and Damping properties</h3>
<div class="outline-text-3" id="text-org382b0d7">
<div class="org-src-container">
<pre class="src src-matlab">rz.K = [7e8; 7e8; 2e9; 1e7; 1e7; 1e7];
rz.C = [4e4; 4e4; 7e4; 1e4; 1e4; 1e4];
</pre>
</div>
</div>
</div>
<div id="outline-container-org1bf65fa" class="outline-3">
<h3 id="org1bf65fa">Equilibrium position of the each joint.</h3>
<div class="outline-text-3" id="text-org1bf65fa">
<div class="org-src-container">
<pre class="src src-matlab">if args.Foffset &amp;&amp; ~strcmp(args.type, 'none') &amp;&amp; ~strcmp(args.type, 'rigid') &amp;&amp; ~strcmp(args.type, 'init')
load('mat/Foffset.mat', 'Fzm');
rz.Deq = -Fzm'./rz.K;
else
rz.Deq = zeros(6,1);
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org63987aa" class="outline-3">
<h3 id="org63987aa">Save the Structure</h3>
<div class="outline-text-3" id="text-org63987aa">
<p>
The <code>rz</code> structure is saved.
</p>
<div class="org-src-container">
<pre class="src src-matlab">save('./mat/stages.mat', 'rz', '-append');
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org8ba04e2" class="outline-2">
<h2 id="org8ba04e2"><span class="section-number-2">8</span> Micro Hexapod</h2>
<div class="outline-text-2" id="text-8">
<p>
<a id="org01254ae"></a>
</p>
</div>
<div id="outline-container-org0e3daf2" class="outline-3">
<h3 id="org0e3daf2">Simscape Model</h3>
<div class="outline-text-3" id="text-org0e3daf2">
<div id="org13345ec" class="figure">
<p><img src="figs/images/simscape_model_micro_hexapod.png" alt="simscape_model_micro_hexapod.png" />
</p>
<p><span class="figure-number">Figure 12: </span>Simscape model for the Micro-Hexapod</p>
</div>
<div id="orga63e01a" class="figure">
<p><img src="figs/images/simscape_picture_micro_hexapod.png" alt="simscape_picture_micro_hexapod.png" />
</p>
<p><span class="figure-number">Figure 13: </span>Simscape picture for the Micro-Hexapod</p>
</div>
</div>
</div>
<div id="outline-container-org417ab1a" class="outline-3">
<h3 id="org417ab1a">Function description</h3>
<div class="outline-text-3" id="text-org417ab1a">
<div class="org-src-container">
<pre class="src src-matlab">function [micro_hexapod] = initializeMicroHexapod(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-orgfab542c" class="outline-3">
<h3 id="orgfab542c">Optional Parameters</h3>
<div class="outline-text-3" id="text-orgfab542c">
<div class="org-src-container">
<pre class="src src-matlab">arguments
args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible', 'modal-analysis', 'init', 'compliance'})} = 'flexible'
% initializeFramesPositions
args.H (1,1) double {mustBeNumeric, mustBePositive} = 350e-3
args.MO_B (1,1) double {mustBeNumeric} = 270e-3
% generateGeneralConfiguration
args.FH (1,1) double {mustBeNumeric, mustBePositive} = 50e-3
args.FR (1,1) double {mustBeNumeric, mustBePositive} = 175.5e-3
args.FTh (6,1) double {mustBeNumeric} = [-10, 10, 120-10, 120+10, 240-10, 240+10]*(pi/180)
args.MH (1,1) double {mustBeNumeric, mustBePositive} = 45e-3
args.MR (1,1) double {mustBeNumeric, mustBePositive} = 118e-3
args.MTh (6,1) double {mustBeNumeric} = [-60+10, 60-10, 60+10, 180-10, 180+10, -60-10]*(pi/180)
% initializeStrutDynamics
args.Ki (6,1) double {mustBeNumeric, mustBeNonnegative} = 2e7*ones(6,1)
args.Ci (6,1) double {mustBeNumeric, mustBeNonnegative} = 1.4e3*ones(6,1)
% initializeCylindricalPlatforms
args.Fpm (1,1) double {mustBeNumeric, mustBePositive} = 10
args.Fph (1,1) double {mustBeNumeric, mustBePositive} = 26e-3
args.Fpr (1,1) double {mustBeNumeric, mustBePositive} = 207.5e-3
args.Mpm (1,1) double {mustBeNumeric, mustBePositive} = 10
args.Mph (1,1) double {mustBeNumeric, mustBePositive} = 26e-3
args.Mpr (1,1) double {mustBeNumeric, mustBePositive} = 150e-3
% initializeCylindricalStruts
args.Fsm (1,1) double {mustBeNumeric, mustBePositive} = 1
args.Fsh (1,1) double {mustBeNumeric, mustBePositive} = 100e-3
args.Fsr (1,1) double {mustBeNumeric, mustBePositive} = 25e-3
args.Msm (1,1) double {mustBeNumeric, mustBePositive} = 1
args.Msh (1,1) double {mustBeNumeric, mustBePositive} = 100e-3
args.Msr (1,1) double {mustBeNumeric, mustBePositive} = 25e-3
% inverseKinematics
args.AP (3,1) double {mustBeNumeric} = zeros(3,1)
args.ARB (3,3) double {mustBeNumeric} = eye(3)
% Force that stiffness of each joint should apply at t=0
args.Foffset logical {mustBeNumericOrLogical} = false
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org0737b17" class="outline-3">
<h3 id="org0737b17">Function content</h3>
<div class="outline-text-3" id="text-org0737b17">
<div class="org-src-container">
<pre class="src src-matlab">stewart = initializeStewartPlatform();
stewart = initializeFramesPositions(stewart, ...
'H', args.H, ...
'MO_B', args.MO_B);
stewart = generateGeneralConfiguration(stewart, ...
'FH', args.FH, ...
'FR', args.FR, ...
'FTh', args.FTh, ...
'MH', args.MH, ...
'MR', args.MR, ...
'MTh', args.MTh);
stewart = computeJointsPose(stewart);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">stewart = initializeStrutDynamics(stewart, ...
'K', args.Ki, ...
'C', args.Ci);
stewart = initializeJointDynamics(stewart, ...
'type_F', 'universal_p', ...
'type_M', 'spherical_p');
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">stewart = initializeCylindricalPlatforms(stewart, ...
'Fpm', args.Fpm, ...
'Fph', args.Fph, ...
'Fpr', args.Fpr, ...
'Mpm', args.Mpm, ...
'Mph', args.Mph, ...
'Mpr', args.Mpr);
stewart = initializeCylindricalStruts(stewart, ...
'Fsm', args.Fsm, ...
'Fsh', args.Fsh, ...
'Fsr', args.Fsr, ...
'Msm', args.Msm, ...
'Msh', args.Msh, ...
'Msr', args.Msr);
stewart = computeJacobian(stewart);
stewart = initializeStewartPose(stewart, ...
'AP', args.AP, ...
'ARB', args.ARB);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">stewart = initializeInertialSensor(stewart, 'type', 'none');
</pre>
</div>
<p>
Equilibrium position of the each joint.
</p>
<div class="org-src-container">
<pre class="src src-matlab">if args.Foffset &amp;&amp; ~strcmp(args.type, 'none') &amp;&amp; ~strcmp(args.type, 'rigid') &amp;&amp; ~strcmp(args.type, 'init')
load('mat/Foffset.mat', 'Fhm');
stewart.actuators.dLeq = -Fhm'./args.Ki;
else
stewart.actuators.dLeq = zeros(6,1);
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org106cc19" class="outline-3">
<h3 id="org106cc19">Add Type</h3>
<div class="outline-text-3" id="text-org106cc19">
<div class="org-src-container">
<pre class="src src-matlab">switch args.type
case 'none'
stewart.type = 0;
case 'rigid'
stewart.type = 1;
case 'flexible'
stewart.type = 2;
case 'modal-analysis'
stewart.type = 3;
case 'init'
stewart.type = 4;
case 'compliance'
stewart.type = 5;
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org4eb0d4a" class="outline-3">
<h3 id="org4eb0d4a">Save the Structure</h3>
<div class="outline-text-3" id="text-org4eb0d4a">
<p>
The <code>micro_hexapod</code> structure is saved.
</p>
<div class="org-src-container">
<pre class="src src-matlab">micro_hexapod = stewart;
save('./mat/stages.mat', 'micro_hexapod', '-append');
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orga55d418" class="outline-2">
<h2 id="orga55d418"><span class="section-number-2">9</span> Center of gravity compensation</h2>
<div class="outline-text-2" id="text-9">
<p>
<a id="org9989724"></a>
</p>
</div>
<div id="outline-container-org5d43556" class="outline-3">
<h3 id="org5d43556">Simscape Model</h3>
<div class="outline-text-3" id="text-org5d43556">
<p>
The Simscape model of the Center of gravity compensator is composed of:
</p>
<ul class="org-ul">
<li>One main solid that is connected to two other solids (the masses to position of center of mass) through two revolute joints</li>
<li>The angle of both revolute joints is set by the input</li>
</ul>
<div id="orge09d585" class="figure">
<p><img src="figs/images/simscape_model_axisc.png" alt="simscape_model_axisc.png" />
</p>
<p><span class="figure-number">Figure 14: </span>Simscape model for the Center of Mass compensation system</p>
</div>
<div id="orga3d0932" class="figure">
<p><img src="figs/images/simscape_picture_axisc.png" alt="simscape_picture_axisc.png" />
</p>
<p><span class="figure-number">Figure 15: </span>Simscape picture for the Center of Mass compensation system</p>
</div>
</div>
</div>
<div id="outline-container-org9aabdd7" class="outline-3">
<h3 id="org9aabdd7">Function description</h3>
<div class="outline-text-3" id="text-org9aabdd7">
<div class="org-src-container">
<pre class="src src-matlab">function [axisc] = initializeAxisc(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-orge20b2d4" class="outline-3">
<h3 id="orge20b2d4">Optional Parameters</h3>
<div class="outline-text-3" id="text-orge20b2d4">
<div class="org-src-container">
<pre class="src src-matlab">arguments
args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible'
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org86f3836" class="outline-3">
<h3 id="org86f3836">Structure initialization</h3>
<div class="outline-text-3" id="text-org86f3836">
<p>
First, we initialize the <code>axisc</code> structure.
</p>
<div class="org-src-container">
<pre class="src src-matlab">axisc = struct();
</pre>
</div>
</div>
</div>
<div id="outline-container-org704283e" class="outline-3">
<h3 id="org704283e">Add Type</h3>
<div class="outline-text-3" id="text-org704283e">
<div class="org-src-container">
<pre class="src src-matlab">switch args.type
case 'none'
axisc.type = 0;
case 'rigid'
axisc.type = 1;
case 'flexible'
axisc.type = 2;
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org4190b86" class="outline-3">
<h3 id="org4190b86">Material and Geometry</h3>
<div class="outline-text-3" id="text-org4190b86">
<p>
Properties of the Material and link to the geometry files.
</p>
<div class="org-src-container">
<pre class="src src-matlab">% Structure
axisc.structure.density = 3400; % [kg/m3]
axisc.structure.STEP = './STEPS/axisc/axisc_structure.STEP';
% Wheel
axisc.wheel.density = 2700; % [kg/m3]
axisc.wheel.STEP = './STEPS/axisc/axisc_wheel.STEP';
% Mass
axisc.mass.density = 7800; % [kg/m3]
axisc.mass.STEP = './STEPS/axisc/axisc_mass.STEP';
% Gear
axisc.gear.density = 7800; % [kg/m3]
axisc.gear.STEP = './STEPS/axisc/axisc_gear.STEP';
</pre>
</div>
</div>
</div>
<div id="outline-container-org13006e5" class="outline-3">
<h3 id="org13006e5">Save the Structure</h3>
<div class="outline-text-3" id="text-org13006e5">
<p>
The <code>axisc</code> structure is saved.
</p>
<div class="org-src-container">
<pre class="src src-matlab">save('./mat/stages.mat', 'axisc', '-append');
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org7586ab7" class="outline-2">
<h2 id="org7586ab7"><span class="section-number-2">10</span> Mirror</h2>
<div class="outline-text-2" id="text-10">
<p>
<a id="org3d670bf"></a>
</p>
</div>
<div id="outline-container-org55c7837" class="outline-3">
<h3 id="org55c7837">Simscape Model</h3>
<div class="outline-text-3" id="text-org55c7837">
<p>
The Simscape Model of the mirror is just a solid body.
The output <code>mirror_center</code> corresponds to the center of the Sphere and is the point of measurement for the metrology
</p>
<div id="org281f48a" class="figure">
<p><img src="figs/images/simscape_model_mirror.png" alt="simscape_model_mirror.png" />
</p>
<p><span class="figure-number">Figure 16: </span>Simscape model for the Mirror</p>
</div>
<div id="orgf4fa701" class="figure">
<p><img src="figs/images/simscape_picture_mirror.png" alt="simscape_picture_mirror.png" />
</p>
<p><span class="figure-number">Figure 17: </span>Simscape picture for the Mirror</p>
</div>
</div>
</div>
<div id="outline-container-orga32f53e" class="outline-3">
<h3 id="orga32f53e">Function description</h3>
<div class="outline-text-3" id="text-orga32f53e">
<div class="org-src-container">
<pre class="src src-matlab">function [] = initializeMirror(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-org4b6fb5d" class="outline-3">
<h3 id="org4b6fb5d">Optional Parameters</h3>
<div class="outline-text-3" id="text-org4b6fb5d">
<div class="org-src-container">
<pre class="src src-matlab">arguments
args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'rigid'
args.shape char {mustBeMember(args.shape,{'spherical', 'conical'})} = 'spherical'
args.angle (1,1) double {mustBeNumeric, mustBePositive} = 45 % [deg]
args.mass (1,1) double {mustBeNumeric, mustBePositive} = 10 % [kg]
args.freq (6,1) double {mustBeNumeric, mustBeNonnegative} = 200*ones(6,1) % [Hz]
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org86bba59" class="outline-3">
<h3 id="org86bba59">Structure initialization</h3>
<div class="outline-text-3" id="text-org86bba59">
<p>
First, we initialize the <code>mirror</code> structure.
</p>
<div class="org-src-container">
<pre class="src src-matlab">mirror = struct();
</pre>
</div>
</div>
</div>
<div id="outline-container-orgff14824" class="outline-3">
<h3 id="orgff14824">Add Mirror Type</h3>
<div class="outline-text-3" id="text-orgff14824">
<div class="org-src-container">
<pre class="src src-matlab">switch args.type
case 'none'
mirror.type = 0;
case 'rigid'
mirror.type = 1;
case 'flexible'
mirror.type = 2;
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org4ad73aa" class="outline-3">
<h3 id="org4ad73aa">Mass and Inertia</h3>
<div class="outline-text-3" id="text-org4ad73aa">
<div class="org-src-container">
<pre class="src src-matlab">mirror.mass = args.mass;
mirror.freq = args.freq;
</pre>
</div>
</div>
</div>
<div id="outline-container-org7e63798" class="outline-3">
<h3 id="org7e63798">Stiffness and Damping properties</h3>
<div class="outline-text-3" id="text-org7e63798">
<div class="org-src-container">
<pre class="src src-matlab">mirror.K = zeros(6,1);
mirror.K(1:3) = mirror.mass * (2*pi*mirror.freq(1:3)).^2;
mirror.C = zeros(6,1);
mirror.C(1:3) = 0.2 * sqrt(mirror.K(1:3).*mirror.mass);
</pre>
</div>
</div>
</div>
<div id="outline-container-org7d51c2b" class="outline-3">
<h3 id="org7d51c2b">Equilibrium position of the each joint.</h3>
<div class="outline-text-3" id="text-org7d51c2b">
<div class="org-src-container">
<pre class="src src-matlab">mirror.Deq = zeros(6,1);
</pre>
</div>
</div>
</div>
<div id="outline-container-orgc381755" class="outline-3">
<h3 id="orgc381755">Geometry</h3>
<div class="outline-text-3" id="text-orgc381755">
<p>
We define the geometrical values.
</p>
<div class="org-src-container">
<pre class="src src-matlab">mirror.h = 0.05; % Height of the mirror [m]
mirror.thickness = 0.025; % Thickness of the plate supporting the sample [m]
mirror.hole_rad = 0.125; % radius of the hole in the mirror [m]
mirror.support_rad = 0.1; % radius of the support plate [m]
% point of interest offset in z (above the top surfave) [m]
switch args.type
case 'none'
mirror.jacobian = 0.20;
case 'rigid'
mirror.jacobian = 0.20 - mirror.h;
case 'flexible'
mirror.jacobian = 0.20 - mirror.h;
end
mirror.rad = 0.180; % radius of the mirror (at the bottom surface) [m]
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">mirror.cone_length = mirror.rad*tand(args.angle)+mirror.h+mirror.jacobian; % Distance from Apex point of the cone to jacobian point
</pre>
</div>
<p>
Now we define the Shape of the mirror.
We first start with the internal part.
</p>
<div class="org-src-container">
<pre class="src src-matlab">mirror.shape = [...
mirror.support_rad+5e-3 mirror.h-mirror.thickness
mirror.hole_rad mirror.h-mirror.thickness; ...
mirror.hole_rad 0; ...
mirror.rad 0 ...
];
</pre>
</div>
<p>
Then, we define the reflective used part of the mirror.
</p>
<div class="org-src-container">
<pre class="src src-matlab">if strcmp(args.shape, 'spherical')
mirror.sphere_radius = sqrt((mirror.jacobian+mirror.h)^2+mirror.rad^2); % Radius of the sphere [mm]
for z = linspace(0, mirror.h, 101)
mirror.shape = [mirror.shape; sqrt(mirror.sphere_radius^2-(z-mirror.jacobian-mirror.h)^2) z];
end
elseif strcmp(args.shape, 'conical')
mirror.shape = [mirror.shape; mirror.rad+mirror.h/tand(args.angle) mirror.h];
else
error('Shape should be either conical or spherical');
end
</pre>
</div>
<p>
Finally, we close the shape.
</p>
<div class="org-src-container">
<pre class="src src-matlab">mirror.shape = [mirror.shape; mirror.support_rad+5e-3 mirror.h];
</pre>
</div>
</div>
</div>
<div id="outline-container-org0b94a9c" class="outline-3">
<h3 id="org0b94a9c">Save the Structure</h3>
<div class="outline-text-3" id="text-org0b94a9c">
<p>
The <code>mirror</code> structure is saved.
</p>
<div class="org-src-container">
<pre class="src src-matlab">save('./mat/stages.mat', 'mirror', '-append');
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org34337a8" class="outline-2">
<h2 id="org34337a8"><span class="section-number-2">11</span> Nano Hexapod</h2>
<div class="outline-text-2" id="text-11">
<p>
<a id="org9a9721e"></a>
</p>
</div>
<div id="outline-container-org434641f" class="outline-3">
<h3 id="org434641f">Simscape Model</h3>
<div class="outline-text-3" id="text-org434641f">
<div id="orga6643fc" class="figure">
<p><img src="figs/images/simscape_model_nano_hexapod.png" alt="simscape_model_nano_hexapod.png" />
</p>
<p><span class="figure-number">Figure 18: </span>Simscape model for the Nano Hexapod</p>
</div>
<div id="org4d9fd08" class="figure">
<p><img src="figs/images/simscape_picture_nano_hexapod.png" alt="simscape_picture_nano_hexapod.png" />
</p>
<p><span class="figure-number">Figure 19: </span>Simscape picture for the Nano Hexapod</p>
</div>
</div>
</div>
<div id="outline-container-orga87da5a" class="outline-3">
<h3 id="orga87da5a">Function description</h3>
<div class="outline-text-3" id="text-orga87da5a">
<div class="org-src-container">
<pre class="src src-matlab">function [nano_hexapod] = initializeNanoHexapod(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-orgcfe66f4" class="outline-3">
<h3 id="orgcfe66f4">Optional Parameters</h3>
<div class="outline-text-3" id="text-orgcfe66f4">
<div class="org-src-container">
<pre class="src src-matlab">arguments
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
% generateGeneralConfiguration
args.FH (1,1) double {mustBeNumeric, mustBePositive} = 15e-3
args.FR (1,1) double {mustBeNumeric, mustBePositive} = 100e-3
args.FTh (6,1) double {mustBeNumeric} = [-10, 10, 120-10, 120+10, 240-10, 240+10]*(pi/180)
args.MH (1,1) double {mustBeNumeric, mustBePositive} = 15e-3
args.MR (1,1) double {mustBeNumeric, mustBePositive} = 90e-3
args.MTh (6,1) double {mustBeNumeric} = [-60+10, 60-10, 60+10, 180-10, 180+10, -60-10]*(pi/180)
% initializeStrutDynamics
args.actuator char {mustBeMember(args.actuator,{'piezo', 'lorentz', 'amplified'})} = 'piezo'
args.k1 (1,1) double {mustBeNumeric} = 1e6
args.ke (1,1) double {mustBeNumeric} = 5e6
args.ka (1,1) double {mustBeNumeric} = 60e6
args.c1 (1,1) double {mustBeNumeric} = 10
args.ce (1,1) double {mustBeNumeric} = 10
args.ca (1,1) double {mustBeNumeric} = 10
args.k (1,1) double {mustBeNumeric} = -1
args.c (1,1) double {mustBeNumeric} = -1
% initializeJointDynamics
args.type_F char {mustBeMember(args.type_F,{'universal', 'spherical', 'universal_p', 'spherical_p', 'universal_3dof'})} = 'universal'
args.type_M char {mustBeMember(args.type_M,{'universal', 'spherical', 'universal_p', 'spherical_p', 'spherical_3dof'})} = 'spherical'
args.Kf_M (6,1) double {mustBeNumeric, mustBeNonnegative} = 15*ones(6,1)
args.Cf_M (6,1) double {mustBeNumeric, mustBeNonnegative} = 1e-4*ones(6,1)
args.Kt_M (6,1) double {mustBeNumeric, mustBeNonnegative} = 20*ones(6,1)
args.Ct_M (6,1) double {mustBeNumeric, mustBeNonnegative} = 1e-3*ones(6,1)
args.Kz_M (6,1) double {mustBeNumeric, mustBeNonnegative} = 60e6*ones(6,1)
args.Cz_M (6,1) double {mustBeNumeric, mustBeNonnegative} = 1e2*ones(6,1)
args.Kf_F (6,1) double {mustBeNumeric, mustBeNonnegative} = 15*ones(6,1)
args.Cf_F (6,1) double {mustBeNumeric, mustBeNonnegative} = 1e-4*ones(6,1)
args.Kt_F (6,1) double {mustBeNumeric, mustBeNonnegative} = 20*ones(6,1)
args.Ct_F (6,1) double {mustBeNumeric, mustBeNonnegative} = 1e-3*ones(6,1)
args.Kz_F (6,1) double {mustBeNumeric, mustBeNonnegative} = 60e6*ones(6,1)
args.Cz_F (6,1) double {mustBeNumeric, mustBeNonnegative} = 1e2*ones(6,1)
% initializeCylindricalPlatforms
args.Fpm (1,1) double {mustBeNumeric, mustBePositive} = 1
args.Fph (1,1) double {mustBeNumeric, mustBePositive} = 10e-3
args.Fpr (1,1) double {mustBeNumeric, mustBePositive} = 150e-3
args.Mpm (1,1) double {mustBeNumeric, mustBePositive} = 1
args.Mph (1,1) double {mustBeNumeric, mustBePositive} = 10e-3
args.Mpr (1,1) double {mustBeNumeric, mustBePositive} = 120e-3
% initializeCylindricalStruts
args.Fsm (1,1) double {mustBeNumeric, mustBePositive} = 0.1
args.Fsh (1,1) double {mustBeNumeric, mustBePositive} = 50e-3
args.Fsr (1,1) double {mustBeNumeric, mustBePositive} = 5e-3
args.Msm (1,1) double {mustBeNumeric, mustBePositive} = 0.1
args.Msh (1,1) double {mustBeNumeric, mustBePositive} = 50e-3
args.Msr (1,1) double {mustBeNumeric, mustBePositive} = 5e-3
% inverseKinematics
args.AP (3,1) double {mustBeNumeric} = zeros(3,1)
args.ARB (3,3) double {mustBeNumeric} = eye(3)
% Equilibrium position of each leg
args.dLeq (6,1) double {mustBeNumeric} = zeros(6,1)
% Force that stiffness of each joint should apply at t=0
args.Foffset logical {mustBeNumericOrLogical} = false
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org181d2af" class="outline-3">
<h3 id="org181d2af">Function content</h3>
<div class="outline-text-3" id="text-org181d2af">
<div class="org-src-container">
<pre class="src src-matlab">stewart = initializeStewartPlatform();
stewart = initializeFramesPositions(stewart, 'H', args.H, 'MO_B', args.MO_B);
stewart = generateGeneralConfiguration(stewart, 'FH', args.FH, 'FR', args.FR, 'FTh', args.FTh, 'MH', args.MH, 'MR', args.MR, 'MTh', args.MTh);
stewart = computeJointsPose(stewart);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">if args.k &gt; 0 &amp;&amp; args.c &gt; 0
stewart = initializeStrutDynamics(stewart, 'type', 'classical', 'K', args.k*ones(6,1), 'C', args.c*ones(6,1));
elseif args.k &gt; 0
stewart = initializeStrutDynamics(stewart, 'type', 'classical', 'K', args.k*ones(6,1), 'C', 1.5*sqrt(args.k)*ones(6,1));
elseif strcmp(args.actuator, 'piezo')
stewart = initializeStrutDynamics(stewart, 'type', 'classical', 'K', 1e7*ones(6,1), 'C', 1e2*ones(6,1));
elseif strcmp(args.actuator, 'lorentz')
stewart = initializeStrutDynamics(stewart, 'type', 'classical', 'K', 1e4*ones(6,1), 'C', 1e2*ones(6,1));
elseif strcmp(args.actuator, 'amplified')
stewart = initializeStrutDynamics(stewart, 'type', 'amplified', ...
'k1', args.k1*ones(6,1), ...
'c1', args.c1*ones(6,1), ...
'ka', args.ka*ones(6,1), ...
'ca', args.ca*ones(6,1), ...
'ke', args.ke*ones(6,1), ...
'ce', args.ce*ones(6,1));
else
error('args.actuator should be piezo, lorentz or amplified');
end
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">stewart = initializeJointDynamics(stewart, ...
'type_F', args.type_F, ...
'type_M', args.type_M, ...
'Kf_M' , args.Kf_M, ...
'Cf_M' , args.Cf_M, ...
'Kt_M' , args.Kt_M, ...
'Ct_M' , args.Ct_M, ...
'Kz_M' , args.Kz_M, ...
'Cz_M' , args.Cz_M, ...
'Kf_F' , args.Kf_F, ...
'Cf_F' , args.Cf_F, ...
'Kt_F' , args.Kt_F, ...
'Ct_F' , args.Ct_F, ...
'Kz_F' , args.Kz_F, ...
'Cz_F' , args.Cz_F);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">stewart = initializeCylindricalPlatforms(stewart, 'Fpm', args.Fpm, 'Fph', args.Fph, 'Fpr', args.Fpr, 'Mpm', args.Mpm, 'Mph', args.Mph, 'Mpr', args.Mpr);
stewart = initializeCylindricalStruts(stewart, 'Fsm', args.Fsm, 'Fsh', args.Fsh, 'Fsr', args.Fsr, 'Msm', args.Msm, 'Msh', args.Msh, 'Msr', args.Msr);
stewart = computeJacobian(stewart);
stewart = initializeStewartPose(stewart, 'AP', args.AP, 'ARB', args.ARB);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">stewart = initializeInertialSensor(stewart, 'type', 'accelerometer');
</pre>
</div>
<p>
Equilibrium position of the each joint.
</p>
<div class="org-src-container">
<pre class="src src-matlab">
if args.Foffset &amp;&amp; ~strcmp(args.type, 'none') &amp;&amp; ~strcmp(args.type, 'rigid') &amp;&amp; ~strcmp(args.type, 'init')
load('mat/Foffset.mat', 'Fnm');
stewart.actuators.dLeq = -Fnm'./stewart.Ki;
else
stewart.actuators.dLeq = args.dLeq;
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org59a48c9" class="outline-3">
<h3 id="org59a48c9">Add Type</h3>
<div class="outline-text-3" id="text-org59a48c9">
<div class="org-src-container">
<pre class="src src-matlab">switch args.type
case 'none'
stewart.type = 0;
case 'rigid'
stewart.type = 1;
case 'flexible'
stewart.type = 2;
case 'init'
stewart.type = 4;
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org1dae879" class="outline-3">
<h3 id="org1dae879">Save the Structure</h3>
<div class="outline-text-3" id="text-org1dae879">
<div class="org-src-container">
<pre class="src src-matlab">nano_hexapod = stewart;
save('./mat/stages.mat', 'nano_hexapod', '-append');
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org3d615a1" class="outline-2">
<h2 id="org3d615a1"><span class="section-number-2">12</span> Sample</h2>
<div class="outline-text-2" id="text-12">
<p>
<a id="org9f0d804"></a>
</p>
</div>
<div id="outline-container-org5268fd9" class="outline-3">
<h3 id="org5268fd9">Simscape Model</h3>
<div class="outline-text-3" id="text-org5268fd9">
<p>
The Simscape model of the sample environment is composed of:
</p>
<ul class="org-ul">
<li>A rigid transform that can be used to translate the sample (position offset)</li>
<li>A cartesian joint to add some flexibility to the sample environment mount</li>
<li>A solid that represent the sample</li>
<li>An input is added to apply some external forces and torques at the center of the sample environment.
This could be the case for cable forces for instance.</li>
</ul>
<div id="org4bf20ba" class="figure">
<p><img src="figs/images/simscape_model_sample.png" alt="simscape_model_sample.png" />
</p>
<p><span class="figure-number">Figure 20: </span>Simscape model for the Sample</p>
</div>
<div id="orgfaf9137" class="figure">
<p><img src="figs/images/simscape_picture_sample.png" alt="simscape_picture_sample.png" />
</p>
<p><span class="figure-number">Figure 21: </span>Simscape picture for the Sample</p>
</div>
</div>
</div>
<div id="outline-container-org73bab13" class="outline-3">
<h3 id="org73bab13">Function description</h3>
<div class="outline-text-3" id="text-org73bab13">
<div class="org-src-container">
<pre class="src src-matlab">function [sample] = initializeSample(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-org60239c5" class="outline-3">
<h3 id="org60239c5">Optional Parameters</h3>
<div class="outline-text-3" id="text-org60239c5">
<div class="org-src-container">
<pre class="src src-matlab">arguments
args.type char {mustBeMember(args.type,{'rigid', 'flexible', 'none', 'init'})} = '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 (6,1) double {mustBeNumeric, mustBePositive} = 100*ones(6,1) % [Hz]
args.offset (1,1) double {mustBeNumeric} = 0 % [m]
args.Foffset logical {mustBeNumericOrLogical} = false
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org7441955" class="outline-3">
<h3 id="org7441955">Structure initialization</h3>
<div class="outline-text-3" id="text-org7441955">
<p>
First, we initialize the <code>sample</code> structure.
</p>
<div class="org-src-container">
<pre class="src src-matlab">sample = struct();
</pre>
</div>
</div>
</div>
<div id="outline-container-org2bb1d24" class="outline-3">
<h3 id="org2bb1d24">Add Sample Type</h3>
<div class="outline-text-3" id="text-org2bb1d24">
<div class="org-src-container">
<pre class="src src-matlab">switch args.type
case 'none'
sample.type = 0;
case 'rigid'
sample.type = 1;
case 'flexible'
sample.type = 2;
case 'init'
sample.type = 3;
end
</pre>
</div>
</div>
</div>
<div id="outline-container-orgb09a907" class="outline-3">
<h3 id="orgb09a907">Material and Geometry</h3>
<div class="outline-text-3" id="text-orgb09a907">
<p>
We define the geometrical parameters of the sample as well as its mass and position.
</p>
<div class="org-src-container">
<pre class="src src-matlab">sample.radius = args.radius; % [m]
sample.height = args.height; % [m]
sample.mass = args.mass; % [kg]
sample.offset = args.offset; % [m]
</pre>
</div>
</div>
</div>
<div id="outline-container-org228453f" class="outline-3">
<h3 id="org228453f">Compute the Inertia</h3>
<div class="outline-text-3" id="text-org228453f">
<div class="org-src-container">
<pre class="src src-matlab">sample.inertia = [1/12 * sample.mass * (3*sample.radius^2 + sample.height^2); ...
1/12 * sample.mass * (3*sample.radius^2 + sample.height^2); ...
1/2 * sample.mass * sample.radius^2];
</pre>
</div>
</div>
</div>
<div id="outline-container-org01454e2" class="outline-3">
<h3 id="org01454e2">Stiffness and Damping properties</h3>
<div class="outline-text-3" id="text-org01454e2">
<div class="org-src-container">
<pre class="src src-matlab">sample.K = zeros(6, 1);
sample.C = zeros(6, 1);
</pre>
</div>
<p>
Translation Stiffness and Damping:
</p>
<div class="org-src-container">
<pre class="src src-matlab">sample.K(1:3) = sample.mass .* (2*pi * args.freq(1:3)).^2; % [N/m]
sample.C(1:3) = 0.1 * sqrt(sample.K(1:3)*sample.mass); % [N/(m/s)]
</pre>
</div>
<p>
Rotational Stiffness and Damping:
</p>
<div class="org-src-container">
<pre class="src src-matlab">sample.K(4:6) = sample.inertia .* (2*pi * args.freq(4:6)).^2; % [N/m]
sample.C(4:6) = 0.1 * sqrt(sample.K(4:6).*sample.inertia); % [N/(m/s)]
</pre>
</div>
</div>
</div>
<div id="outline-container-org8c04d7a" class="outline-3">
<h3 id="org8c04d7a">Equilibrium position of the each joint.</h3>
<div class="outline-text-3" id="text-org8c04d7a">
<div class="org-src-container">
<pre class="src src-matlab">if args.Foffset &amp;&amp; ~strcmp(args.type, 'none') &amp;&amp; ~strcmp(args.type, 'rigid') &amp;&amp; ~strcmp(args.type, 'init')
load('mat/Foffset.mat', 'Fsm');
sample.Deq = -Fsm'./sample.K;
else
sample.Deq = zeros(6,1);
end
</pre>
</div>
</div>
</div>
<div id="outline-container-orgcc31def" class="outline-3">
<h3 id="orgcc31def">Save the Structure</h3>
<div class="outline-text-3" id="text-orgcc31def">
<p>
The <code>sample</code> structure is saved.
</p>
<div class="org-src-container">
<pre class="src src-matlab">save('./mat/stages.mat', 'sample', '-append');
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orge9cbdc9" class="outline-2">
<h2 id="orge9cbdc9"><span class="section-number-2">13</span> Initialize Controller</h2>
<div class="outline-text-2" id="text-13">
<p>
<a id="orgd0062b9"></a>
</p>
</div>
<div id="outline-container-orgf8f086e" class="outline-3">
<h3 id="orgf8f086e">Function Declaration and Documentation</h3>
<div class="outline-text-3" id="text-orgf8f086e">
<div class="org-src-container">
<pre class="src src-matlab">function [] = initializeController(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-org1eac675" class="outline-3">
<h3 id="org1eac675">Optional Parameters</h3>
<div class="outline-text-3" id="text-org1eac675">
<div class="org-src-container">
<pre class="src src-matlab">arguments
args.type char {mustBeMember(args.type,{'open-loop', 'iff', 'dvf', 'hac-dvf', 'ref-track-L', 'ref-track-iff-L', 'cascade-hac-lac', 'hac-iff', 'stabilizing'})} = 'open-loop'
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org0e8536c" class="outline-3">
<h3 id="org0e8536c">Structure initialization</h3>
<div class="outline-text-3" id="text-org0e8536c">
<p>
First, we initialize the <code>controller</code> structure.
</p>
<div class="org-src-container">
<pre class="src src-matlab">controller = struct();
</pre>
</div>
</div>
</div>
<div id="outline-container-org4207f98" class="outline-3">
<h3 id="org4207f98">Controller Type</h3>
<div class="outline-text-3" id="text-org4207f98">
<div class="org-src-container">
<pre class="src src-matlab">switch args.type
case 'open-loop'
controller.type = 1;
controller.name = 'Open-Loop';
case 'dvf'
controller.type = 2;
controller.name = 'Decentralized Direct Velocity Feedback';
case 'iff'
controller.type = 3;
controller.name = 'Decentralized Integral Force Feedback';
case 'hac-dvf'
controller.type = 4;
controller.name = 'HAC-DVF';
case 'ref-track-L'
controller.type = 5;
controller.name = 'Reference Tracking in the frame of the legs';
case 'ref-track-iff-L'
controller.type = 6;
controller.name = 'Reference Tracking in the frame of the legs + IFF';
case 'cascade-hac-lac'
controller.type = 7;
controller.name = 'Cascade Control + HAC-LAC';
case 'hac-iff'
controller.type = 8;
controller.name = 'HAC-IFF';
case 'stabilizing'
controller.type = 9;
controller.name = 'Stabilizing Controller';
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org0b9e4dd" class="outline-3">
<h3 id="org0b9e4dd">Save the Structure</h3>
<div class="outline-text-3" id="text-org0b9e4dd">
<p>
The <code>controller</code> structure is saved.
</p>
<div class="org-src-container">
<pre class="src src-matlab">save('./mat/controller.mat', 'controller');
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgae5cb57" class="outline-2">
<h2 id="orgae5cb57"><span class="section-number-2">14</span> Generate Reference Signals</h2>
<div class="outline-text-2" id="text-14">
<p>
<a id="org5ace526"></a>
</p>
</div>
<div id="outline-container-orga062508" class="outline-3">
<h3 id="orga062508">Function Declaration and Documentation</h3>
<div class="outline-text-3" id="text-orga062508">
<div class="org-src-container">
<pre class="src src-matlab">function [ref] = initializeReferences(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-orgc42aa5f" class="outline-3">
<h3 id="orgc42aa5f">Optional Parameters</h3>
<div class="outline-text-3" id="text-orgc42aa5f">
<div class="org-src-container">
<pre class="src src-matlab">arguments
% Sampling Frequency [s]
args.Ts (1,1) double {mustBeNumeric, mustBePositive} = 1e-3
% Maximum simulation time [s]
args.Tmax (1,1) double {mustBeNumeric, mustBePositive} = 100
% Either "constant" / "triangular" / "sinusoidal"
args.Dy_type char {mustBeMember(args.Dy_type,{'constant', 'triangular', 'sinusoidal'})} = 'constant'
% Amplitude of the displacement [m]
args.Dy_amplitude (1,1) double {mustBeNumeric} = 0
% Period of the displacement [s]
args.Dy_period (1,1) double {mustBeNumeric, mustBePositive} = 1
% Either "constant" / "triangular" / "sinusoidal"
args.Ry_type char {mustBeMember(args.Ry_type,{'constant', 'triangular', 'sinusoidal'})} = 'constant'
% Amplitude [rad]
args.Ry_amplitude (1,1) double {mustBeNumeric} = 0
% Period of the displacement [s]
args.Ry_period (1,1) double {mustBeNumeric, mustBePositive} = 1
% Either "constant" / "rotating"
args.Rz_type char {mustBeMember(args.Rz_type,{'constant', 'rotating', 'rotating-not-filtered'})} = 'constant'
% Initial angle [rad]
args.Rz_amplitude (1,1) double {mustBeNumeric} = 0
% Period of the rotating [s]
args.Rz_period (1,1) double {mustBeNumeric, mustBePositive} = 1
% For now, only constant is implemented
args.Dh_type char {mustBeMember(args.Dh_type,{'constant'})} = 'constant'
% Initial position [m,m,m,rad,rad,rad] of the top platform (Pitch-Roll-Yaw Euler angles)
args.Dh_pos (6,1) double {mustBeNumeric} = zeros(6, 1), ...
% For now, only constant is implemented
args.Rm_type char {mustBeMember(args.Rm_type,{'constant'})} = 'constant'
% Initial position of the two masses
args.Rm_pos (2,1) double {mustBeNumeric} = [0; pi]
% For now, only constant is implemented
args.Dn_type char {mustBeMember(args.Dn_type,{'constant'})} = 'constant'
% Initial position [m,m,m,rad,rad,rad] of the top platform
args.Dn_pos (6,1) double {mustBeNumeric} = zeros(6,1)
end
</pre>
</div>
</div>
</div>
<div id="outline-container-orge94c0c2" class="outline-3">
<h3 id="orge94c0c2">Initialize Parameters</h3>
<div class="outline-text-3" id="text-orge94c0c2">
<div class="org-src-container">
<pre class="src src-matlab">%% Set Sampling Time
Ts = args.Ts;
Tmax = args.Tmax;
%% Low Pass Filter to filter out the references
s = zpk('s');
w0 = 2*pi*10;
xi = 1;
H_lpf = 1/(1 + 2*xi/w0*s + s^2/w0^2);
</pre>
</div>
</div>
</div>
<div id="outline-container-org5e56bf2" class="outline-3">
<h3 id="org5e56bf2">Translation Stage</h3>
<div class="outline-text-3" id="text-org5e56bf2">
<div class="org-src-container">
<pre class="src src-matlab">%% Translation stage - Dy
t = 0:Ts:Tmax; % Time Vector [s]
Dy = zeros(length(t), 1);
Dyd = zeros(length(t), 1);
Dydd = zeros(length(t), 1);
switch args.Dy_type
case 'constant'
Dy(:) = args.Dy_amplitude;
Dyd(:) = 0;
Dydd(:) = 0;
case 'triangular'
% This is done to unsure that we start with no displacement
Dy_raw = args.Dy_amplitude*sawtooth(2*pi*t/args.Dy_period,1/2);
i0 = find(t&gt;=args.Dy_period/4,1);
Dy(1:end-i0+1) = Dy_raw(i0:end);
Dy(end-i0+2:end) = Dy_raw(end); % we fix the last value
% The signal is filtered out
Dy = lsim(H_lpf, Dy, t);
Dyd = lsim(H_lpf*s, Dy, t);
Dydd = lsim(H_lpf*s^2, Dy, t);
case 'sinusoidal'
Dy(:) = args.Dy_amplitude*sin(2*pi/args.Dy_period*t);
Dyd = args.Dy_amplitude*2*pi/args.Dy_period*cos(2*pi/args.Dy_period*t);
Dydd = -args.Dy_amplitude*(2*pi/args.Dy_period)^2*sin(2*pi/args.Dy_period*t);
otherwise
warning('Dy_type is not set correctly');
end
Dy = struct('time', t, 'signals', struct('values', Dy), 'deriv', Dyd, 'dderiv', Dydd);
</pre>
</div>
</div>
</div>
<div id="outline-container-orgfb9d278" class="outline-3">
<h3 id="orgfb9d278">Tilt Stage</h3>
<div class="outline-text-3" id="text-orgfb9d278">
<div class="org-src-container">
<pre class="src src-matlab">%% Tilt Stage - Ry
t = 0:Ts:Tmax; % Time Vector [s]
Ry = zeros(length(t), 1);
Ryd = zeros(length(t), 1);
Rydd = zeros(length(t), 1);
switch args.Ry_type
case 'constant'
Ry(:) = args.Ry_amplitude;
Ryd(:) = 0;
Rydd(:) = 0;
case 'triangular'
Ry_raw = args.Ry_amplitude*sawtooth(2*pi*t/args.Ry_period,1/2);
i0 = find(t&gt;=args.Ry_period/4,1);
Ry(1:end-i0+1) = Ry_raw(i0:end);
Ry(end-i0+2:end) = Ry_raw(end); % we fix the last value
% The signal is filtered out
Ry = lsim(H_lpf, Ry, t);
Ryd = lsim(H_lpf*s, Ry, t);
Rydd = lsim(H_lpf*s^2, Ry, t);
case 'sinusoidal'
Ry(:) = args.Ry_amplitude*sin(2*pi/args.Ry_period*t);
Ryd = args.Ry_amplitude*2*pi/args.Ry_period*cos(2*pi/args.Ry_period*t);
Rydd = -args.Ry_amplitude*(2*pi/args.Ry_period)^2*sin(2*pi/args.Ry_period*t);
otherwise
warning('Ry_type is not set correctly');
end
Ry = struct('time', t, 'signals', struct('values', Ry), 'deriv', Ryd, 'dderiv', Rydd);
</pre>
</div>
</div>
</div>
<div id="outline-container-org6fe10ff" class="outline-3">
<h3 id="org6fe10ff">Spindle</h3>
<div class="outline-text-3" id="text-org6fe10ff">
<div class="org-src-container">
<pre class="src src-matlab">%% Spindle - Rz
t = 0:Ts:Tmax; % Time Vector [s]
Rz = zeros(length(t), 1);
Rzd = zeros(length(t), 1);
Rzdd = zeros(length(t), 1);
switch args.Rz_type
case 'constant'
Rz(:) = args.Rz_amplitude;
Rzd(:) = 0;
Rzdd(:) = 0;
case 'rotating-not-filtered'
Rz(:) = 2*pi/args.Rz_period*t;
% The signal is filtered out
Rz(:) = 2*pi/args.Rz_period*t;
Rzd(:) = 2*pi/args.Rz_period;
Rzdd(:) = 0;
% We add the angle offset
Rz = Rz + args.Rz_amplitude;
case 'rotating'
Rz(:) = 2*pi/args.Rz_period*t;
% The signal is filtered out
Rz = lsim(H_lpf, Rz, t);
Rzd = lsim(H_lpf*s, Rz, t);
Rzdd = lsim(H_lpf*s^2, Rz, t);
% We add the angle offset
Rz = Rz + args.Rz_amplitude;
otherwise
warning('Rz_type is not set correctly');
end
Rz = struct('time', t, 'signals', struct('values', Rz), 'deriv', Rzd, 'dderiv', Rzdd);
</pre>
</div>
</div>
</div>
<div id="outline-container-org1e01222" class="outline-3">
<h3 id="org1e01222">Micro Hexapod</h3>
<div class="outline-text-3" id="text-org1e01222">
<div class="org-src-container">
<pre class="src src-matlab">%% Micro-Hexapod
t = [0, Ts];
Dh = zeros(length(t), 6);
Dhl = zeros(length(t), 6);
switch args.Dh_type
case 'constant'
Dh = [args.Dh_pos, args.Dh_pos];
load('mat/stages.mat', 'micro_hexapod');
AP = [args.Dh_pos(1) ; args.Dh_pos(2) ; args.Dh_pos(3)];
tx = args.Dh_pos(4);
ty = args.Dh_pos(5);
tz = args.Dh_pos(6);
ARB = [cos(tz) -sin(tz) 0;
sin(tz) cos(tz) 0;
0 0 1]*...
[ cos(ty) 0 sin(ty);
0 1 0;
-sin(ty) 0 cos(ty)]*...
[1 0 0;
0 cos(tx) -sin(tx);
0 sin(tx) cos(tx)];
[~, Dhl] = inverseKinematics(micro_hexapod, 'AP', AP, 'ARB', ARB);
Dhl = [Dhl, Dhl];
otherwise
warning('Dh_type is not set correctly');
end
Dh = struct('time', t, 'signals', struct('values', Dh));
Dhl = struct('time', t, 'signals', struct('values', Dhl));
</pre>
</div>
</div>
</div>
<div id="outline-container-org04d73dc" class="outline-3">
<h3 id="org04d73dc">Axis Compensation</h3>
<div class="outline-text-3" id="text-org04d73dc">
<div class="org-src-container">
<pre class="src src-matlab">%% Axis Compensation - Rm
t = [0, Ts];
Rm = [args.Rm_pos, args.Rm_pos];
Rm = struct('time', t, 'signals', struct('values', Rm));
</pre>
</div>
</div>
</div>
<div id="outline-container-org26371bd" class="outline-3">
<h3 id="org26371bd">Nano Hexapod</h3>
<div class="outline-text-3" id="text-org26371bd">
<div class="org-src-container">
<pre class="src src-matlab">%% Nano-Hexapod
t = [0, Ts];
Dn = zeros(length(t), 6);
switch args.Dn_type
case 'constant'
Dn = [args.Dn_pos, args.Dn_pos];
load('mat/stages.mat', 'nano_hexapod');
AP = [args.Dn_pos(1) ; args.Dn_pos(2) ; args.Dn_pos(3)];
tx = args.Dn_pos(4);
ty = args.Dn_pos(5);
tz = args.Dn_pos(6);
ARB = [cos(tz) -sin(tz) 0;
sin(tz) cos(tz) 0;
0 0 1]*...
[ cos(ty) 0 sin(ty);
0 1 0;
-sin(ty) 0 cos(ty)]*...
[1 0 0;
0 cos(tx) -sin(tx);
0 sin(tx) cos(tx)];
[~, Dnl] = inverseKinematics(nano_hexapod, 'AP', AP, 'ARB', ARB);
Dnl = [Dnl, Dnl];
otherwise
warning('Dn_type is not set correctly');
end
Dn = struct('time', t, 'signals', struct('values', Dn));
Dnl = struct('time', t, 'signals', struct('values', Dnl));
</pre>
</div>
</div>
</div>
<div id="outline-container-org01d19da" class="outline-3">
<h3 id="org01d19da">Save</h3>
<div class="outline-text-3" id="text-org01d19da">
<div class="org-src-container">
<pre class="src src-matlab"> %% Save
save('./mat/nass_references.mat', 'Dy', 'Ry', 'Rz', 'Dh', 'Dhl', 'Rm', 'Dn', 'Dnl', 'args', 'Ts');
end
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org544c9dd" class="outline-2">
<h2 id="org544c9dd"><span class="section-number-2">15</span> Initialize Disturbances</h2>
<div class="outline-text-2" id="text-15">
<p>
<a id="org199c5f8"></a>
</p>
</div>
<div id="outline-container-org4eb2581" class="outline-3">
<h3 id="org4eb2581">Function Declaration and Documentation</h3>
<div class="outline-text-3" id="text-org4eb2581">
<div class="org-src-container">
<pre class="src src-matlab">function [] = initializeDisturbances(args)
% initializeDisturbances - Initialize the disturbances
%
% Syntax: [] = initializeDisturbances(args)
%
% Inputs:
% - args -
</pre>
</div>
</div>
</div>
<div id="outline-container-org69b114f" class="outline-3">
<h3 id="org69b114f">Optional Parameters</h3>
<div class="outline-text-3" id="text-org69b114f">
<div class="org-src-container">
<pre class="src src-matlab">arguments
% Global parameter to enable or disable the disturbances
args.enable logical {mustBeNumericOrLogical} = true
% Ground Motion - X direction
args.Dwx logical {mustBeNumericOrLogical} = true
% Ground Motion - Y direction
args.Dwy logical {mustBeNumericOrLogical} = true
% Ground Motion - Z direction
args.Dwz logical {mustBeNumericOrLogical} = true
% Translation Stage - X direction
args.Fty_x logical {mustBeNumericOrLogical} = true
% Translation Stage - Z direction
args.Fty_z logical {mustBeNumericOrLogical} = true
% Spindle - Z direction
args.Frz_z logical {mustBeNumericOrLogical} = true
end
</pre>
</div>
</div>
</div>
<div id="outline-container-orgf744aeb" class="outline-3">
<h3 id="orgf744aeb">Load Data</h3>
<div class="outline-text-3" id="text-orgf744aeb">
<div class="org-src-container">
<pre class="src src-matlab">load('./mat/dist_psd.mat', 'dist_f');
</pre>
</div>
<p>
We remove the first frequency point that usually is very large.
</p>
</div>
</div>
<div id="outline-container-org6c7d666" class="outline-3">
<h3 id="org6c7d666">Parameters</h3>
<div class="outline-text-3" id="text-org6c7d666">
<p>
We define some parameters that will be used in the algorithm.
</p>
<div class="org-src-container">
<pre class="src src-matlab">Fs = 2*dist_f.f(end); % Sampling Frequency of data is twice the maximum frequency of the PSD vector [Hz]
N = 2*length(dist_f.f); % Number of Samples match the one of the wanted PSD
T0 = N/Fs; % Signal Duration [s]
df = 1/T0; % Frequency resolution of the DFT [Hz]
% Also equal to (dist_f.f(2)-dist_f.f(1))
t = linspace(0, T0, N+1)'; % Time Vector [s]
Ts = 1/Fs; % Sampling Time [s]
</pre>
</div>
</div>
</div>
<div id="outline-container-orgb2108c4" class="outline-3">
<h3 id="orgb2108c4">Ground Motion</h3>
<div class="outline-text-3" id="text-orgb2108c4">
<div class="org-src-container">
<pre class="src src-matlab">phi = dist_f.psd_gm;
C = zeros(N/2,1);
for i = 1:N/2
C(i) = sqrt(phi(i)*df);
end
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">if args.Dwx &amp;&amp; args.enable
rng(111);
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
Cx = [Cx; flipud(conj(Cx(2:end)))];;
Dwx = N/sqrt(2)*ifft(Cx); % Ground Motion - x direction [m]
else
Dwx = zeros(length(t), 1);
end
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">if args.Dwy &amp;&amp; args.enable
rng(112);
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
Cx = [Cx; flipud(conj(Cx(2:end)))];;
Dwy = N/sqrt(2)*ifft(Cx); % Ground Motion - y direction [m]
else
Dwy = zeros(length(t), 1);
end
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">if args.Dwy &amp;&amp; args.enable
rng(113);
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
Cx = [Cx; flipud(conj(Cx(2:end)))];;
Dwz = N/sqrt(2)*ifft(Cx); % Ground Motion - z direction [m]
else
Dwz = zeros(length(t), 1);
end
</pre>
</div>
</div>
</div>
<div id="outline-container-orgb70c65e" class="outline-3">
<h3 id="orgb70c65e">Translation Stage - X direction</h3>
<div class="outline-text-3" id="text-orgb70c65e">
<div class="org-src-container">
<pre class="src src-matlab">if args.Fty_x &amp;&amp; args.enable
phi = dist_f.psd_ty; % TODO - we take here the vertical direction which is wrong but approximate
C = zeros(N/2,1);
for i = 1:N/2
C(i) = sqrt(phi(i)*df);
end
rng(121);
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
Cx = [Cx; flipud(conj(Cx(2:end)))];;
u = N/sqrt(2)*ifft(Cx); % Disturbance Force Ty x [N]
Fty_x = u;
else
Fty_x = zeros(length(t), 1);
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org070255a" class="outline-3">
<h3 id="org070255a">Translation Stage - Z direction</h3>
<div class="outline-text-3" id="text-org070255a">
<div class="org-src-container">
<pre class="src src-matlab">if args.Fty_z &amp;&amp; args.enable
phi = dist_f.psd_ty;
C = zeros(N/2,1);
for i = 1:N/2
C(i) = sqrt(phi(i)*df);
end
rng(122);
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
Cx = [Cx; flipud(conj(Cx(2:end)))];;
u = N/sqrt(2)*ifft(Cx); % Disturbance Force Ty z [N]
Fty_z = u;
else
Fty_z = zeros(length(t), 1);
end
</pre>
</div>
</div>
</div>
<div id="outline-container-orgfd5f32b" class="outline-3">
<h3 id="orgfd5f32b">Spindle - Z direction</h3>
<div class="outline-text-3" id="text-orgfd5f32b">
<div class="org-src-container">
<pre class="src src-matlab">if args.Frz_z &amp;&amp; args.enable
phi = dist_f.psd_rz;
C = zeros(N/2,1);
for i = 1:N/2
C(i) = sqrt(phi(i)*df);
end
rng(131);
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
Cx = [Cx; flipud(conj(Cx(2:end)))];;
u = N/sqrt(2)*ifft(Cx); % Disturbance Force Rz z [N]
Frz_z = u;
else
Frz_z = zeros(length(t), 1);
end
</pre>
</div>
</div>
</div>
<div id="outline-container-orgba4d479" class="outline-3">
<h3 id="orgba4d479">Direct Forces</h3>
<div class="outline-text-3" id="text-orgba4d479">
<div class="org-src-container">
<pre class="src src-matlab">u = zeros(length(t), 6);
Fd = u;
</pre>
</div>
</div>
</div>
<div id="outline-container-orgf6d2198" class="outline-3">
<h3 id="orgf6d2198">Set initial value to zero</h3>
<div class="outline-text-3" id="text-orgf6d2198">
<div class="org-src-container">
<pre class="src src-matlab">Dwx = Dwx - Dwx(1);
Dwy = Dwy - Dwy(1);
Dwz = Dwz - Dwz(1);
Fty_x = Fty_x - Fty_x(1);
Fty_z = Fty_z - Fty_z(1);
Frz_z = Frz_z - Frz_z(1);
</pre>
</div>
</div>
</div>
<div id="outline-container-orgca8d4ed" class="outline-3">
<h3 id="orgca8d4ed">Save</h3>
<div class="outline-text-3" id="text-orgca8d4ed">
<div class="org-src-container">
<pre class="src src-matlab">save('./mat/nass_disturbances.mat', 'Dwx', 'Dwy', 'Dwz', 'Fty_x', 'Fty_z', 'Frz_z', 'Fd', 'Ts', 't', 'args');
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgefb8a5e" class="outline-2">
<h2 id="orgefb8a5e"><span class="section-number-2">16</span> Initialize Position Errors</h2>
<div class="outline-text-2" id="text-16">
<p>
<a id="orga39c5fc"></a>
</p>
</div>
<div id="outline-container-org5e84eb6" class="outline-3">
<h3 id="org5e84eb6">Function Declaration and Documentation</h3>
<div class="outline-text-3" id="text-org5e84eb6">
<div class="org-src-container">
<pre class="src src-matlab">function [] = initializePosError(args)
% initializePosError - Initialize the position errors
%
% Syntax: [] = initializePosError(args)
%
% Inputs:
% - args -
</pre>
</div>
</div>
</div>
<div id="outline-container-org588a7a9" class="outline-3">
<h3 id="org588a7a9">Optional Parameters</h3>
<div class="outline-text-3" id="text-org588a7a9">
<div class="org-src-container">
<pre class="src src-matlab">arguments
args.error logical {mustBeNumericOrLogical} = false
args.Dy (1,1) double {mustBeNumeric} = 0 % [m]
args.Ry (1,1) double {mustBeNumeric} = 0 % [m]
args.Rz (1,1) double {mustBeNumeric} = 0 % [m]
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org9a662ce" class="outline-3">
<h3 id="org9a662ce">Structure initialization</h3>
<div class="outline-text-3" id="text-org9a662ce">
<p>
First, we initialize the <code>pos_error</code> structure.
</p>
<div class="org-src-container">
<pre class="src src-matlab">pos_error = struct();
</pre>
</div>
</div>
</div>
<div id="outline-container-orgc890f7d" class="outline-3">
<h3 id="orgc890f7d">Type</h3>
<div class="outline-text-3" id="text-orgc890f7d">
<div class="org-src-container">
<pre class="src src-matlab">if args.error
pos_error.type = 1;
else
pos_error.type = 0;
end
</pre>
</div>
</div>
</div>
<div id="outline-container-org7d50228" class="outline-3">
<h3 id="org7d50228">Position Errors</h3>
<div class="outline-text-3" id="text-org7d50228">
<div class="org-src-container">
<pre class="src src-matlab">pos_error.Dy = args.Dy;
pos_error.Ry = args.Ry;
pos_error.Rz = args.Rz;
</pre>
</div>
</div>
</div>
<div id="outline-container-orge5d3d7b" class="outline-3">
<h3 id="orge5d3d7b">Save</h3>
<div class="outline-text-3" id="text-orge5d3d7b">
<div class="org-src-container">
<pre class="src src-matlab">save('./mat/pos_error.mat', 'pos_error');
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgc87e890" class="outline-2">
<h2 id="orgc87e890"><span class="section-number-2">17</span> Z-Axis Geophone</h2>
<div class="outline-text-2" id="text-17">
<p>
<a id="orgda06de2"></a>
</p>
<div class="org-src-container">
<pre class="src src-matlab">function [geophone] = initializeZAxisGeophone(args)
arguments
args.mass (1,1) double {mustBeNumeric, mustBePositive} = 1e-3 % [kg]
args.freq (1,1) double {mustBeNumeric, mustBePositive} = 1 % [Hz]
end
%%
geophone.m = args.mass;
%% The Stiffness is set to have the damping resonance frequency
geophone.k = geophone.m * (2*pi*args.freq)^2;
%% We set the damping value to have critical damping
geophone.c = 2*sqrt(geophone.m * geophone.k);
%% Save
save('./mat/geophone_z_axis.mat', 'geophone');
end
</pre>
</div>
</div>
</div>
<div id="outline-container-orgcbddbd1" class="outline-2">
<h2 id="orgcbddbd1"><span class="section-number-2">18</span> Z-Axis Accelerometer</h2>
<div class="outline-text-2" id="text-18">
<p>
<a id="org071e205"></a>
</p>
<div class="org-src-container">
<pre class="src src-matlab">function [accelerometer] = initializeZAxisAccelerometer(args)
arguments
args.mass (1,1) double {mustBeNumeric, mustBePositive} = 1e-3 % [kg]
args.freq (1,1) double {mustBeNumeric, mustBePositive} = 5e3 % [Hz]
end
%%
accelerometer.m = args.mass;
%% The Stiffness is set to have the damping resonance frequency
accelerometer.k = accelerometer.m * (2*pi*args.freq)^2;
%% We set the damping value to have critical damping
accelerometer.c = 2*sqrt(accelerometer.m * accelerometer.k);
%% Gain correction of the accelerometer to have a unity gain until the resonance
accelerometer.gain = -accelerometer.k/accelerometer.m;
%% Save
save('./mat/accelerometer_z_axis.mat', 'accelerometer');
end
</pre>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
<p class="date">Created: 2020-07-31 ven. 17:58</p>
</div>
</body>
</html>