Re: Re: Representation and Simulation of Dynamic Systems

*To*: mathgroup at smc.vnet.net*Subject*: [mg56989] Re: [mg56968] Re: [mg56928] Representation and Simulation of Dynamic Systems*From*: Chris Chiasson <chris.chiasson at gmail.com>*Date*: Thu, 12 May 2005 02:32:23 -0400 (EDT)*References*: <200505110924.FAA24079@smc.vnet.net>*Reply-to*: Chris Chiasson <chris.chiasson at gmail.com>*Sender*: owner-wri-mathgroup at wolfram.com

Dr. Caffa Vittorio, Do you have a good link (http://....) that describes covariance simulation and/or the method of adjoints? Regards, On 5/11/05, Caffa Vittorio Dr. <Caffa at iabg.de> wrote: > Chris, > > I have used as a toy example a dynamic system which happens to be linear > with constant coefficients. Actually, I wanted to focus the discussion > on non-linear dynamic systems. > > (As a special case, linear systems, possibly with non-constant > coefficient, could be also analyzed with an extension of the method I am > suggesting. Given the system description, one could for instance compute > symbolically the matrices A(t), B(t), C(t), D(t). Then using the method > of adjoints or a covariance simulation one could compute the system for > example the system response to a stochastic input.) > > Actually the method I am suggesting is a surrogate of an interface into > which one could place a block diagram. If such an interface were > available I would probably do all my simulation work with Mathematica > instead of using that-simulation-link-addition-which-must-not-be-named > on that-mathematics-laboratory-program-which-must-not-be-named. > > Cheers, Vittorio > > > >-----Original Message----- > >From: Chris Chiasson [mailto:chris.chiasson at gmail.com] To: mathgroup at smc.vnet.net > >Sent: Tuesday, May 10, 2005 4:22 PM > >To: Caffa Vittorio Dr. > >Cc: mathgroup at smc.vnet.net > >Subject: [mg56989] [mg56968] Re: [mg56928] Representation and Simulation of Dynamic Systems > > > >It seems like you are solving systems with constant coefficients. > > > >The trickiest parts would be (a) designing an interface into which one > >could place a block diagram and (b) having Mathematica interpret that > >diagram. > > > >If you could do that, control system professional can probably do > >whatever else you might need ... > > > >http://library.wolfram.com/examples/CSPExtending/ > > > >Does anyone know if there is a good bond graph or block diagram > >"package" available for Mathematica? > > > >I would really like to see the equivalent of > >that-simulation-link-addition-which-must-not-be-named on > >that-mathematics-laboratory-program-which-must-not-be-named for > >Mathematica. > > > >Regards, > > > >On 5/10/05, Caffa Vittorio Dr. <Caffa at iabg.de> wrote: > >> The behavior of (time-continuous, non-linear) dynamic systems can be > >> numerically investigated with NDSolve. One can first sketch a block > >> diagram of the system and then convert it into equations. Here is a > toy > >> example after the conversion: > >> > >> pos'[t] = vel[t] > >> vel'[t] = -k pos[t] + force[t] / m > >> > >> This works fine if the variables are all states, as in the example > >> above. But often, in order to describe a given dynamic system you > want > >> or you have to introduce some auxiliary variables (i.e. variables > which > >> are not states). This is in fact the case if you want to describe a > >> generic dynamic system. Here are the standard equations: > >> > >> x'[t] = f[x[t], u[t], t] (state equations) > >> y[t] = g[x[t], u[t], t] (output equations) > >> > >> where: x = state vector, u = input vector, y = output vector, t = > time. > >> In this case the components of the output vector are the "auxiliary" > >> variables. > >> > >> I'm considering here a scheme for representing dynamic systems > (possibly > >> using a block diagram as a starting point) which allows the usage of > >> auxiliary variables. This representation can be transformed into > >> equations for NDSolve automatically. After having solved the > equations > >> it is possible to inspect not only the state variables but also the > >> auxiliary variables. > >> > >> Comments or alternative solutions to the problem I'm considering are > >> welcome! > >> > >> Procedure > >> > >> o) Sketch the system on a piece of paper. Here is a toy example: > >> > >> ---------- [ -k ] --------- > >> | | > >> V | > >> force[t] --> [ 1/m ] --> + --> [ 1/s ] ---> [ 1/s ] ---> pos[t] > >> | | > >> | --------------> vel[t] > >> | > >> ---------------------------> acc[t] > >> > >> Note: [ 1/s ] is an integrator block > >> [ k ] is a gain block > >> > >> o) Convert the sketch into a system description: > >> > >> In[1]:= sys = {pos'[t] -> vel[t], > >> vel'[t] -> acc[t], > >> acc[t] -> -k pos[t] + force[t] / m}; > >> > >> Note: the arrow points to the source of the signal. > >> > >> o) Make a list of the state variables: > >> > >> In[2]:= states = {pos[t], vel[t]}; > >> > >> o) Form the differential equations (the following steps could be > >> performed by a function): > >> > >> In[3]:= lhs = D[states, t] > >> > >> Out[3]= {pos'[t], vel'[t]} > >> > >> In[4]:= rhs = D[states, t] //. sys > >> > >> force[t] > >> Out[4]= {vel[t], -------- - k pos[t]} > >> m > >> > >> In[5]:= eqns = Join[Thread[lhs == rhs], {pos[0] == pos0, vel[0] == > >> vel0}] > >> > >> force[t] > >> Out[5]= {pos'[t] == vel[t], vel'[t] == -------- - k pos[t], pos[0] == > >> pos0, > >> m > >> vel[0] == vel0} > >> > >> o) Specify the parameters: > >> > >> In[6]:= params = {m -> 10, k -> 2, pos0 -> 0, vel0 -> 0, force[t] -> > >> Sin[t]}; > >> > >> o) Solve the differential equations: > >> > >> In[7]:= sol = First[NDSolve[eqns /. params, states, {t, 0, 10}]] > >> > >> Out[7]= {pos[t] -> InterpolatingFunction[{{0., 10.}}, <>][t], > >> > >> vel[t] -> InterpolatingFunction[{{0., 10.}}, <>][t]} > >> > >> o) Inspect the results (including auxiliary variables) > >> > >> In[8]:= Plot[pos[t] /. sol, {t, 0, 10}] > >> > >> Out[8]= -Graphics- > >> > >> In[9]:= Plot[acc[t] //. sys /. params /. sol, {t, 0, 10}] > >> > >> Out[9]= -Graphics- > >> > >> Cheers, Vittorio > >> > >> -------------------------------------------- > >> Dr.-Ing. Vittorio G. Caffa > >> IABG mbH > >> Abt. VG 32 > >> Einsteinstr. 20 > >> 85521 Ottobrunn / Germany > >> > >> Tel. (089) 6088 2054 > >> Fax: (089) 6088 3990 > >> E-mail: caffa at iabg.de > >> Website : www.iabg.de > >> -------------------------------------------- > >> > >> > > > > > >-- > >Chris Chiasson > >http://chrischiasson.com/ > >1 (810) 265-3161 > > -- Chris Chiasson http://chrischiasson.com/ 1 (810) 265-3161

**References**:**Re: Representation and Simulation of Dynamic Systems***From:*"Caffa Vittorio Dr." <Caffa@iabg.de>

**Re: Converting result to ASCII-art**

**Re: Re: Re: Re: named pattern variable scoped as global, should be local**

**Re: Representation and Simulation of Dynamic Systems**

**Re: Representation and Simulation of Dynamic Systems**