Only one simulink file in matlab folder

This commit is contained in:
Thomas Dehaeze 2020-02-13 14:43:09 +01:00
parent 05687a003d
commit becb9b7758
13 changed files with 452 additions and 36 deletions

View File

@ -1,2 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info />

View File

@ -1,2 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info />

View File

@ -1,6 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info>
<Category UUID="FileClassCategory">
<Label UUID="design" />
</Category>
</Info>

View File

@ -1,2 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info Ref="simulink" Type="Relative" />

View File

@ -4,7 +4,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head> <head>
<!-- 2020-02-11 mar. 17:51 --> <!-- 2020-02-13 jeu. 14:42 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Stewart Platform - Simscape Model</title> <title>Stewart Platform - Simscape Model</title>
@ -279,16 +279,32 @@ for the JavaScript code in this tag.
</li> </li>
<li><a href="#org7e2c432">6. Other Elements</a> <li><a href="#org7e2c432">6. Other Elements</a>
<ul> <ul>
<li><a href="#org4bdfc33">6.1. Z-Axis Geophone</a> <li><a href="#org3535b6d">6.1. Payload</a>
<ul> <ul>
<li><a href="#org59ef364">6.1.1. Working Principle</a></li> <li><a href="#orgf4d7716">Function description</a></li>
<li><a href="#orgb3509cd">6.1.2. Initialization function</a></li> <li><a href="#org071708c">Optional Parameters</a></li>
<li><a href="#orgeeb8d35">Add Payload Type</a></li>
<li><a href="#org6d52ffc">Add Stiffness, Damping and Mass properties of the Payload</a></li>
</ul> </ul>
</li> </li>
<li><a href="#org99786f1">6.2. Z-Axis Accelerometer</a> <li><a href="#orgaaed406">6.2. Ground</a>
<ul> <ul>
<li><a href="#orgf6e6126">6.2.1. Working Principle</a></li> <li><a href="#org706f994">Function description</a></li>
<li><a href="#org7b9c8ed">6.2.2. Initialization function</a></li> <li><a href="#orgb15b49f">Optional Parameters</a></li>
<li><a href="#orgef7035d">Add Ground Type</a></li>
<li><a href="#org95633e8">Add Stiffness and Damping properties of the Ground</a></li>
</ul>
</li>
<li><a href="#org4bdfc33">6.3. Z-Axis Geophone</a>
<ul>
<li><a href="#orgf6e6126">6.3.1. Working Principle</a></li>
<li><a href="#org7b9c8ed">6.3.2. Initialization function</a></li>
</ul>
</li>
<li><a href="#org99786f1">6.4. Z-Axis Accelerometer</a>
<ul>
<li><a href="#org64fd353">6.4.1. Working Principle</a></li>
<li><a href="#orge8bb0f7">6.4.2. Initialization function</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
@ -509,13 +525,189 @@ Both inertial sensors are described bellow.
<h2 id="org7e2c432"><span class="section-number-2">6</span> Other Elements</h2> <h2 id="org7e2c432"><span class="section-number-2">6</span> Other Elements</h2>
<div class="outline-text-2" id="text-6"> <div class="outline-text-2" id="text-6">
</div> </div>
<div id="outline-container-org4bdfc33" class="outline-3"> <div id="outline-container-org3535b6d" class="outline-3">
<h3 id="org4bdfc33"><span class="section-number-3">6.1</span> Z-Axis Geophone</h3> <h3 id="org3535b6d"><span class="section-number-3">6.1</span> Payload</h3>
<div class="outline-text-3" id="text-6-1"> <div class="outline-text-3" id="text-6-1">
<p>
<a id="org3a56808"></a>
</p>
<p>
This Matlab function is accessible <a href="../src/initializePayload.m">here</a>.
</p>
</div> </div>
<div id="outline-container-org59ef364" class="outline-4">
<h4 id="org59ef364"><span class="section-number-4">6.1.1</span> Working Principle</h4> <div id="outline-container-orgf4d7716" class="outline-4">
<div class="outline-text-4" id="text-6-1-1"> <h4 id="orgf4d7716">Function description</h4>
<div class="outline-text-4" id="text-orgf4d7716">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-keyword">function</span> <span class="org-variable-name">[payload]</span> = <span class="org-function-name">initializePayload</span>(<span class="org-variable-name">args</span>)
<span class="org-comment">% initializePayload - Initialize the Payload that can then be used for simulations and analysis</span>
<span class="org-comment">%</span>
<span class="org-comment">% Syntax: [payload] = initializePayload(args)</span>
<span class="org-comment">%</span>
<span class="org-comment">% Inputs:</span>
<span class="org-comment">% - args - Structure with the following fields:</span>
<span class="org-comment">% - type - 'none', 'solid', 'flexible', 'cartesian'</span>
<span class="org-comment">% - h [1x1] - Height of the CoM of the payload w.r.t {M} [m]</span>
<span class="org-comment">% This also the position where K and C are defined</span>
<span class="org-comment">% - K [6x1] - Stiffness of the Payload [N/m, N/rad]</span>
<span class="org-comment">% - C [6x1] - Damping of the Payload [N/(m/s), N/(rad/s)]</span>
<span class="org-comment">% - m [1x1] - Mass of the Payload [kg]</span>
<span class="org-comment">% - I [3x3] - Inertia matrix for the Payload [kg*m2]</span>
<span class="org-comment">%</span>
<span class="org-comment">% Outputs:</span>
<span class="org-comment">% - payload - Struture with the following properties:</span>
<span class="org-comment">% - type - 1 (none), 2 (solid), 3 (flexible)</span>
<span class="org-comment">% - h [1x1] - Height of the CoM of the payload w.r.t {M} [m]</span>
<span class="org-comment">% - K [6x1] - Stiffness of the Payload [N/m, N/rad]</span>
<span class="org-comment">% - C [6x1] - Stiffness of the Payload [N/(m/s), N/(rad/s)]</span>
<span class="org-comment">% - m [1x1] - Mass of the Payload [kg]</span>
<span class="org-comment">% - I [3x3] - Inertia matrix for the Payload [kg*m2]</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org071708c" class="outline-4">
<h4 id="org071708c">Optional Parameters</h4>
<div class="outline-text-4" id="text-org071708c">
<div class="org-src-container">
<pre class="src src-matlab">arguments
args.type char {mustBeMember(args.type,{<span class="org-string">'none'</span>, <span class="org-string">'solid'</span>, <span class="org-string">'flexible'</span>, <span class="org-string">'cartesian'</span>})} = <span class="org-string">'none'</span>
args.K (6,1) double {mustBeNumeric, mustBeNonnegative} = 1e8<span class="org-type">*</span>ones(6,1)
args.C (6,1) double {mustBeNumeric, mustBeNonnegative} = 1e1<span class="org-type">*</span>ones(6,1)
args.h (1,1) double {mustBeNumeric, mustBeNonnegative} = 100e<span class="org-type">-</span>3
args.m (1,1) double {mustBeNumeric, mustBeNonnegative} = 10
args.I (3,3) double {mustBeNumeric, mustBeNonnegative} = 1<span class="org-type">*</span>eye(3)
<span class="org-keyword">end</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgeeb8d35" class="outline-4">
<h4 id="orgeeb8d35">Add Payload Type</h4>
<div class="outline-text-4" id="text-orgeeb8d35">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-keyword">switch</span> <span class="org-constant">args.type</span>
<span class="org-keyword">case</span> <span class="org-string">'none'</span>
payload.type = 1;
<span class="org-keyword">case</span> <span class="org-string">'solid'</span>
payload.type = 2;
<span class="org-keyword">case</span> <span class="org-string">'flexible'</span>
payload.type = 3;
<span class="org-keyword">case</span> <span class="org-string">'cartesian'</span>
payload.type = 4;
<span class="org-keyword">end</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org6d52ffc" class="outline-4">
<h4 id="org6d52ffc">Add Stiffness, Damping and Mass properties of the Payload</h4>
<div class="outline-text-4" id="text-org6d52ffc">
<div class="org-src-container">
<pre class="src src-matlab">payload.K = args.K;
payload.C = args.C;
payload.m = args.m;
payload.I = args.I;
payload.h = args.h;
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgaaed406" class="outline-3">
<h3 id="orgaaed406"><span class="section-number-3">6.2</span> Ground</h3>
<div class="outline-text-3" id="text-6-2">
<p>
<a id="orge64ba82"></a>
</p>
<p>
This Matlab function is accessible <a href="../src/initializeGround.m">here</a>.
</p>
</div>
<div id="outline-container-org706f994" class="outline-4">
<h4 id="org706f994">Function description</h4>
<div class="outline-text-4" id="text-org706f994">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-keyword">function</span> <span class="org-variable-name">[ground]</span> = <span class="org-function-name">initializeGround</span>(<span class="org-variable-name">args</span>)
<span class="org-comment">% initializeGround - Initialize the Ground that can then be used for simulations and analysis</span>
<span class="org-comment">%</span>
<span class="org-comment">% Syntax: [ground] = initializeGround(args)</span>
<span class="org-comment">%</span>
<span class="org-comment">% Inputs:</span>
<span class="org-comment">% - args - Structure with the following fields:</span>
<span class="org-comment">% - type - 'none', 'solid', 'flexible'</span>
<span class="org-comment">% - K [3x1] - Translation Stiffness of the Ground [N/m]</span>
<span class="org-comment">% - C [3x1] - Translation Damping of the Ground [N/(m/s)]</span>
<span class="org-comment">%</span>
<span class="org-comment">% Outputs:</span>
<span class="org-comment">% - ground - Struture with the following properties:</span>
<span class="org-comment">% - type - 1 (none), 2 (solid), 3 (flexible)</span>
<span class="org-comment">% - K [3x1] - Translation Stiffness of the Ground [N/m]</span>
<span class="org-comment">% - C [3x1] - Translation Damping of the Ground [N/(m/s)]</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgb15b49f" class="outline-4">
<h4 id="orgb15b49f">Optional Parameters</h4>
<div class="outline-text-4" id="text-orgb15b49f">
<div class="org-src-container">
<pre class="src src-matlab">arguments
args.type char {mustBeMember(args.type,{<span class="org-string">'none'</span>, <span class="org-string">'solid'</span>, <span class="org-string">'flexible'</span>})} = <span class="org-string">'none'</span>
args.K (3,1) double {mustBeNumeric, mustBeNonnegative} = 1e8<span class="org-type">*</span>ones(3,1)
args.C (3,1) double {mustBeNumeric, mustBeNonnegative} = 1e1<span class="org-type">*</span>ones(3,1)
<span class="org-keyword">end</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgef7035d" class="outline-4">
<h4 id="orgef7035d">Add Ground Type</h4>
<div class="outline-text-4" id="text-orgef7035d">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-keyword">switch</span> <span class="org-constant">args.type</span>
<span class="org-keyword">case</span> <span class="org-string">'none'</span>
ground.type = 1;
<span class="org-keyword">case</span> <span class="org-string">'solid'</span>
ground.type = 2;
<span class="org-keyword">case</span> <span class="org-string">'flexible'</span>
ground.type = 3;
<span class="org-keyword">end</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org95633e8" class="outline-4">
<h4 id="org95633e8">Add Stiffness and Damping properties of the Ground</h4>
<div class="outline-text-4" id="text-org95633e8">
<div class="org-src-container">
<pre class="src src-matlab">ground.K = args.K;
ground.C = args.C;
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org4bdfc33" class="outline-3">
<h3 id="org4bdfc33"><span class="section-number-3">6.3</span> Z-Axis Geophone</h3>
<div class="outline-text-3" id="text-6-3">
</div>
<div id="outline-container-orgf6e6126" class="outline-4">
<h4 id="orgf6e6126"><span class="section-number-4">6.3.1</span> Working Principle</h4>
<div class="outline-text-4" id="text-6-3-1">
<p> <p>
From the schematic of the Z-axis geophone shown in Figure <a href="#org819fba8">5</a>, we can write the transfer function from the support velocity \(\dot{w}\) to the relative velocity of the inertial mass \(\dot{d}\): From the schematic of the Z-axis geophone shown in Figure <a href="#org819fba8">5</a>, we can write the transfer function from the support velocity \(\dot{w}\) to the relative velocity of the inertial mass \(\dot{d}\):
\[ \frac{\dot{d}}{\dot{w}} = \frac{-\frac{s^2}{{\omega_0}^2}}{\frac{s^2}{{\omega_0}^2} + 2 \xi \frac{s}{\omega_0} + 1} \] \[ \frac{\dot{d}}{\dot{w}} = \frac{-\frac{s^2}{{\omega_0}^2}}{\frac{s^2}{{\omega_0}^2} + 2 \xi \frac{s}{\omega_0} + 1} \]
@ -548,9 +740,9 @@ We generally want to have the smallest resonant frequency \(\omega_0\) to measur
</div> </div>
</div> </div>
<div id="outline-container-orgb3509cd" class="outline-4"> <div id="outline-container-org7b9c8ed" class="outline-4">
<h4 id="orgb3509cd"><span class="section-number-4">6.1.2</span> Initialization function</h4> <h4 id="org7b9c8ed"><span class="section-number-4">6.3.2</span> Initialization function</h4>
<div class="outline-text-4" id="text-6-1-2"> <div class="outline-text-4" id="text-6-3-2">
<p> <p>
<a id="orgd31bda9"></a> <a id="orgd31bda9"></a>
</p> </p>
@ -585,12 +777,12 @@ This Matlab function is accessible <a href="../src/initializeZAxisGeophone.m">he
</div> </div>
<div id="outline-container-org99786f1" class="outline-3"> <div id="outline-container-org99786f1" class="outline-3">
<h3 id="org99786f1"><span class="section-number-3">6.2</span> Z-Axis Accelerometer</h3> <h3 id="org99786f1"><span class="section-number-3">6.4</span> Z-Axis Accelerometer</h3>
<div class="outline-text-3" id="text-6-2"> <div class="outline-text-3" id="text-6-4">
</div> </div>
<div id="outline-container-orgf6e6126" class="outline-4"> <div id="outline-container-org64fd353" class="outline-4">
<h4 id="orgf6e6126"><span class="section-number-4">6.2.1</span> Working Principle</h4> <h4 id="org64fd353"><span class="section-number-4">6.4.1</span> Working Principle</h4>
<div class="outline-text-4" id="text-6-2-1"> <div class="outline-text-4" id="text-6-4-1">
<p> <p>
From the schematic of the Z-axis accelerometer shown in Figure <a href="#org1274602">6</a>, we can write the transfer function from the support acceleration \(\ddot{w}\) to the relative position of the inertial mass \(d\): From the schematic of the Z-axis accelerometer shown in Figure <a href="#org1274602">6</a>, we can write the transfer function from the support acceleration \(\ddot{w}\) to the relative position of the inertial mass \(d\):
\[ \frac{d}{\ddot{w}} = \frac{-\frac{1}{{\omega_0}^2}}{\frac{s^2}{{\omega_0}^2} + 2 \xi \frac{s}{\omega_0} + 1} \] \[ \frac{d}{\ddot{w}} = \frac{-\frac{1}{{\omega_0}^2}}{\frac{s^2}{{\omega_0}^2} + 2 \xi \frac{s}{\omega_0} + 1} \]
@ -627,9 +819,9 @@ Note that there is trade-off between:
</div> </div>
</div> </div>
<div id="outline-container-org7b9c8ed" class="outline-4"> <div id="outline-container-orge8bb0f7" class="outline-4">
<h4 id="org7b9c8ed"><span class="section-number-4">6.2.2</span> Initialization function</h4> <h4 id="orge8bb0f7"><span class="section-number-4">6.4.2</span> Initialization function</h4>
<div class="outline-text-4" id="text-6-2-2"> <div class="outline-text-4" id="text-6-4-2">
<p> <p>
<a id="orge91f65f"></a> <a id="orge91f65f"></a>
</p> </p>
@ -669,7 +861,7 @@ This Matlab function is accessible <a href="../src/initializeZAxisAccelerometer.
</div> </div>
<div id="postamble" class="status"> <div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p> <p class="author">Author: Dehaeze Thomas</p>
<p class="date">Created: 2020-02-11 mar. 17:51</p> <p class="date">Created: 2020-02-13 jeu. 14:42</p>
</div> </div>
</body> </body>
</html> </html>

