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;18204600">
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 </HEAD>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 <BODY LANG="en-US" DIR="LTR">
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 <P>The function simulate can use ssm object to produce simulations.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 </P>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 <H2>Simulation example.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 </H2>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 <P>The following closed loop system is built.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 </P>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 <DIV CLASS="fragment"><PRE><FONT SIZE=2>>> sys = ssm(plist(</FONT><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
|
19 >> sys.modifTimeStep(0.01);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 <FONT SIZE=2>>> sys.duplicateInput(</FONT><FONT COLOR="#a020f0">'U'</FONT>,<FONT COLOR="#a020f0">'Negative Bias'</FONT>);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 >> controller = ssm(plist( <FONT COLOR="#0000ff">...</FONT>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 <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
|
23 <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
|
24 <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
|
25 ------ ssm/1 -------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 amats: { [2x2] } [1x1]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 mmats: { [2x2] } [1x1]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 bmats: { [2x2] [2x1] } [1x2]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 cmats: { [1x2]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 [1x2] } [2x1]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 dmats: { [1x2] []
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 [1x2] [] } [2x2]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 timestep: 0.01
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 inputs: [1x2 ssmblock]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 1 : N | Fn [kg m s^(-2)], On [m]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 2 : Negative Bias | Fu [kg m s^(-2)]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 states: [1x1 ssmblock]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 1 : standard test system | x [m], xdot [m s^(-1)]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 outputs: [1x2 ssmblock]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 1 : Y | y [m]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 2 : U | U > 1 []
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 params: (empty-plist) [1x1 plist]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 version: $Id: ssm_simulation_content.html,v 1.3 2009/08/28 14:20:07 adrien Exp $
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 Ninputs: 2
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 inputsizes: [2 1]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 Noutputs: 2
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 outputsizes: [1 1]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 Nstates: 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 statesizes: 2
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 Nparams: 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 isnumerical: true
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 hist: ssm.hist [1x1 history]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 procinfo: (empty-plist) [1x1 plist]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 plotinfo: (empty-plist) [1x1 plist]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 name: assembled( standard_system_params + controller))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 description:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57 mdlfile:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 UUID: 163d7103-063b-4a57-af7e-b08d22fe42c1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59 --------------------</PRE></DIV><P>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60 Then we wish to use the inputs of N for a correlated force noise and
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 measurement noise, “Negative Bias” for a sinewave, and
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 there will be an observation DC offset.</P>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63 <P>We want as an output the controller output “U” and the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 sensor output “y”.</P>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 <DIV CLASS="fragment"><PRE>>> ao1 = ao(plist(<FONT COLOR="#a020f0">'FCN'</FONT>,<FONT COLOR="#a020f0">'sin(0:0.01:100)'</FONT>));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66 <FONT COLOR="#000000">>> ao_out = sysCL.simulate( plist(</FONT><FONT COLOR="#0000ff">...</FONT>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 <FONT COLOR="#a020f0"> 'NOISE VARIABLE NAMES'</FONT><FONT COLOR="#000000">, {</FONT><FONT COLOR="#a020f0">'Fn'</FONT><FONT COLOR="#000000"> </FONT><FONT COLOR="#a020f0">'On'</FONT><FONT COLOR="#000000">}, </FONT><FONT COLOR="#a020f0">'COVARIANCE'</FONT><FONT COLOR="#000000">, [1 0.1 ; 0.1 2] , </FONT><FONT COLOR="#0000ff">...</FONT>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 <FONT COLOR="#a020f0"> 'AOS VARIABLE NAMES'</FONT><FONT COLOR="#000000">, {</FONT><FONT COLOR="#a020f0">'Fu'</FONT><FONT COLOR="#000000">} ,</FONT><FONT COLOR="#a020f0">'AOS'</FONT><FONT COLOR="#000000">, ao1 ,</FONT><FONT COLOR="#0000ff">...</FONT>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 <FONT COLOR="#a020f0"> 'CONSTANT VARIABLE NAMES'</FONT><FONT COLOR="#000000">, {</FONT><FONT COLOR="#a020f0">'On'</FONT><FONT COLOR="#000000">}, </FONT><FONT COLOR="#a020f0">'CONSTANTS'</FONT><FONT COLOR="#000000">, 35, </FONT><FONT COLOR="#0000ff">...</FONT>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70 <FONT COLOR="#a020f0"> 'RETURN STATES'</FONT><FONT COLOR="#000000">, {</FONT><FONT COLOR="#a020f0">'x'</FONT><FONT COLOR="#000000">}, </FONT><FONT COLOR="#a020f0">'RETURN OUTPUTS'</FONT><FONT COLOR="#000000">, {</FONT><FONT COLOR="#a020f0">'y'</FONT><FONT COLOR="#000000"> </FONT><FONT COLOR="#a020f0">'U > 1'</FONT><FONT COLOR="#000000">}, </FONT><FONT COLOR="#0000ff">...</FONT>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71 <FONT COLOR="#a020f0"> 'SSINI'</FONT><FONT COLOR="#000000"> , {[100;3]}, </FONT><FONT COLOR="#a020f0">'TINI'</FONT><FONT COLOR="#000000">, 0));</FONT>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 >> iplot(ao_out([1, 2, 3]));</PRE></DIV><P>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73 <IMG SRC="images/simulate.png" NAME="images1" ALIGN=LEFT WIDTH=567 HEIGHT=454 BORDER=0><BR CLEAR=LEFT>It
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74 turns out the system output (blue) is not much like the state (red),
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 causing the control (green) to waste a lot of energy. The state is
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76 not experimentally available, but might be obtained through
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 filtering. The kalman method is so far the only filtering method
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78 implemented in the toolbox.</P>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79 <DIV CLASS="fragment"><PRE><FONT COLOR="#000000">>> ao_est = sysCL.kalman( plist(</FONT><FONT COLOR="#0000ff">...</FONT>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80 <FONT COLOR="#a020f0"> 'NOISE VARIABLE NAMES'</FONT><FONT COLOR="#000000">, {</FONT><FONT COLOR="#a020f0">'Fn'</FONT><FONT COLOR="#000000"> </FONT><FONT COLOR="#a020f0">'On'</FONT><FONT COLOR="#000000">}, </FONT><FONT COLOR="#a020f0">'COVARIANCE'</FONT><FONT COLOR="#000000">, [1 0.1 ; 0.1 2] , </FONT><FONT COLOR="#0000ff">...</FONT>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 <FONT COLOR="#a020f0"> 'AOS VARIABLE NAMES'</FONT><FONT COLOR="#000000">, {</FONT><FONT COLOR="#a020f0">'Fu'</FONT><FONT COLOR="#000000">} ,</FONT><FONT COLOR="#a020f0">'AOS'</FONT><FONT COLOR="#000000">, ao1 ,</FONT><FONT COLOR="#0000ff">...</FONT>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82 <FONT COLOR="#a020f0"> 'CONSTANT VARIABLE NAMES'</FONT><FONT COLOR="#000000">, {</FONT><FONT COLOR="#a020f0">'On'</FONT><FONT COLOR="#000000">}, </FONT><FONT COLOR="#a020f0">'CONSTANTS'</FONT><FONT COLOR="#000000">, 35, </FONT><FONT COLOR="#0000ff">...</FONT>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83 <FONT COLOR="#a020f0"> 'OUTPUT VARIABLE NAMES'</FONT><FONT COLOR="#000000">, {</FONT><FONT COLOR="#a020f0">'y'</FONT><FONT COLOR="#000000">}, </FONT><FONT COLOR="#a020f0">'OUTPUTS'</FONT><FONT COLOR="#000000"> , ao_out(2), </FONT><FONT COLOR="#0000ff">...</FONT>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 <FONT COLOR="#a020f0"> 'RETURN STATES'</FONT><FONT COLOR="#000000">, 1, </FONT><FONT COLOR="#a020f0">'RETURN OUTPUTS'</FONT><FONT COLOR="#000000">, 1 ));</FONT>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85 >> iplot(ao_out(2), ao_est(1), ao_out(1))</PRE></DIV><P>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86 <IMG SRC="images/kalman.png" NAME="images2" ALIGN=LEFT WIDTH=567 HEIGHT=454 BORDER=0><BR CLEAR=LEFT>In
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87 this example the estimate (blue) of the state (green) is
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
88 satisfactory. It leads us to think that such a filter should be used
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
89 to provide with the input of the controller.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
90 </P>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
91 <P>However, the DC offset correction by the kalman filter is one
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
92 information that is not available under usual circumstances.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
93 </P>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94 <P><BR><BR>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95 </P>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
96 <P STYLE="margin-bottom: 0cm"><BR>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
97 </P>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
98 <P STYLE="margin-bottom: 0cm"><BR>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
99 </P>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
100 <P><BR><BR>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
101 </P>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
102 </BODY>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
103 </HTML> |