comparison m-toolbox/html_help/help/ug/ssm_assemble_content.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.0 Transitional//EN">
2 <HTML>
3 <HEAD>
4 <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
5 <TITLE></TITLE>
6 <META NAME="GENERATOR" CONTENT="OpenOffice.org 3.1 (Win32)">
7 <META NAME="CREATED" CONTENT="0;0">
8 <META NAME="CHANGEDBY" CONTENT="Adrien G">
9 <META NAME="CHANGED" CONTENT="20090827;17255200">
10 </HEAD>
11 <BODY LANG="de-DE" DIR="LTR">
12 <P>A collection of ssm arrays can be assembled into one ssm using the
13 assemble function.</P>
14 <H2>Managing inputs/outputs when assembling</H2>
15 <P>The order of the systems does not modify the output of .
16 The function assemble work by matching inputs and outputs of the same
17 name. Of course, they must have the same dimensionality, same
18 time-step. However, the check for units is not implemented yet.</P>
19 <P>In terms of time-step it is important to assemble all continuously
20 linked models together when the system is continuous, and discretize
21 it later on. Time discrete models (typically digital systems, and the
22 dynamical branch from the actuator input to the sensor output) should
23 be assembled together when they are time-discrete. The discretization
24 includes a zero hold which models correctly the A/D filter behavior.</P>
25 <P>Moreover, a system can be assembled in multiple steps. In this
26 case there is a risk of &ldquo;closing a loop&rdquo; multiple times.
27 To avoid this, the method &ldquo;assemble&rdquo; suppresses the
28 inputs once they are assembled. May the user need the input for a
29 simulation later on, he must duplicate it using the function
30 &ldquo;inputDuplicate&rdquo;. Built-in models should also have
31 built-in duplicated inputs to insert signals.</P>
32 <H2>Example using an existing built-in models</H2>
33 <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>
34 Trying sys.isStable with the first and the third system shows a
35 different result, the negative stiffness making the latter unstable.
36 The system can be made time discrete using the function
37 &ldquo;modifTimeStep&rdquo;.
38 The input is then duplicated to be used for a controller feedback.</P>
39 <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]));
40 &gt;&gt; sys.modifTimeStep(0.01);
41 &gt;&gt; sys.duplicateInput(<FONT COLOR="#a020f0">'U'</FONT>,<FONT COLOR="#a020f0">'Negative Bias'</FONT>)
42 ------ ssm/1 -------
43 amats: { [2x2] } [1x1]
44 mmats: { [2x2] } [1x1]
45 bmats: { [2x1] [2x2] [2x1] } [1x3]
46 cmats: { [1x2] } [1x1]
47 dmats: { [] [1x2] [] } [1x3]
48 timestep: 0.01
49 inputs: [1x3 ssmblock]
50 1 : U | Fu [kg m s^(-2)]
51 2 : N | Fn [kg m s^(-2)], On [m]
52 3 : Negative Bias | Fu [kg m s^(-2)]
53 states: [1x1 ssmblock]
54 1 : standard test system | x [m], xdot [m s^(-1)]
55 outputs: [1x1 ssmblock]
56 1 : Y | y [m]
57 params: (empty-plist) [1x1 plist]
58 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 $
59 Ninputs: 3
60 inputsizes: [1 2 1]
61 Noutputs: 1
62 outputsizes: 1
63 Nstates: 1
64 statesizes: 2
65 Nparams: 0
66 isnumerical: true
67 hist: ssm.hist [1x1 history]
68 procinfo: (empty-plist) [1x1 plist]
69 plotinfo: (empty-plist) [1x1 plist]
70 name: standard_system_params
71 description: standard spring-mass-dashpot test system
72 mdlfile:
73 UUID: 284b0ae3-947d-430a-802e-d9c3738ebb14
74 --------------------
75 M: running isStable
76 ans =
77 2.05114794494015
78 warning, system named &quot;standard_system_params&quot; is not stable
79 ans =
80 0</PRE></DIV><P>
81 Then a controller can be created to make the system stable.</P>
82 <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>
83 <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>
84 <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>
85 <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>
86 &gt;&gt; sysCL = assemble(sys, controller);
87 &gt;&gt; sysCL.isStable
88
89 ------ ssm/1 -------
90 amats: { [2x2] } [1x1]
91 mmats: { [2x2] } [1x1]
92 bmats: { [2x2] [2x1] } [1x2]
93 cmats: { [1x2]
94 [1x2] } [2x1]
95 dmats: { [1x2] []
96 [1x2] [] } [2x2]
97 timestep: 0.01
98 inputs: [1x2 ssmblock]
99 1 : N | Fn [kg m s^(-2)], On [m]
100 2 : Negative Bias | Fu [kg m s^(-2)]
101 states: [1x1 ssmblock]
102 1 : standard test system | x [m], xdot [m s^(-1)]
103 outputs: [1x2 ssmblock]
104 1 : Y | y [m]
105 2 : U | U &gt; 1 []
106 params: (empty-plist) [1x1 plist]
107 version: $Id: ssm_assemble_content.html,v 1.4 2009/08/28 15:11:53 adrien Exp $
108 Ninputs: 2
109 inputsizes: [2 1]
110 Noutputs: 2
111 outputsizes: [1 1]
112 Nstates: 1
113 statesizes: 2
114 Nparams: 0
115 isnumerical: true
116 hist: ssm.hist [1x1 history]
117 procinfo: (empty-plist) [1x1 plist]
118 plotinfo: (empty-plist) [1x1 plist]
119 name: assembled( standard_system_params + controller))
120 description:
121 mdlfile:
122 UUID: c6f7397e-add7-4f4c-8eb0-fd0a4841e3cf
123 --------------------
124 M: running isStable
125 System named &quot;assembled( standard_system_params + controller))&quot; is stable
126 ans =
127 1</PRE></DIV><P>
128 We can then use the system to produce a simulation.</P>
129 <P><BR><BR>
130 </P>
131 </BODY>
132 </HTML>