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