nass-simscape/docs/compensation_gravity_forces.html
2020-04-05 19:43:43 +02:00

597 lines
22 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-04-05 dim. 19:43 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Compensating the gravity forces to start at steady state</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Dehaeze Thomas" />
<style type="text/css">
<!--/*--><![CDATA[/*><!--*/
.title { text-align: center;
margin-bottom: .2em; }
.subtitle { text-align: center;
font-size: medium;
font-weight: bold;
margin-top:0; }
.todo { font-family: monospace; color: red; }
.done { font-family: monospace; color: green; }
.priority { font-family: monospace; color: orange; }
.tag { background-color: #eee; font-family: monospace;
padding: 2px; font-size: 80%; font-weight: normal; }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
.underline { text-decoration: underline; }
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
pre {
border: 1px solid #ccc;
box-shadow: 3px 3px 3px #eee;
padding: 8pt;
font-family: monospace;
overflow: auto;
margin: 1.2em;
}
pre.src {
position: relative;
overflow: visible;
padding-top: 1.2em;
}
pre.src:before {
display: none;
position: absolute;
background-color: white;
top: -10px;
right: 10px;
padding: 3px;
border: 1px solid black;
}
pre.src:hover:before { display: inline;}
/* Languages per Org manual */
pre.src-asymptote:before { content: 'Asymptote'; }
pre.src-awk:before { content: 'Awk'; }
pre.src-C:before { content: 'C'; }
/* pre.src-C++ doesn't work in CSS */
pre.src-clojure:before { content: 'Clojure'; }
pre.src-css:before { content: 'CSS'; }
pre.src-D:before { content: 'D'; }
pre.src-ditaa:before { content: 'ditaa'; }
pre.src-dot:before { content: 'Graphviz'; }
pre.src-calc:before { content: 'Emacs Calc'; }
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
pre.src-fortran:before { content: 'Fortran'; }
pre.src-gnuplot:before { content: 'gnuplot'; }
pre.src-haskell:before { content: 'Haskell'; }
pre.src-hledger:before { content: 'hledger'; }
pre.src-java:before { content: 'Java'; }
pre.src-js:before { content: 'Javascript'; }
pre.src-latex:before { content: 'LaTeX'; }
pre.src-ledger:before { content: 'Ledger'; }
pre.src-lisp:before { content: 'Lisp'; }
pre.src-lilypond:before { content: 'Lilypond'; }
pre.src-lua:before { content: 'Lua'; }
pre.src-matlab:before { content: 'MATLAB'; }
pre.src-mscgen:before { content: 'Mscgen'; }
pre.src-ocaml:before { content: 'Objective Caml'; }
pre.src-octave:before { content: 'Octave'; }
pre.src-org:before { content: 'Org mode'; }
pre.src-oz:before { content: 'OZ'; }
pre.src-plantuml:before { content: 'Plantuml'; }
pre.src-processing:before { content: 'Processing.js'; }
pre.src-python:before { content: 'Python'; }
pre.src-R:before { content: 'R'; }
pre.src-ruby:before { content: 'Ruby'; }
pre.src-sass:before { content: 'Sass'; }
pre.src-scheme:before { content: 'Scheme'; }
pre.src-screen:before { content: 'Gnu Screen'; }
pre.src-sed:before { content: 'Sed'; }
pre.src-sh:before { content: 'shell'; }
pre.src-sql:before { content: 'SQL'; }
pre.src-sqlite:before { content: 'SQLite'; }
/* additional languages in org.el's org-babel-load-languages alist */
pre.src-forth:before { content: 'Forth'; }
pre.src-io:before { content: 'IO'; }
pre.src-J:before { content: 'J'; }
pre.src-makefile:before { content: 'Makefile'; }
pre.src-maxima:before { content: 'Maxima'; }
pre.src-perl:before { content: 'Perl'; }
pre.src-picolisp:before { content: 'Pico Lisp'; }
pre.src-scala:before { content: 'Scala'; }
pre.src-shell:before { content: 'Shell Script'; }
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
/* additional language identifiers per "defun org-babel-execute"
in ob-*.el */
pre.src-cpp:before { content: 'C++'; }
pre.src-abc:before { content: 'ABC'; }
pre.src-coq:before { content: 'Coq'; }
pre.src-groovy:before { content: 'Groovy'; }
/* additional language identifiers from org-babel-shell-names in
ob-shell.el: ob-shell is the only babel language using a lambda to put
the execution function name together. */
pre.src-bash:before { content: 'bash'; }
pre.src-csh:before { content: 'csh'; }
pre.src-ash:before { content: 'ash'; }
pre.src-dash:before { content: 'dash'; }
pre.src-ksh:before { content: 'ksh'; }
pre.src-mksh:before { content: 'mksh'; }
pre.src-posh:before { content: 'posh'; }
/* Additional Emacs modes also supported by the LaTeX listings package */
pre.src-ada:before { content: 'Ada'; }
pre.src-asm:before { content: 'Assembler'; }
pre.src-caml:before { content: 'Caml'; }
pre.src-delphi:before { content: 'Delphi'; }
pre.src-html:before { content: 'HTML'; }
pre.src-idl:before { content: 'IDL'; }
pre.src-mercury:before { content: 'Mercury'; }
pre.src-metapost:before { content: 'MetaPost'; }
pre.src-modula-2:before { content: 'Modula-2'; }
pre.src-pascal:before { content: 'Pascal'; }
pre.src-ps:before { content: 'PostScript'; }
pre.src-prolog:before { content: 'Prolog'; }
pre.src-simula:before { content: 'Simula'; }
pre.src-tcl:before { content: 'tcl'; }
pre.src-tex:before { content: 'TeX'; }
pre.src-plain-tex:before { content: 'Plain TeX'; }
pre.src-verilog:before { content: 'Verilog'; }
pre.src-vhdl:before { content: 'VHDL'; }
pre.src-xml:before { content: 'XML'; }
pre.src-nxml:before { content: 'XML'; }
/* add a generic configuration mode; LaTeX export needs an additional
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
pre.src-conf:before { content: 'Configuration File'; }
table { border-collapse:collapse; }
caption.t-above { caption-side: top; }
caption.t-bottom { caption-side: bottom; }
td, th { vertical-align:top; }
th.org-right { text-align: center; }
th.org-left { text-align: center; }
th.org-center { text-align: center; }
td.org-right { text-align: right; }
td.org-left { text-align: left; }
td.org-center { text-align: center; }
dt { font-weight: bold; }
.footpara { display: inline; }
.footdef { margin-bottom: 1em; }
.figure { padding: 1em; }
.figure p { text-align: center; }
.equation-container {
display: table;
text-align: center;
width: 100%;
}
.equation {
vertical-align: middle;
}
.equation-label {
display: table-cell;
text-align: right;
vertical-align: middle;
}
.inlinetask {
padding: 10px;
border: 2px solid gray;
margin: 10px;
background: #ffffcc;
}
#org-div-home-and-up
{ text-align: right; font-size: 70%; white-space: nowrap; }
textarea { overflow-x: auto; }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00; }
.org-info-js_info-navigation { border-style: none; }
#org-info-js_console-label
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
.org-svg { width: 90%; }
/*]]>*/-->
</style>
<link rel="stylesheet" type="text/css" href="./css/htmlize.css"/>
<link rel="stylesheet" type="text/css" href="./css/readtheorg.css"/>
<link rel="stylesheet" type="text/css" href="./css/zenburn.css"/>
<script type="text/javascript" src="./js/jquery.min.js"></script>
<script type="text/javascript" src="./js/bootstrap.min.js"></script>
<script type="text/javascript" src="./js/jquery.stickytableheaders.min.js"></script>
<script type="text/javascript" src="./js/readtheorg.js"></script>
<script type="text/javascript">
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&amp;dn=gpl-3.0.txt GPL-v3-or-Later
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.cacheClassElem = elem.className;
elem.cacheClassTarget = target.className;
target.className = "code-highlighted";
elem.className = "code-highlighted";
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(elem.cacheClassElem)
elem.className = elem.cacheClassElem;
if(elem.cacheClassTarget)
target.className = elem.cacheClassTarget;
}
/*]]>*///-->
// @license-end
</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">Compensating the gravity forces to start at steady state</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org356e04b">1. Initialization of the Experimental Conditions</a></li>
<li><a href="#org263e5db">2. Without compensation</a></li>
<li><a href="#orgfd6d9e9">3. Simulation to compute the required force in each joint</a></li>
<li><a href="#org44bde7a">4. New simulation with compensation of gravity forces</a></li>
<li><a href="#orgb714922">5. Conclusion</a></li>
</ul>
</div>
</div>
<p>
In this file is shown a technique used to compensate the gravity forces at t=0.
</p>
<p>
The problem is that in presence of gravity, the system does not start at steady state and experience a transient phase (section <a href="#org4bc70b2">2</a>).
</p>
<p>
In order to start the simulation at steady state in presence of gravity:
</p>
<ul class="org-ul">
<li>section <a href="#org2de8ac1">3</a>: first the stages are initialize in such a way that they are rigid, and the forces/torques applied at the location of their joints is measured</li>
<li>section <a href="#org5364ea3">4</a>: Then, the equilibrium position of each joint is modified in such a way that at t=0, the forces in each joints exactly compensate the forces due to gravity forces</li>
</ul>
<div id="outline-container-org356e04b" class="outline-2">
<h2 id="org356e04b"><span class="section-number-2">1</span> Initialization of the Experimental Conditions</h2>
<div class="outline-text-2" id="text-1">
<p>
We don&rsquo;t inject any perturbations and no reference tracking.
</p>
<div class="org-src-container">
<pre class="src src-matlab"> initializeReferences();
initializeDisturbances(<span class="org-string">'enable'</span>, <span class="org-constant">false</span>);
initializeController();
</pre>
</div>
<p>
We include the gravity and log all the signals to display.
</p>
<div class="org-src-container">
<pre class="src src-matlab"> initializeSimscapeConfiguration(<span class="org-string">'gravity'</span>, <span class="org-constant">true</span>);
initializeLoggingConfiguration(<span class="org-string">'log'</span>, <span class="org-string">'all'</span>);
</pre>
</div>
</div>
</div>
<div id="outline-container-org263e5db" class="outline-2">
<h2 id="org263e5db"><span class="section-number-2">2</span> Without compensation</h2>
<div class="outline-text-2" id="text-2">
<p>
<a id="org4bc70b2"></a>
Let&rsquo;s simulate the system without any compensation of gravity forces.
</p>
<div class="org-src-container">
<pre class="src src-matlab"> initializeGround();
initializeGranite();
initializeTy();
initializeRy();
initializeRz();
initializeMicroHexapod();
initializeAxisc();
initializeMirror();
initializeNanoHexapod();
initializeSample();
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"> load(<span class="org-string">'mat/conf_simulink.mat'</span>);
<span class="org-matlab-simulink-keyword">set_param</span>(<span class="org-variable-name">conf_simulink</span>, <span class="org-string">'StopTime'</span>, <span class="org-string">'0.5'</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"> <span class="org-matlab-simulink-keyword">sim</span>(<span class="org-string">'nass_model'</span>);
sim_no_compensation = simout;
</pre>
</div>
<p>
And we can observe on Figure <a href="#org0568928">1</a> that there are some motion in the system.
</p>
<div id="org0568928" class="figure">
<p><img src="figs/transient_phase_gravity_no_compensation.png" alt="transient_phase_gravity_no_compensation.png" />
</p>
<p><span class="figure-number">Figure 1: </span>Motion of the sample at the start of the simulation in presence of gravity (<a href="./figs/transient_phase_gravity_no_compensation.png">png</a>, <a href="./figs/transient_phase_gravity_no_compensation.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-orgfd6d9e9" class="outline-2">
<h2 id="orgfd6d9e9"><span class="section-number-2">3</span> Simulation to compute the required force in each joint</h2>
<div class="outline-text-2" id="text-3">
<p>
<a id="org2de8ac1"></a>
We here wish to simulate the system in order to compute the required force in each joint to compensate the gravity forces.
</p>
<div class="org-src-container">
<pre class="src src-matlab"> initializeGround();
initializeGranite(<span class="org-string">'type'</span>, <span class="org-string">'init'</span>);
initializeTy(<span class="org-string">'type'</span>, <span class="org-string">'init'</span>);
initializeRy(<span class="org-string">'type'</span>, <span class="org-string">'init'</span>);
initializeRz(<span class="org-string">'type'</span>, <span class="org-string">'init'</span>);
initializeMicroHexapod(<span class="org-string">'type'</span>, <span class="org-string">'init'</span>);
initializeAxisc();
initializeMirror();
initializeNanoHexapod(<span class="org-string">'type'</span>, <span class="org-string">'init'</span>);
initializeSample(<span class="org-string">'type'</span>, <span class="org-string">'init'</span>);
</pre>
</div>
<p>
We simulate for a short time period (all the bodies are solid, so nothing should move).
</p>
<div class="org-src-container">
<pre class="src src-matlab"> load(<span class="org-string">'mat/conf_simulink.mat'</span>);
<span class="org-matlab-simulink-keyword">set_param</span>(<span class="org-variable-name">conf_simulink</span>, <span class="org-string">'StopTime'</span>, <span class="org-string">'0.1'</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"> <span class="org-matlab-simulink-keyword">sim</span>(<span class="org-string">'nass_model'</span>);
</pre>
</div>
<p>
Verification that nothing is moving by looking at the maximum displacement of the sample:
</p>
<div class="org-src-container">
<pre class="src src-matlab"> max(max(simout.Em.En.Data))
</pre>
</div>
<pre class="example">
1.0681e-15
</pre>
<p>
We here show the measured total force/torque applied at the location of each joint.
</p>
<div class="org-src-container">
<pre class="src src-matlab"> data2orgtable([Fgm 0 0 0; Ftym; Fym; Fsm], {<span class="org-string">'Granite'</span>, <span class="org-string">'Translation Stage'</span>, <span class="org-string">'Tilt Stage'</span>, <span class="org-string">'Sample'</span>}, {<span class="org-string">'Fx'</span>, <span class="org-string">'Fy'</span>, <span class="org-string">'Fz'</span>, <span class="org-string">'Mx'</span>, <span class="org-string">'My'</span>, <span class="org-string">'Mz'</span>}, <span class="org-string">' %.1e '</span>);
</pre>
</div>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-right" />
<col class="org-right" />
<col class="org-right" />
<col class="org-right" />
<col class="org-right" />
<col class="org-right" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">&#xa0;</th>
<th scope="col" class="org-right">Fx</th>
<th scope="col" class="org-right">Fy</th>
<th scope="col" class="org-right">Fz</th>
<th scope="col" class="org-right">Mx</th>
<th scope="col" class="org-right">My</th>
<th scope="col" class="org-right">Mz</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">Granite</td>
<td class="org-right">-7.6e-12</td>
<td class="org-right">1.2e-11</td>
<td class="org-right">-34000.0</td>
<td class="org-right">0.0</td>
<td class="org-right">0.0</td>
<td class="org-right">0.0</td>
</tr>
<tr>
<td class="org-left">Translation Stage</td>
<td class="org-right">-7.6e-12</td>
<td class="org-right">1.2e-11</td>
<td class="org-right">-12000.0</td>
<td class="org-right">31.0</td>
<td class="org-right">2.5</td>
<td class="org-right">6.6e-13</td>
</tr>
<tr>
<td class="org-left">Tilt Stage</td>
<td class="org-right">-7.6e-12</td>
<td class="org-right">1.2e-11</td>
<td class="org-right">-8800.0</td>
<td class="org-right">33.0</td>
<td class="org-right">-0.52</td>
<td class="org-right">6.6e-13</td>
</tr>
<tr>
<td class="org-left">Sample</td>
<td class="org-right">-5.7e-12</td>
<td class="org-right">1.3e-11</td>
<td class="org-right">-490.0</td>
<td class="org-right">-2.5e-12</td>
<td class="org-right">-8.1e-13</td>
<td class="org-right">2.7e-13</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-matlab"> data2orgtable([Fhm; Fnm], {<span class="org-string">'Micro-Hexapod'</span>, <span class="org-string">'Nano-Hexapod'</span>}, {<span class="org-string">'F1'</span>, <span class="org-string">'F2'</span>, <span class="org-string">'F3'</span>, <span class="org-string">'F4'</span>, <span class="org-string">'F5'</span>, <span class="org-string">'F6'</span>}, <span class="org-string">' %.1e '</span>);
</pre>
</div>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-right" />
<col class="org-right" />
<col class="org-right" />
<col class="org-right" />
<col class="org-right" />
<col class="org-right" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">&#xa0;</th>
<th scope="col" class="org-right">F1</th>
<th scope="col" class="org-right">F2</th>
<th scope="col" class="org-right">F3</th>
<th scope="col" class="org-right">F4</th>
<th scope="col" class="org-right">F5</th>
<th scope="col" class="org-right">F6</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">Micro-Hexapod</td>
<td class="org-right">-180.0</td>
<td class="org-right">-180.0</td>
<td class="org-right">-180.0</td>
<td class="org-right">-180.0</td>
<td class="org-right">-180.0</td>
<td class="org-right">-180.0</td>
</tr>
<tr>
<td class="org-left">Nano-Hexapod</td>
<td class="org-right">-160.0</td>
<td class="org-right">-160.0</td>
<td class="org-right">-160.0</td>
<td class="org-right">-160.0</td>
<td class="org-right">-160.0</td>
<td class="org-right">-160.0</td>
</tr>
</tbody>
</table>
<p>
We save these forces in <code>Foffset.mat</code>.
</p>
<div class="org-src-container">
<pre class="src src-matlab"> save(<span class="org-string">'mat/Foffset.mat'</span>, <span class="org-string">'Fgm'</span>, <span class="org-string">'Ftym'</span>, <span class="org-string">'Fym'</span>, <span class="org-string">'Fzm'</span>, <span class="org-string">'Fhm'</span>, <span class="org-string">'Fnm'</span>, <span class="org-string">'Fsm'</span>);
</pre>
</div>
</div>
</div>
<div id="outline-container-org44bde7a" class="outline-2">
<h2 id="org44bde7a"><span class="section-number-2">4</span> New simulation with compensation of gravity forces</h2>
<div class="outline-text-2" id="text-4">
<p>
<a id="org5364ea3"></a>
We now initialize the stages with the option <code>Foffset</code>.
</p>
<div class="org-src-container">
<pre class="src src-matlab"> initializeGround();
initializeGranite(<span class="org-string">'Foffset'</span>, <span class="org-constant">true</span>);
initializeTy(<span class="org-string">'Foffset'</span>, <span class="org-constant">true</span>);
initializeRy(<span class="org-string">'Foffset'</span>, <span class="org-constant">true</span>);
initializeRz(<span class="org-string">'Foffset'</span>, <span class="org-constant">true</span>);
initializeMicroHexapod(<span class="org-string">'Foffset'</span>, <span class="org-constant">true</span>);
initializeAxisc();
initializeMirror();
initializeNanoHexapod(<span class="org-string">'Foffset'</span>, <span class="org-constant">true</span>);
initializeSample(<span class="org-string">'Foffset'</span>, <span class="org-constant">true</span>);
</pre>
</div>
<p>
And we simulate the system for 0.5 seconds.
</p>
<div class="org-src-container">
<pre class="src src-matlab"> load(<span class="org-string">'mat/conf_simulink.mat'</span>);
<span class="org-matlab-simulink-keyword">set_param</span>(<span class="org-variable-name">conf_simulink</span>, <span class="org-string">'StopTime'</span>, <span class="org-string">'0.5'</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"> <span class="org-matlab-simulink-keyword">sim</span>(<span class="org-string">'nass_model'</span>);
sim_compensation = simout;
</pre>
</div>
<p>
Verification that nothing is moving
</p>
<div id="orgc677acf" class="figure">
<p><img src="figs/transient_phase_gravity_compensation.png" alt="transient_phase_gravity_compensation.png" />
</p>
<p><span class="figure-number">Figure 2: </span>Motion of the sample at the start of the simulation in presence of gravity when compensating the gravity forces (<a href="./figs/transient_phase_gravity_compensation.png">png</a>, <a href="./figs/transient_phase_gravity_compensation.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-orgb714922" class="outline-2">
<h2 id="orgb714922"><span class="section-number-2">5</span> Conclusion</h2>
<div class="outline-text-2" id="text-5">
<div class="important">
<p>
This initialization technique permits to compute the required forces/torques to be applied in each joint in order to compensate for gravity forces.
This initialization should be redone for each configuration (change of sample mass, change of tilt angle), but not when changing the stiffness of joints, for instant when changing from lorentz based nano-hexapod or piezo based.
</p>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
<p class="date">Created: 2020-04-05 dim. 19:43</p>
</div>
</body>
</html>