nass-simscape/docs/simscape_subsystems.html

2955 lines
91 KiB
HTML

<?xml version="1.0" encoding="utf-8"?>
<?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-05-05 mar. 10:33 -->
<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="#org246ce35">Function description</a></li>
<li><a href="#org27c3039">Optional Parameters</a></li>
<li><a href="#org4a0049b">Structure initialization</a></li>
<li><a href="#org1e0f7f4">Add Type</a></li>
<li><a href="#orgded6aac">Save the Structure</a></li>
</ul>
</li>
<li><a href="#orgdda6840">2. Logging Configuration</a>
<ul>
<li><a href="#org3fa6ef1">Function description</a></li>
<li><a href="#orgc8aac8f">Optional Parameters</a></li>
<li><a href="#orgd4d0599">Structure initialization</a></li>
<li><a href="#orgaffa81c">Add Type</a></li>
<li><a href="#org60d91f1">Sampling Time</a></li>
<li><a href="#org1d59f8f">Save the Structure</a></li>
</ul>
</li>
<li><a href="#org1bf1870">3. Ground</a>
<ul>
<li><a href="#org92b9277">Simscape Model</a></li>
<li><a href="#orgcfbce88">Function description</a></li>
<li><a href="#orga9eb2c7">Optional Parameters</a></li>
<li><a href="#org52bbc84">Structure initialization</a></li>
<li><a href="#orgad27bdf">Add Type</a></li>
<li><a href="#org4c31ca5">Ground Solid properties</a></li>
<li><a href="#org542691f">Rotation Point</a></li>
<li><a href="#org9f15b58">Save the Structure</a></li>
</ul>
</li>
<li><a href="#orga045749">4. Granite</a>
<ul>
<li><a href="#orga0a0825">Simscape Model</a></li>
<li><a href="#org06e1362">Function description</a></li>
<li><a href="#org3354a31">Optional Parameters</a></li>
<li><a href="#org4cf00fc">Structure initialization</a></li>
<li><a href="#org413c06d">Add Granite Type</a></li>
<li><a href="#org8f61ce3">Material and Geometry</a></li>
<li><a href="#org9976da6">Stiffness and Damping properties</a></li>
<li><a href="#orge84d6de">Equilibrium position of the each joint.</a></li>
<li><a href="#org559e245">Save the Structure</a></li>
</ul>
</li>
<li><a href="#org55e59c3">5. Translation Stage</a>
<ul>
<li><a href="#org6281028">Simscape Model</a></li>
<li><a href="#orgc6c8b46">Function description</a></li>
<li><a href="#org23338c4">Optional Parameters</a></li>
<li><a href="#org748d5ce">Structure initialization</a></li>
<li><a href="#org715e876">Add Translation Stage Type</a></li>
<li><a href="#org76a9860">Material and Geometry</a></li>
<li><a href="#orgab6ccf3">Stiffness and Damping properties</a></li>
<li><a href="#org10a4b27">Equilibrium position of the each joint.</a></li>
<li><a href="#org0951db0">Save the Structure</a></li>
</ul>
</li>
<li><a href="#orga4374f1">6. Tilt Stage</a>
<ul>
<li><a href="#orgf9af09c">Simscape Model</a></li>
<li><a href="#org88e197e">Function description</a></li>
<li><a href="#org438cbb4">Optional Parameters</a></li>
<li><a href="#org6c3c8d7">Structure initialization</a></li>
<li><a href="#orgea3a7ba">Add Tilt Type</a></li>
<li><a href="#org0a4da15">Material and Geometry</a></li>
<li><a href="#orgc8d8e96">Stiffness and Damping properties</a></li>
<li><a href="#orgcff6f81">Equilibrium position of the each joint.</a></li>
<li><a href="#org154c09a">Save the Structure</a></li>
</ul>
</li>
<li><a href="#orgcd779c6">7. Spindle</a>
<ul>
<li><a href="#orgdbf178e">Simscape Model</a></li>
<li><a href="#org6c50d5f">Function description</a></li>
<li><a href="#org6e2538c">Optional Parameters</a></li>
<li><a href="#org9d54b32">Structure initialization</a></li>
<li><a href="#orge5b17ec">Add Spindle Type</a></li>
<li><a href="#org8611e52">Material and Geometry</a></li>
<li><a href="#org4bd17c5">Stiffness and Damping properties</a></li>
<li><a href="#orgda734ec">Equilibrium position of the each joint.</a></li>
<li><a href="#org3120427">Save the Structure</a></li>
</ul>
</li>
<li><a href="#orgaac7776">8. Micro Hexapod</a>
<ul>
<li><a href="#org4255c8d">Simscape Model</a></li>
<li><a href="#orgb1add14">Function description</a></li>
<li><a href="#orge607d9e">Optional Parameters</a></li>
<li><a href="#org4f2e11d">Function content</a></li>
<li><a href="#orgd4fd31f">Add Type</a></li>
<li><a href="#org0c6e7cc">Save the Structure</a></li>
</ul>
</li>
<li><a href="#orga55d418">9. Center of gravity compensation</a>
<ul>
<li><a href="#org1eff289">Simscape Model</a></li>
<li><a href="#orgd8c98e8">Function description</a></li>
<li><a href="#orgef0234c">Optional Parameters</a></li>
<li><a href="#orgcf18e70">Structure initialization</a></li>
<li><a href="#orgf9b4f63">Add Type</a></li>
<li><a href="#org7ee8ea4">Material and Geometry</a></li>
<li><a href="#org2bfb3df">Save the Structure</a></li>
</ul>
</li>
<li><a href="#org7586ab7">10. Mirror</a>
<ul>
<li><a href="#orgebffada">Simscape Model</a></li>
<li><a href="#org0a7b625">Function description</a></li>
<li><a href="#orgd2ff1cd">Optional Parameters</a></li>
<li><a href="#orgc93419e">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="#org773a7e1">Stiffness and Damping properties</a></li>
<li><a href="#org0e83cc8">Equilibrium position of the each joint.</a></li>
<li><a href="#orgc381755">Geometry</a></li>
<li><a href="#orgc66f362">Save the Structure</a></li>
</ul>
</li>
<li><a href="#org16c8d40">11. Nano Hexapod</a>
<ul>
<li><a href="#org3538130">Simscape Model</a></li>
<li><a href="#org6e108c8">Function description</a></li>
<li><a href="#orgbc67bc9">Optional Parameters</a></li>
<li><a href="#org74a22e9">Function content</a></li>
<li><a href="#org0533a9d">Add Type</a></li>
<li><a href="#org2bdf2bc">Save the Structure</a></li>
</ul>
</li>
<li><a href="#org3d615a1">12. Sample</a>
<ul>
<li><a href="#org849e75c">Simscape Model</a></li>
<li><a href="#org71549c6">Function description</a></li>
<li><a href="#orgf81789f">Optional Parameters</a></li>
<li><a href="#org03107a5">Structure initialization</a></li>
<li><a href="#org2bb1d24">Add Sample Type</a></li>
<li><a href="#org10cd272">Material and Geometry</a></li>
<li><a href="#org228453f">Compute the Inertia</a></li>
<li><a href="#org334e053">Stiffness and Damping properties</a></li>
<li><a href="#org22b74be">Equilibrium position of the each joint.</a></li>
<li><a href="#org7316bd1">Save the Structure</a></li>
</ul>
</li>
<li><a href="#orge9cbdc9">13. Initialize Controller</a>
<ul>
<li><a href="#orgb134e02">Function Declaration and Documentation</a></li>
<li><a href="#orgcb5cea2">Optional Parameters</a></li>
<li><a href="#org6e3d43a">Structure initialization</a></li>
<li><a href="#org4207f98">Controller Type</a></li>
<li><a href="#orga766ac2">Save the Structure</a></li>
</ul>
</li>
<li><a href="#orgae5cb57">14. Generate Reference Signals</a>
<ul>
<li><a href="#orgbe1b3ce">Function Declaration and Documentation</a></li>
<li><a href="#orgb74cc41">Optional Parameters</a></li>
<li><a href="#orge94c0c2">Initialize Parameters</a></li>
<li><a href="#org9a6562c">Translation Stage</a></li>
<li><a href="#org005e07a">Tilt Stage</a></li>
<li><a href="#orge49a64e">Spindle</a></li>
<li><a href="#orgf16b0ab">Micro Hexapod</a></li>
<li><a href="#org04d73dc">Axis Compensation</a></li>
<li><a href="#org2516704">Nano Hexapod</a></li>
<li><a href="#org2b550dd">Save</a></li>
</ul>
</li>
<li><a href="#org544c9dd">15. Initialize Disturbances</a>
<ul>
<li><a href="#orga1fa4b5">Function Declaration and Documentation</a></li>
<li><a href="#orgbde77ba">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="#orgf084184">Save</a></li>
</ul>
</li>
<li><a href="#orgefb8a5e">16. Initialize Position Errors</a>
<ul>
<li><a href="#orgbaecbcc">Function Declaration and Documentation</a></li>
<li><a href="#org4eb7ed1">Optional Parameters</a></li>
<li><a href="#org0273d6e">Structure initialization</a></li>
<li><a href="#orgc890f7d">Type</a></li>
<li><a href="#org7d50228">Position Errors</a></li>
<li><a href="#orgf26ccc6">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-org246ce35" class="outline-3">
<h3 id="org246ce35">Function description</h3>
<div class="outline-text-3" id="text-org246ce35">
<div class="org-src-container">
<pre class="src src-matlab">function [] = initializeSimscapeConfiguration(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-org27c3039" class="outline-3">
<h3 id="org27c3039">Optional Parameters</h3>
<div class="outline-text-3" id="text-org27c3039">
<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-org4a0049b" class="outline-3">
<h3 id="org4a0049b">Structure initialization</h3>
<div class="outline-text-3" id="text-org4a0049b">
<div class="org-src-container">
<pre class="src src-matlab">conf_simscape = struct();
</pre>
</div>
</div>
</div>
<div id="outline-container-org1e0f7f4" class="outline-3">
<h3 id="org1e0f7f4">Add Type</h3>
<div class="outline-text-3" id="text-org1e0f7f4">
<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-orgded6aac" class="outline-3">
<h3 id="orgded6aac">Save the Structure</h3>
<div class="outline-text-3" id="text-orgded6aac">
<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-org3fa6ef1" class="outline-3">
<h3 id="org3fa6ef1">Function description</h3>
<div class="outline-text-3" id="text-org3fa6ef1">
<div class="org-src-container">
<pre class="src src-matlab">function [] = initializeLoggingConfiguration(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-orgc8aac8f" class="outline-3">
<h3 id="orgc8aac8f">Optional Parameters</h3>
<div class="outline-text-3" id="text-orgc8aac8f">
<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-orgd4d0599" class="outline-3">
<h3 id="orgd4d0599">Structure initialization</h3>
<div class="outline-text-3" id="text-orgd4d0599">
<div class="org-src-container">
<pre class="src src-matlab">conf_log = struct();
</pre>
</div>
</div>
</div>
<div id="outline-container-orgaffa81c" class="outline-3">
<h3 id="orgaffa81c">Add Type</h3>
<div class="outline-text-3" id="text-orgaffa81c">
<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-org1d59f8f" class="outline-3">
<h3 id="org1d59f8f">Save the Structure</h3>
<div class="outline-text-3" id="text-org1d59f8f">
<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-org92b9277" class="outline-3">
<h3 id="org92b9277">Simscape Model</h3>
<div class="outline-text-3" id="text-org92b9277">
<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-orgcfbce88" class="outline-3">
<h3 id="orgcfbce88">Function description</h3>
<div class="outline-text-3" id="text-orgcfbce88">
<div class="org-src-container">
<pre class="src src-matlab">function [ground] = initializeGround(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-orga9eb2c7" class="outline-3">
<h3 id="orga9eb2c7">Optional Parameters</h3>
<div class="outline-text-3" id="text-orga9eb2c7">
<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-org52bbc84" class="outline-3">
<h3 id="org52bbc84">Structure initialization</h3>
<div class="outline-text-3" id="text-org52bbc84">
<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-orgad27bdf" class="outline-3">
<h3 id="orgad27bdf">Add Type</h3>
<div class="outline-text-3" id="text-orgad27bdf">
<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-org9f15b58" class="outline-3">
<h3 id="org9f15b58">Save the Structure</h3>
<div class="outline-text-3" id="text-org9f15b58">
<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-orga0a0825" class="outline-3">
<h3 id="orga0a0825">Simscape Model</h3>
<div class="outline-text-3" id="text-orga0a0825">
<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-org06e1362" class="outline-3">
<h3 id="org06e1362">Function description</h3>
<div class="outline-text-3" id="text-org06e1362">
<div class="org-src-container">
<pre class="src src-matlab">function [granite] = initializeGranite(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-org3354a31" class="outline-3">
<h3 id="org3354a31">Optional Parameters</h3>
<div class="outline-text-3" id="text-org3354a31">
<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-org4cf00fc" class="outline-3">
<h3 id="org4cf00fc">Structure initialization</h3>
<div class="outline-text-3" id="text-org4cf00fc">
<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-org8f61ce3" class="outline-3">
<h3 id="org8f61ce3">Material and Geometry</h3>
<div class="outline-text-3" id="text-org8f61ce3">
<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-org9976da6" class="outline-3">
<h3 id="org9976da6">Stiffness and Damping properties</h3>
<div class="outline-text-3" id="text-org9976da6">
<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-orge84d6de" class="outline-3">
<h3 id="orge84d6de">Equilibrium position of the each joint.</h3>
<div class="outline-text-3" id="text-orge84d6de">
<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-org559e245" class="outline-3">
<h3 id="org559e245">Save the Structure</h3>
<div class="outline-text-3" id="text-org559e245">
<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-org55e59c3" class="outline-2">
<h2 id="org55e59c3"><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-org6281028" class="outline-3">
<h3 id="org6281028">Simscape Model</h3>
<div class="outline-text-3" id="text-org6281028">
<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-orgc6c8b46" class="outline-3">
<h3 id="orgc6c8b46">Function description</h3>
<div class="outline-text-3" id="text-orgc6c8b46">
<div class="org-src-container">
<pre class="src src-matlab">function [ty] = initializeTy(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-org23338c4" class="outline-3">
<h3 id="org23338c4">Optional Parameters</h3>
<div class="outline-text-3" id="text-org23338c4">
<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-org748d5ce" class="outline-3">
<h3 id="org748d5ce">Structure initialization</h3>
<div class="outline-text-3" id="text-org748d5ce">
<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-org76a9860" class="outline-3">
<h3 id="org76a9860">Material and Geometry</h3>
<div class="outline-text-3" id="text-org76a9860">
<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-orgab6ccf3" class="outline-3">
<h3 id="orgab6ccf3">Stiffness and Damping properties</h3>
<div class="outline-text-3" id="text-orgab6ccf3">
<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-org10a4b27" class="outline-3">
<h3 id="org10a4b27">Equilibrium position of the each joint.</h3>
<div class="outline-text-3" id="text-org10a4b27">
<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-org0951db0" class="outline-3">
<h3 id="org0951db0">Save the Structure</h3>
<div class="outline-text-3" id="text-org0951db0">
<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-orga4374f1" class="outline-2">
<h2 id="orga4374f1"><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-orgf9af09c" class="outline-3">
<h3 id="orgf9af09c">Simscape Model</h3>
<div class="outline-text-3" id="text-orgf9af09c">
<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-org88e197e" class="outline-3">
<h3 id="org88e197e">Function description</h3>
<div class="outline-text-3" id="text-org88e197e">
<div class="org-src-container">
<pre class="src src-matlab">function [ry] = initializeRy(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-org438cbb4" class="outline-3">
<h3 id="org438cbb4">Optional Parameters</h3>
<div class="outline-text-3" id="text-org438cbb4">
<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-org6c3c8d7" class="outline-3">
<h3 id="org6c3c8d7">Structure initialization</h3>
<div class="outline-text-3" id="text-org6c3c8d7">
<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-org0a4da15" class="outline-3">
<h3 id="org0a4da15">Material and Geometry</h3>
<div class="outline-text-3" id="text-org0a4da15">
<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-orgc8d8e96" class="outline-3">
<h3 id="orgc8d8e96">Stiffness and Damping properties</h3>
<div class="outline-text-3" id="text-orgc8d8e96">
<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-orgcff6f81" class="outline-3">
<h3 id="orgcff6f81">Equilibrium position of the each joint.</h3>
<div class="outline-text-3" id="text-orgcff6f81">
<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-org154c09a" class="outline-3">
<h3 id="org154c09a">Save the Structure</h3>
<div class="outline-text-3" id="text-org154c09a">
<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-orgcd779c6" class="outline-2">
<h2 id="orgcd779c6"><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-orgdbf178e" class="outline-3">
<h3 id="orgdbf178e">Simscape Model</h3>
<div class="outline-text-3" id="text-orgdbf178e">
<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-org6c50d5f" class="outline-3">
<h3 id="org6c50d5f">Function description</h3>
<div class="outline-text-3" id="text-org6c50d5f">
<div class="org-src-container">
<pre class="src src-matlab">function [rz] = initializeRz(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-org6e2538c" class="outline-3">
<h3 id="org6e2538c">Optional Parameters</h3>
<div class="outline-text-3" id="text-org6e2538c">
<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-org9d54b32" class="outline-3">
<h3 id="org9d54b32">Structure initialization</h3>
<div class="outline-text-3" id="text-org9d54b32">
<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-org8611e52" class="outline-3">
<h3 id="org8611e52">Material and Geometry</h3>
<div class="outline-text-3" id="text-org8611e52">
<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-org4bd17c5" class="outline-3">
<h3 id="org4bd17c5">Stiffness and Damping properties</h3>
<div class="outline-text-3" id="text-org4bd17c5">
<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-orgda734ec" class="outline-3">
<h3 id="orgda734ec">Equilibrium position of the each joint.</h3>
<div class="outline-text-3" id="text-orgda734ec">
<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-org3120427" class="outline-3">
<h3 id="org3120427">Save the Structure</h3>
<div class="outline-text-3" id="text-org3120427">
<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-orgaac7776" class="outline-2">
<h2 id="orgaac7776"><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-org4255c8d" class="outline-3">
<h3 id="org4255c8d">Simscape Model</h3>
<div class="outline-text-3" id="text-org4255c8d">
<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-orgb1add14" class="outline-3">
<h3 id="orgb1add14">Function description</h3>
<div class="outline-text-3" id="text-orgb1add14">
<div class="org-src-container">
<pre class="src src-matlab">function [micro_hexapod] = initializeMicroHexapod(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-orge607d9e" class="outline-3">
<h3 id="orge607d9e">Optional Parameters</h3>
<div class="outline-text-3" id="text-orge607d9e">
<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-org4f2e11d" class="outline-3">
<h3 id="org4f2e11d">Function content</h3>
<div class="outline-text-3" id="text-org4f2e11d">
<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-orgd4fd31f" class="outline-3">
<h3 id="orgd4fd31f">Add Type</h3>
<div class="outline-text-3" id="text-orgd4fd31f">
<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-org0c6e7cc" class="outline-3">
<h3 id="org0c6e7cc">Save the Structure</h3>
<div class="outline-text-3" id="text-org0c6e7cc">
<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-org1eff289" class="outline-3">
<h3 id="org1eff289">Simscape Model</h3>
<div class="outline-text-3" id="text-org1eff289">
<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-orgd8c98e8" class="outline-3">
<h3 id="orgd8c98e8">Function description</h3>
<div class="outline-text-3" id="text-orgd8c98e8">
<div class="org-src-container">
<pre class="src src-matlab">function [axisc] = initializeAxisc(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-orgef0234c" class="outline-3">
<h3 id="orgef0234c">Optional Parameters</h3>
<div class="outline-text-3" id="text-orgef0234c">
<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-orgcf18e70" class="outline-3">
<h3 id="orgcf18e70">Structure initialization</h3>
<div class="outline-text-3" id="text-orgcf18e70">
<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-orgf9b4f63" class="outline-3">
<h3 id="orgf9b4f63">Add Type</h3>
<div class="outline-text-3" id="text-orgf9b4f63">
<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-org7ee8ea4" class="outline-3">
<h3 id="org7ee8ea4">Material and Geometry</h3>
<div class="outline-text-3" id="text-org7ee8ea4">
<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-org2bfb3df" class="outline-3">
<h3 id="org2bfb3df">Save the Structure</h3>
<div class="outline-text-3" id="text-org2bfb3df">
<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-orgebffada" class="outline-3">
<h3 id="orgebffada">Simscape Model</h3>
<div class="outline-text-3" id="text-orgebffada">
<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-org0a7b625" class="outline-3">
<h3 id="org0a7b625">Function description</h3>
<div class="outline-text-3" id="text-org0a7b625">
<div class="org-src-container">
<pre class="src src-matlab">function [] = initializeMirror(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-orgd2ff1cd" class="outline-3">
<h3 id="orgd2ff1cd">Optional Parameters</h3>
<div class="outline-text-3" id="text-orgd2ff1cd">
<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-orgc93419e" class="outline-3">
<h3 id="orgc93419e">Structure initialization</h3>
<div class="outline-text-3" id="text-orgc93419e">
<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-org773a7e1" class="outline-3">
<h3 id="org773a7e1">Stiffness and Damping properties</h3>
<div class="outline-text-3" id="text-org773a7e1">
<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-org0e83cc8" class="outline-3">
<h3 id="org0e83cc8">Equilibrium position of the each joint.</h3>
<div class="outline-text-3" id="text-org0e83cc8">
<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-orgc66f362" class="outline-3">
<h3 id="orgc66f362">Save the Structure</h3>
<div class="outline-text-3" id="text-orgc66f362">
<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-org16c8d40" class="outline-2">
<h2 id="org16c8d40"><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-org3538130" class="outline-3">
<h3 id="org3538130">Simscape Model</h3>
<div class="outline-text-3" id="text-org3538130">
<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-org6e108c8" class="outline-3">
<h3 id="org6e108c8">Function description</h3>
<div class="outline-text-3" id="text-org6e108c8">
<div class="org-src-container">
<pre class="src src-matlab">function [nano_hexapod] = initializeNanoHexapod(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-orgbc67bc9" class="outline-3">
<h3 id="orgbc67bc9">Optional Parameters</h3>
<div class="outline-text-3" id="text-orgbc67bc9">
<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'})} = 'piezo'
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-org74a22e9" class="outline-3">
<h3 id="org74a22e9">Function content</h3>
<div class="outline-text-3" id="text-org74a22e9">
<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, 'K', args.k*ones(6,1), 'C', args.c*ones(6,1));
elseif args.k &gt; 0
stewart = initializeStrutDynamics(stewart, 'K', args.k*ones(6,1), 'C', 1.5*sqrt(args.k)*ones(6,1));
elseif strcmp(args.actuator, 'piezo')
stewart = initializeStrutDynamics(stewart, 'K', 1e7*ones(6,1), 'C', 1e2*ones(6,1));
elseif strcmp(args.actuator, 'lorentz')
stewart = initializeStrutDynamics(stewart, 'K', 1e4*ones(6,1), 'C', 1e2*ones(6,1));
else
error('args.actuator should be piezo or lorentz');
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-org0533a9d" class="outline-3">
<h3 id="org0533a9d">Add Type</h3>
<div class="outline-text-3" id="text-org0533a9d">
<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-org2bdf2bc" class="outline-3">
<h3 id="org2bdf2bc">Save the Structure</h3>
<div class="outline-text-3" id="text-org2bdf2bc">
<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-org849e75c" class="outline-3">
<h3 id="org849e75c">Simscape Model</h3>
<div class="outline-text-3" id="text-org849e75c">
<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-org71549c6" class="outline-3">
<h3 id="org71549c6">Function description</h3>
<div class="outline-text-3" id="text-org71549c6">
<div class="org-src-container">
<pre class="src src-matlab">function [sample] = initializeSample(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-orgf81789f" class="outline-3">
<h3 id="orgf81789f">Optional Parameters</h3>
<div class="outline-text-3" id="text-orgf81789f">
<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-org03107a5" class="outline-3">
<h3 id="org03107a5">Structure initialization</h3>
<div class="outline-text-3" id="text-org03107a5">
<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-org10cd272" class="outline-3">
<h3 id="org10cd272">Material and Geometry</h3>
<div class="outline-text-3" id="text-org10cd272">
<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-org334e053" class="outline-3">
<h3 id="org334e053">Stiffness and Damping properties</h3>
<div class="outline-text-3" id="text-org334e053">
<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-org22b74be" class="outline-3">
<h3 id="org22b74be">Equilibrium position of the each joint.</h3>
<div class="outline-text-3" id="text-org22b74be">
<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-org7316bd1" class="outline-3">
<h3 id="org7316bd1">Save the Structure</h3>
<div class="outline-text-3" id="text-org7316bd1">
<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-orgb134e02" class="outline-3">
<h3 id="orgb134e02">Function Declaration and Documentation</h3>
<div class="outline-text-3" id="text-orgb134e02">
<div class="org-src-container">
<pre class="src src-matlab">function [] = initializeController(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-orgcb5cea2" class="outline-3">
<h3 id="orgcb5cea2">Optional Parameters</h3>
<div class="outline-text-3" id="text-orgcb5cea2">
<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-org6e3d43a" class="outline-3">
<h3 id="org6e3d43a">Structure initialization</h3>
<div class="outline-text-3" id="text-org6e3d43a">
<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-orga766ac2" class="outline-3">
<h3 id="orga766ac2">Save the Structure</h3>
<div class="outline-text-3" id="text-orga766ac2">
<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-orgbe1b3ce" class="outline-3">
<h3 id="orgbe1b3ce">Function Declaration and Documentation</h3>
<div class="outline-text-3" id="text-orgbe1b3ce">
<div class="org-src-container">
<pre class="src src-matlab">function [ref] = initializeReferences(args)
</pre>
</div>
</div>
</div>
<div id="outline-container-orgb74cc41" class="outline-3">
<h3 id="orgb74cc41">Optional Parameters</h3>
<div class="outline-text-3" id="text-orgb74cc41">
<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-org9a6562c" class="outline-3">
<h3 id="org9a6562c">Translation Stage</h3>
<div class="outline-text-3" id="text-org9a6562c">
<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-org005e07a" class="outline-3">
<h3 id="org005e07a">Tilt Stage</h3>
<div class="outline-text-3" id="text-org005e07a">
<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-orge49a64e" class="outline-3">
<h3 id="orge49a64e">Spindle</h3>
<div class="outline-text-3" id="text-orge49a64e">
<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-orgf16b0ab" class="outline-3">
<h3 id="orgf16b0ab">Micro Hexapod</h3>
<div class="outline-text-3" id="text-orgf16b0ab">
<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-org2516704" class="outline-3">
<h3 id="org2516704">Nano Hexapod</h3>
<div class="outline-text-3" id="text-org2516704">
<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-org2b550dd" class="outline-3">
<h3 id="org2b550dd">Save</h3>
<div class="outline-text-3" id="text-org2b550dd">
<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-orga1fa4b5" class="outline-3">
<h3 id="orga1fa4b5">Function Declaration and Documentation</h3>
<div class="outline-text-3" id="text-orga1fa4b5">
<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-orgbde77ba" class="outline-3">
<h3 id="orgbde77ba">Optional Parameters</h3>
<div class="outline-text-3" id="text-orgbde77ba">
<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-orgf084184" class="outline-3">
<h3 id="orgf084184">Save</h3>
<div class="outline-text-3" id="text-orgf084184">
<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-orgbaecbcc" class="outline-3">
<h3 id="orgbaecbcc">Function Declaration and Documentation</h3>
<div class="outline-text-3" id="text-orgbaecbcc">
<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-org4eb7ed1" class="outline-3">
<h3 id="org4eb7ed1">Optional Parameters</h3>
<div class="outline-text-3" id="text-org4eb7ed1">
<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-org0273d6e" class="outline-3">
<h3 id="org0273d6e">Structure initialization</h3>
<div class="outline-text-3" id="text-org0273d6e">
<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-orgf26ccc6" class="outline-3">
<h3 id="orgf26ccc6">Save</h3>
<div class="outline-text-3" id="text-orgf26ccc6">
<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-05-05 mar. 10:33</p>
</div>
</body>
</html>