Binary file not shown.

View File

@ -149,6 +149,158 @@ There is two main types of inertial sensor that can be used to measure the absol
Both inertial sensors are described bellow. Both inertial sensors are described bellow.
* Other Elements * Other Elements
** Payload
:PROPERTIES:
:header-args:matlab+: :tangle ../src/initializePayload.m
:header-args:matlab+: :comments none :mkdirp yes :eval no
:END:
<<sec:initializePayload>>
This Matlab function is accessible [[file:../src/initializePayload.m][here]].
*** Function description
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
function [payload] = initializePayload(args)
% initializePayload - Initialize the Payload that can then be used for simulations and analysis
%
% Syntax: [payload] = initializePayload(args)
%
% Inputs:
% - args - Structure with the following fields:
% - type - 'none', 'solid', 'flexible', 'cartesian'
% - h [1x1] - Height of the CoM of the payload w.r.t {M} [m]
% This also the position where K and C are defined
% - K [6x1] - Stiffness of the Payload [N/m, N/rad]
% - C [6x1] - Damping of the Payload [N/(m/s), N/(rad/s)]
% - m [1x1] - Mass of the Payload [kg]
% - I [3x3] - Inertia matrix for the Payload [kg*m2]
%
% Outputs:
% - payload - Struture with the following properties:
% - type - 1 (none), 2 (solid), 3 (flexible)
% - h [1x1] - Height of the CoM of the payload w.r.t {M} [m]
% - K [6x1] - Stiffness of the Payload [N/m, N/rad]
% - C [6x1] - Stiffness of the Payload [N/(m/s), N/(rad/s)]
% - m [1x1] - Mass of the Payload [kg]
% - I [3x3] - Inertia matrix for the Payload [kg*m2]
#+end_src
*** Optional Parameters
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
arguments
args.type char {mustBeMember(args.type,{'none', 'solid', 'flexible', 'cartesian'})} = 'none'
args.K (6,1) double {mustBeNumeric, mustBeNonnegative} = 1e8*ones(6,1)
args.C (6,1) double {mustBeNumeric, mustBeNonnegative} = 1e1*ones(6,1)
args.h (1,1) double {mustBeNumeric, mustBeNonnegative} = 100e-3
args.m (1,1) double {mustBeNumeric, mustBeNonnegative} = 10
args.I (3,3) double {mustBeNumeric, mustBeNonnegative} = 1*eye(3)
end
#+end_src
*** Add Payload Type
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
switch args.type
case 'none'
payload.type = 1;
case 'solid'
payload.type = 2;
case 'flexible'
payload.type = 3;
case 'cartesian'
payload.type = 4;
end
#+end_src
*** Add Stiffness, Damping and Mass properties of the Payload
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
payload.K = args.K;
payload.C = args.C;
payload.m = args.m;
payload.I = args.I;
payload.h = args.h;
#+end_src
** Ground
:PROPERTIES:
:header-args:matlab+: :tangle ../src/initializeGround.m
:header-args:matlab+: :comments none :mkdirp yes :eval no
:END:
<<sec:initializeGround>>
This Matlab function is accessible [[file:../src/initializeGround.m][here]].
*** Function description
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
function [ground] = initializeGround(args)
% initializeGround - Initialize the Ground that can then be used for simulations and analysis
%
% Syntax: [ground] = initializeGround(args)
%
% Inputs:
% - args - Structure with the following fields:
% - type - 'none', 'solid', 'flexible'
% - K [3x1] - Translation Stiffness of the Ground [N/m]
% - C [3x1] - Translation Damping of the Ground [N/(m/s)]
%
% Outputs:
% - ground - Struture with the following properties:
% - type - 1 (none), 2 (solid), 3 (flexible)
% - K [3x1] - Translation Stiffness of the Ground [N/m]
% - C [3x1] - Translation Damping of the Ground [N/(m/s)]
#+end_src
*** Optional Parameters
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
arguments
args.type char {mustBeMember(args.type,{'none', 'solid', 'flexible'})} = 'none'
args.K (3,1) double {mustBeNumeric, mustBeNonnegative} = 1e8*ones(3,1)
args.C (3,1) double {mustBeNumeric, mustBeNonnegative} = 1e1*ones(3,1)
end
#+end_src
*** Add Ground Type
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
switch args.type
case 'none'
ground.type = 1;
case 'solid'
ground.type = 2;
case 'flexible'
ground.type = 3;
end
#+end_src
*** Add Stiffness and Damping properties of the Ground
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
ground.K = args.K;
ground.C = args.C;
#+end_src
** Z-Axis Geophone ** Z-Axis Geophone
*** Working Principle *** Working Principle
From the schematic of the Z-axis geophone shown in Figure [[fig:z_axis_geophone]], we can write the transfer function from the support velocity $\dot{w}$ to the relative velocity of the inertial mass $\dot{d}$: From the schematic of the Z-axis geophone shown in Figure [[fig:z_axis_geophone]], we can write the transfer function from the support velocity $\dot{w}$ to the relative velocity of the inertial mass $\dot{d}$:

