Re: Re: Representation and Simulation of Dynamic Systems

*To*: mathgroup at smc.vnet.net*Subject*: [mg57072] Re: [mg56984] Re: Representation and Simulation of Dynamic Systems*From*: "Caffa Vittorio Dr." <Caffa at iabg.de>*Date*: Sat, 14 May 2005 04:58:10 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

Hi Jens, Maybe I should give some background information to better specify the scope of my message: I work in the aerospace industry. My colleges and I do a lot of modeling of dynamic systems: airplanes, helicopters, rockets, etc. In my company there is also a department which is involved in automotive applications where a lot of modeling and simulation is done. Dynamic systems can be anything between very simple and extremely complex. If the system of interest is simple, one does exactly what you suggested: one writes down the equations of the system and solves them, for instance with NDSolve. In some cases one can also use DSolve or the Laplace technique to get a symbolic solution. On the other hand, some models are huge, frantic. In these cases the only sensible choice is the usage of special simulation tools of the kind Chris Chiasson mentioned. Here are some reasons for this choice: o) Graphic representation of the system, o) Hierarchical representation in systems and subsystems, o) Blocks can be represented with transfer functions, o) Signals can be time-continuous and/or time-discrete, o) Models can be easily modified, o) Signal can be easily inspected. But often the system of interest has medium complexity. For this case I have elaborated the simple technique for representing and simulating dynamic systems that I have described in a previous message. I am actually curious to know if someone uses a similar or maybe better technique. The ideas I have used are actually simple, but maybe it is useful to mention them: o) Engineers like to represent dynamic systems with block diagrams, o) Block diagrams are actually oriented graphs, o) Graphs can be represented with lists of rules, o) A graph editor could be used for generating the graph representation, o) Actually it is also possible to transform a graph description (maybe in form of rules) into a graph using DiscreteMath`GraphPlot. o) Using //. it is possible to transform the system description into equations for NDSolve, o) The parameters of the problem can be put into a list rules for flexibility, o) With //. one can conveniently inspect "auxiliary" variables (i.e. variables which are not states). Similarly one can use auxiliary variables in the specification of termination conditions. Cheers, Vittorio >-----Original Message----- >From: Jens-Peer Kuska [mailto:kuska at informatik.uni-leipzig.de] To: mathgroup at smc.vnet.net >Sent: Thursday, May 12, 2005 8:32 AM >Subject: [mg57072] [mg56984] Re: Representation and Simulation of Dynamic Systems > >Hi, > >and you can not select your depend output >variables (like y[t]) in >your example and just insert the solution that >NDSolve[] gives for >your independent variables ? Strange ... > >Regards > Jens > >"Caffa Vittorio Dr." <Caffa at iabg.de> schrieb im >Newsbeitrag news:d5s9bh$lj9$1 at smc.vnet.net... >> 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 >> -------------------------------------------- >> >

**Re: FindRoot::nlnum error message for non-linear system of equations**

**Re: FindRoot::nlnum error message for non-linear system of equations**

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

**bode diagram**