view m-toolbox/html_help/help/ug/ssm_assemble_content.html @ 47:dd93c9ba6624 database-connection-manager

Fix Java dialog
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Tue, 06 Dec 2011 19:07:27 +0100
parents f0afece42f48
children
line wrap: on
line source

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
	<TITLE></TITLE>
	<META NAME="GENERATOR" CONTENT="OpenOffice.org 3.1  (Win32)">
	<META NAME="CREATED" CONTENT="0;0">
	<META NAME="CHANGEDBY" CONTENT="Adrien G">
	<META NAME="CHANGED" CONTENT="20090827;17255200">
</HEAD>
<BODY LANG="de-DE" DIR="LTR">
<P>A collection of ssm arrays can be assembled into one ssm using the
assemble function.</P>
<H2>Managing inputs/outputs when assembling</H2>
<P>The order of the systems does not modify the output of .
The function assemble work by matching inputs and outputs of the same
name. Of course, they must have the same dimensionality, same
time-step. However, the check for units is not implemented yet.</P>
<P>In terms of time-step it is important to assemble all continuously
linked models together when the system is continuous, and discretize
it later on. Time discrete models (typically digital systems, and the
dynamical branch from the actuator input to the sensor output) should
be assembled together when they are time-discrete. The discretization
includes a zero hold which models correctly the A/D filter behavior.</P>
<P>Moreover, a system can be assembled in multiple steps. In this
case there is a risk of &ldquo;closing a loop&rdquo; multiple times.
To avoid this, the method &ldquo;assemble&rdquo; suppresses the
inputs once they are assembled. May the user need the input for a
simulation later on, he must duplicate it using the function
&ldquo;inputDuplicate&rdquo;. Built-in models should also have
built-in duplicated inputs to insert signals.</P>
<H2>Example using an existing built-in models</H2>
<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>
Trying sys.isStable with the first and the third system shows a
different result, the negative stiffness making the latter unstable.
The system can be made time discrete using the function
&ldquo;modifTimeStep&rdquo;.
The input is then duplicated to be used for a controller feedback.</P>
<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]));
&gt;&gt; sys.modifTimeStep(0.01);
&gt;&gt; sys.duplicateInput(<FONT COLOR="#a020f0">'U'</FONT>,<FONT COLOR="#a020f0">'Negative Bias'</FONT>)
------ ssm/1 -------
      amats: {  [2x2]  }  [1x1]
      mmats: {  [2x2]  }  [1x1]
      bmats: {  [2x1]   [2x2]   [2x1]  }  [1x3]
      cmats: {  [1x2]  }  [1x1]
      dmats: {   []     [1x2]    []    }  [1x3]
   timestep: 0.01
     inputs:  [1x3 ssmblock]
         1 : U | Fu [kg m s^(-2)]
         2 : N | Fn [kg m s^(-2)], On [m]
         3 : Negative Bias | Fu [kg m s^(-2)]
     states:  [1x1 ssmblock]
         1 : standard test system | x [m], xdot [m s^(-1)]
    outputs:  [1x1 ssmblock]
         1 : Y | y [m]
     params: (empty-plist) [1x1 plist]
    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 $
    Ninputs: 3
 inputsizes: [1 2 1]
   Noutputs: 1
outputsizes: 1
    Nstates: 1
 statesizes: 2
    Nparams: 0
isnumerical: true
       hist: ssm.hist [1x1 history]
   procinfo: (empty-plist) [1x1 plist]
   plotinfo: (empty-plist) [1x1 plist]
       name: standard_system_params
description: standard spring-mass-dashpot test system
    mdlfile: 
       UUID: 284b0ae3-947d-430a-802e-d9c3738ebb14
--------------------
M: running isStable
ans =
          2.05114794494015
warning, system named &quot;standard_system_params&quot; is not stable
ans =
     0</PRE></DIV><P>
Then a controller can be created to make the system stable.</P>
<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>
<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>
<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>
<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>
&gt;&gt; sysCL = assemble(sys, controller);
&gt;&gt; sysCL.isStable

------ ssm/1 -------
      amats: {  [2x2]  }  [1x1]
      mmats: {  [2x2]  }  [1x1]
      bmats: {  [2x2]   [2x1]  }  [1x2]
      cmats: {  [1x2]   
                [1x2]  }  [2x1]
      dmats: {  [1x2]    []     
                [1x2]    []    }  [2x2]
   timestep: 0.01
     inputs:  [1x2 ssmblock]
         1 : N | Fn [kg m s^(-2)], On [m]
         2 : Negative Bias | Fu [kg m s^(-2)]
     states:  [1x1 ssmblock]
         1 : standard test system | x [m], xdot [m s^(-1)]
    outputs:  [1x2 ssmblock]
         1 : Y | y [m]
         2 : U | U &gt; 1 []
     params: (empty-plist) [1x1 plist]
    version: $Id: ssm_assemble_content.html,v 1.4 2009/08/28 15:11:53 adrien Exp $
    Ninputs: 2
 inputsizes: [2 1]
   Noutputs: 2
outputsizes: [1 1]
    Nstates: 1
 statesizes: 2
    Nparams: 0
isnumerical: true
       hist: ssm.hist [1x1 history]
   procinfo: (empty-plist) [1x1 plist]
   plotinfo: (empty-plist) [1x1 plist]
       name: assembled( standard_system_params + controller))
description: 
    mdlfile: 
       UUID: c6f7397e-add7-4f4c-8eb0-fd0a4841e3cf
--------------------
M: running isStable
System named &quot;assembled( standard_system_params + controller))&quot; is stable
ans =
     1</PRE></DIV><P>
We can then use the system to produce a simulation.</P>
<P><BR><BR>
</P>
</BODY>
</HTML>