Binary file not shown.

Binary file not shown.

34
src/initializeGround.m Normal file
View File

@ -0,0 +1,34 @@
function [ground] = initializeGround(args)
% initializeGround - Initialize the Ground that can then be used for simulations and analysis
%
% Syntax: [ground] = initializeGround(args)
%
% Inputs:
% - args - Structure with the following fields:
% - type - 'none', 'solid', 'flexible'
% - K [3x1] - Translation Stiffness of the Ground [N/m]
% - C [3x1] - Translation Damping of the Ground [N/(m/s)]
%
% Outputs:
% - ground - Struture with the following properties:
% - type - 1 (none), 2 (solid), 3 (flexible)
% - K [3x1] - Translation Stiffness of the Ground [N/m]
% - C [3x1] - Translation Damping of the Ground [N/(m/s)]
arguments
args.type char {mustBeMember(args.type,{'none', 'solid', 'flexible'})} = 'none'
args.K (3,1) double {mustBeNumeric, mustBeNonnegative} = 1e8*ones(3,1)
args.C (3,1) double {mustBeNumeric, mustBeNonnegative} = 1e1*ones(3,1)
end
switch args.type
case 'none'
ground.type = 1;
case 'solid'
ground.type = 2;
case 'flexible'
ground.type = 3;
end
ground.K = args.K;
ground.C = args.C;

