comparison m-toolbox/html_help/help/ug/ssm_assemble.html @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
3
4 <html lang="en">
5 <head>
6 <meta name="generator" content=
7 "HTML Tidy for Mac OS X (vers 1st December 2004), see www.w3.org">
8 <meta http-equiv="Content-Type" content=
9 "text/html; charset=us-ascii">
10
11 <title>Assembling systems (LTPDA Toolbox)</title>
12 <link rel="stylesheet" href="docstyle.css" type="text/css">
13 <meta name="generator" content="DocBook XSL Stylesheets V1.52.2">
14 <meta name="description" content=
15 "Presents an overview of the features, system requirements, and starting the toolbox.">
16 </head>
17
18 <body>
19 <a name="top_of_page" id="top_of_page"></a>
20
21 <p style="font-size:1px;">&nbsp;</p>
22
23 <table class="nav" summary="Navigation aid" border="0" width=
24 "100%" cellpadding="0" cellspacing="0">
25 <tr>
26 <td valign="baseline"><b>LTPDA Toolbox</b></td><td><a href="../helptoc.html">contents</a></td>
27
28 <td valign="baseline" align="right"><a href=
29 "ssm_modify.html"><img src="b_prev.gif" border="0" align=
30 "bottom" alt="Modifying systems"></a>&nbsp;&nbsp;&nbsp;<a href=
31 "ssm_simulation.html"><img src="b_next.gif" border="0" align=
32 "bottom" alt="Simulations"></a></td>
33 </tr>
34 </table>
35
36 <h1 class="title"><a name="f3-12899" id="f3-12899"></a>Assembling systems</h1>
37 <hr>
38
39 <p>
40 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
41 <HTML>
42 <HEAD>
43 <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
44 <TITLE></TITLE>
45 <META NAME="GENERATOR" CONTENT="OpenOffice.org 3.1 (Win32)">
46 <META NAME="CREATED" CONTENT="0;0">
47 <META NAME="CHANGEDBY" CONTENT="Adrien G">
48 <META NAME="CHANGED" CONTENT="20090827;17255200">
49 </HEAD>
50 <BODY LANG="de-DE" DIR="LTR">
51 <P>A collection of ssm arrays can be assembled into one ssm using the
52 assemble function.</P>
53 <H2>Managing inputs/outputs when assembling</H2>
54 <P>The order of the systems does not modify the output of .
55 The function assemble work by matching inputs and outputs of the same
56 name. Of course, they must have the same dimensionality, same
57 time-step. However, the check for units is not implemented yet.</P>
58 <P>In terms of time-step it is important to assemble all continuously
59 linked models together when the system is continuous, and discretize
60 it later on. Time discrete models (typically digital systems, and the
61 dynamical branch from the actuator input to the sensor output) should
62 be assembled together when they are time-discrete. The discretization
63 includes a zero hold which models correctly the A/D filter behavior.</P>
64 <P>Moreover, a system can be assembled in multiple steps. In this
65 case there is a risk of &ldquo;closing a loop&rdquo; multiple times.
66 To avoid this, the method &ldquo;assemble&rdquo; suppresses the
67 inputs once they are assembled. May the user need the input for a
68 simulation later on, he must duplicate it using the function
69 &ldquo;inputDuplicate&rdquo;. Built-in models should also have
70 built-in duplicated inputs to insert signals.</P>
71 <H2>Example using an existing built-in models</H2>
72 <DIV CLASS="fragment"><PRE STYLE="margin-bottom: 0.5cm">&gt;&gt; <FONT COLOR="#000000"><FONT FACE="Courier New, monospace">sys = ssm(plist(</FONT></FONT><FONT COLOR="#a020f0"><FONT FACE="Courier New, monospace"><FONT SIZE=2>'built-in'</FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="Courier New, monospace"><FONT SIZE=2>, </FONT></FONT></FONT><FONT COLOR="#a020f0"><FONT FACE="Courier New, monospace">'standard_system_params'</FONT></FONT><FONT COLOR="#000000"><FONT FACE="Courier New, monospace">, </FONT></FONT><FONT COLOR="#a020f0"><FONT FACE="Courier New, monospace">'setnames'</FONT></FONT><FONT COLOR="#000000"><FONT FACE="Courier New, monospace">, {</FONT></FONT><FONT COLOR="#a020f0"><FONT FACE="Courier New, monospace"><FONT SIZE=2>'W'</FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="Courier New, monospace"><FONT SIZE=2>}, </FONT></FONT></FONT><FONT COLOR="#a020f0"><FONT FACE="Courier New, monospace"><FONT SIZE=2>'setvalues'</FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="Courier New, monospace"><FONT SIZE=2>, 0.2*i ));</FONT></FONT></FONT></PRE></DIV><P>
73 Trying sys.isStable with the first and the third system shows a
74 different result, the negative stiffness making the latter unstable.
75 The system can be made time discrete using the function
76 &ldquo;modifTimeStep&rdquo;.
77 The input is then duplicated to be used for a controller feedback.</P>
78 <DIV CLASS="fragment"><PRE>&gt;&gt; sys = ssm(plist(<FONT COLOR="#a020f0">'built-in'</FONT>, <FONT COLOR="#a020f0">'standard_system_params'</FONT>, <FONT COLOR="#a020f0">'setnames'</FONT>, {<FONT COLOR="#a020f0">'W'</FONT> <FONT COLOR="#a020f0">'C'</FONT>}, <FONT COLOR="#a020f0">'setvalues'</FONT>, [-0.2 -0.5]));
79 &gt;&gt; sys.modifTimeStep(0.01);
80 &gt;&gt; sys.duplicateInput(<FONT COLOR="#a020f0">'U'</FONT>,<FONT COLOR="#a020f0">'Negative Bias'</FONT>)
81 ------ ssm/1 -------
82 amats: { [2x2] } [1x1]
83 mmats: { [2x2] } [1x1]
84 bmats: { [2x1] [2x2] [2x1] } [1x3]
85 cmats: { [1x2] } [1x1]
86 dmats: { [] [1x2] [] } [1x3]
87 timestep: 0.01
88 inputs: [1x3 ssmblock]
89 1 : U | Fu [kg m s^(-2)]
90 2 : N | Fn [kg m s^(-2)], On [m]
91 3 : Negative Bias | Fu [kg m s^(-2)]
92 states: [1x1 ssmblock]
93 1 : standard test system | x [m], xdot [m s^(-1)]
94 outputs: [1x1 ssmblock]
95 1 : Y | y [m]
96 params: (empty-plist) [1x1 plist]
97 version: $Id: ssm_assemble_content.html,v 1.4 2009/08/28 15:11:53 adrien Exp $--&gt;$Id: ssm_assemble_content.html,v 1.4 2009/08/28 15:11:53 adrien Exp $
98 Ninputs: 3
99 inputsizes: [1 2 1]
100 Noutputs: 1
101 outputsizes: 1
102 Nstates: 1
103 statesizes: 2
104 Nparams: 0
105 isnumerical: true
106 hist: ssm.hist [1x1 history]
107 procinfo: (empty-plist) [1x1 plist]
108 plotinfo: (empty-plist) [1x1 plist]
109 name: standard_system_params
110 description: standard spring-mass-dashpot test system
111 mdlfile:
112 UUID: 284b0ae3-947d-430a-802e-d9c3738ebb14
113 --------------------
114 M: running isStable
115 ans =
116 2.05114794494015
117 warning, system named &quot;standard_system_params&quot; is not stable
118 ans =
119 0</PRE></DIV><P>
120 Then a controller can be created to make the system stable.</P>
121 <DIV CLASS="fragment"><PRE>&gt;&gt; <FONT COLOR="#000000"><FONT FACE="Courier New, monospace"><FONT SIZE=2>controller = ssm(plist( </FONT></FONT></FONT><FONT COLOR="#0000ff"><FONT FACE="Courier New, monospace"><FONT SIZE=2>...</FONT></FONT></FONT>
122 <FONT COLOR="#000000"> </FONT><FONT COLOR="#a020f0">'amats'</FONT><FONT COLOR="#000000">,cell(0,0), </FONT><FONT COLOR="#a020f0">'bmats'</FONT><FONT COLOR="#000000">,cell(0,1), </FONT><FONT COLOR="#a020f0">'cmats'</FONT><FONT COLOR="#000000">,cell(1,0), </FONT><FONT COLOR="#a020f0">'dmats'</FONT><FONT COLOR="#000000">,{-1}, </FONT><FONT COLOR="#0000ff">...</FONT>
123 <FONT COLOR="#000000"> </FONT><FONT COLOR="#a020f0">'timestep'</FONT><FONT COLOR="#000000">,0.01, </FONT><FONT COLOR="#a020f0">'name'</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#a020f0">'controller'</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#a020f0">'params'</FONT><FONT COLOR="#000000">,plist, </FONT><FONT COLOR="#0000ff">...</FONT>
124 <FONT COLOR="#000000"> </FONT><FONT COLOR="#a020f0">'statenames'</FONT><FONT COLOR="#000000">,{}, </FONT><FONT COLOR="#a020f0">'inputnames'</FONT><FONT COLOR="#000000">,{</FONT><FONT COLOR="#a020f0">'Y'</FONT><FONT COLOR="#000000">}, </FONT><FONT COLOR="#a020f0">'outputnames'</FONT><FONT COLOR="#000000">,{</FONT><FONT COLOR="#a020f0">'U'</FONT><FONT COLOR="#000000">} ));</FONT>
125 &gt;&gt; sysCL = assemble(sys, controller);
126 &gt;&gt; sysCL.isStable
127
128 ------ ssm/1 -------
129 amats: { [2x2] } [1x1]
130 mmats: { [2x2] } [1x1]
131 bmats: { [2x2] [2x1] } [1x2]
132 cmats: { [1x2]
133 [1x2] } [2x1]
134 dmats: { [1x2] []
135 [1x2] [] } [2x2]
136 timestep: 0.01
137 inputs: [1x2 ssmblock]
138 1 : N | Fn [kg m s^(-2)], On [m]
139 2 : Negative Bias | Fu [kg m s^(-2)]
140 states: [1x1 ssmblock]
141 1 : standard test system | x [m], xdot [m s^(-1)]
142 outputs: [1x2 ssmblock]
143 1 : Y | y [m]
144 2 : U | U &gt; 1 []
145 params: (empty-plist) [1x1 plist]
146 version: $Id: ssm_assemble_content.html,v 1.4 2009/08/28 15:11:53 adrien Exp $
147 Ninputs: 2
148 inputsizes: [2 1]
149 Noutputs: 2
150 outputsizes: [1 1]
151 Nstates: 1
152 statesizes: 2
153 Nparams: 0
154 isnumerical: true
155 hist: ssm.hist [1x1 history]
156 procinfo: (empty-plist) [1x1 plist]
157 plotinfo: (empty-plist) [1x1 plist]
158 name: assembled( standard_system_params + controller))
159 description:
160 mdlfile:
161 UUID: c6f7397e-add7-4f4c-8eb0-fd0a4841e3cf
162 --------------------
163 M: running isStable
164 System named &quot;assembled( standard_system_params + controller))&quot; is stable
165 ans =
166 1</PRE></DIV><P>
167 We can then use the system to produce a simulation.</P>
168 <P><BR><BR>
169 </P>
170 </BODY>
171 </HTML>
172 </p>
173
174 <br>
175 <br>
176 <table class="nav" summary="Navigation aid" border="0" width=
177 "100%" cellpadding="0" cellspacing="0">
178 <tr valign="top">
179 <td align="left" width="20"><a href="ssm_modify.html"><img src=
180 "b_prev.gif" border="0" align="bottom" alt=
181 "Modifying systems"></a>&nbsp;</td>
182
183 <td align="left">Modifying systems</td>
184
185 <td>&nbsp;</td>
186
187 <td align="right">Simulations</td>
188
189 <td align="right" width="20"><a href=
190 "ssm_simulation.html"><img src="b_next.gif" border="0" align=
191 "bottom" alt="Simulations"></a></td>
192 </tr>
193 </table><br>
194
195 <p class="copy">&copy;LTP Team</p>
196 </body>
197 </html>