50
src/initializePayload.m Normal file
View File

@ -0,0 +1,50 @@
function [payload] = initializePayload(args)
% initializePayload - Initialize the Payload that can then be used for simulations and analysis
%
% Syntax: [payload] = initializePayload(args)
%
% Inputs:
% - args - Structure with the following fields:
% - type - 'none', 'solid', 'flexible', 'cartesian'
% - h [1x1] - Height of the CoM of the payload w.r.t {M} [m]
% This also the position where K and C are defined
% - K [6x1] - Stiffness of the Payload [N/m, N/rad]
% - C [6x1] - Damping of the Payload [N/(m/s), N/(rad/s)]
% - m [1x1] - Mass of the Payload [kg]
% - I [3x3] - Inertia matrix for the Payload [kg*m2]
%
% Outputs:
% - payload - Struture with the following properties:
% - type - 1 (none), 2 (solid), 3 (flexible)
% - h [1x1] - Height of the CoM of the payload w.r.t {M} [m]
% - K [6x1] - Stiffness of the Payload [N/m, N/rad]
% - C [6x1] - Stiffness of the Payload [N/(m/s), N/(rad/s)]
% - m [1x1] - Mass of the Payload [kg]
% - I [3x3] - Inertia matrix for the Payload [kg*m2]
arguments
args.type char {mustBeMember(args.type,{'none', 'solid', 'flexible', 'cartesian'})} = 'none'
args.K (6,1) double {mustBeNumeric, mustBeNonnegative} = 1e8*ones(6,1)
args.C (6,1) double {mustBeNumeric, mustBeNonnegative} = 1e1*ones(6,1)
args.h (1,1) double {mustBeNumeric, mustBeNonnegative} = 100e-3
args.m (1,1) double {mustBeNumeric, mustBeNonnegative} = 10
args.I (3,3) double {mustBeNumeric, mustBeNonnegative} = 1*eye(3)
end
switch args.type
case 'none'
payload.type = 1;
case 'solid'
payload.type = 2;
case 'flexible'
payload.type = 3;
case 'cartesian'
payload.type = 4;
end
payload.K = args.K;
payload.C = args.C;
payload.m = args.m;
payload.I = args.I;
payload.h = args.h;