Continuous System Modeling Need various types models • Advances in system development ultimately rely on well-constructed predictive models • Applications: – traditional fields such as electrical and mechanical engineering – newer domains such as information and bio-technologies • Using appropriate simulation software, we can derive solutions to difficult problems using such models • Success often depends on having a variety of modeling approaches available to formulate the right model for the particular issue at hand • Therefore, a broad familiarity with different types of models is desirable Continuous System Models • Continuous system models were the first widely employed models and are traditionally described by ordinary and partial differential equations. • Such models originated in such areas as physics and chemistry, electrical circuits, mechanics, and aeronautics. • They have been extended to many new areas such as bio-informatics, homeland security, and social systems. • Continuous differential equation models remain an essential component in multi-formalism compositions. Multi-formalism Compositions • A host of formalisms have emerged in the last few decades that greatly increase our ability to express features of the real world and employ them in engineering systems. • Such formalisms include Neural Networks, Fuzzy Logic Systems, Cellular Automata, Evolutionary and Genetic Algorithms, among others. • Hybrid models combine two or more formalisms, e.g., fuzzy logic control of continuous manufacturing process. • Most often, applications will require such hybrids to address the problem domain of interest. Fundamental Systems Problems Systems Problem Does source of the data exist? What are we trying to learn about it? Which level transition is involved? systems analysis The system being analyzed may exist or may be planned. In either case we are trying to understand its behavioral characteristics. moving from higher to lower levels, e.g., using generative information to generate the data in a data system systems inference The system exists. We are trying to moving from lower to higher infer how it works from levels, e.g., having data, finding a observations of its behavior. means to generate it systems design The system being designed does not yet exist in the form that is being contemplated. We are trying to come up with a good design for it. moving from lower to higher levels, e.g. having a means to generate observed data, synthesizing it with components taken off the shelf. M&S Entities and Relations Device for executing model Real World Simulator Data: Input/output relation pairs modeling relation Each entity is represented as a dynamic system Each relation is represented by a homomorphism or other equivalence simulation relation Model structure for generating behavior claimed to represent real world M&S Framework: Continuous case Real World Simulator modeling relation Validity: •Accuracy of -retro-diction -prediction simulation relation Model d q(t) / dt = x(t) Numerical Integration: •Accuracy •Error effects Specification Levels for Differential Equation Systems Level 0 1 Specification Name What we know at this level Observation Frame how to stimulate the system with inputs; what variables to measure and how to observe them over a time base; I/O Behavior time-indexed data collected from a source system; consists of input/output pairs Differential Equation System Specification Input and output ports with continuous variables Input/output pairs described by relational equations using first and higher order derivatives, usually linear and some non-linear f(y(t), d y(t)/dt, ..., d yn(t)/dtn , x1(t), x2(t),..., xm(t))=0 e.g. d y2(t)/dt2 - (1 – y2) * d y(t)/dt - x1(t) =0 2 I/O Function knowledge of initial state; given an initial state, every input stimulus produces a unique output. 3 State Transition how states are affected by inputs; given a Canonical Ordinary Differential Equation Model state and an input what is the state after the input stimulus is over; what output event is d q1(t)/dt = f1(q1(t), q2(t), ..., qn(t), x1(t), x2(t),..., xm(t)) generated by a state. State Operator description y[0,t] = L(y(0),x(0,t)) ... d qn(t)/dt = fn(q1(t), q2(t), ..., qn(t), x1(t), x2(t),..., xm(t)) <y1(t), y2(t),..., yn(t) > = g(<q1(t), q2(t),..., qm(t)>) x,y = input and output vectors q = state vector Model, usually linear, can be induced from level 2 by realization methods 4 Coupled Component components and how they are coupled together. The components can be specified at lower levels or can even be structure systems themselves – leading to hierarchical structure. Components can be atomic DESS systems e.g. Integrators, or couplings of them, in hierarchical structure Canonical Ordinary Differential Equation Model d q1(t)/dt = f1(q1(t), q2(t), ..., qn(t), x1(t), x2(t),..., xm(t)) d q2(t)/dt = f2(q1(t), q2(t), ..., qn(t), x1(t), x2(t),..., xm(t)) ... d qn(t)/dt = fn(q1(t), q2(t), ..., qn(t), x1(t), x2(t),..., xm(t)) x q x f1 q x f2 d q1/dt q1 d q2/dt q2 d qn/dt qn ... q x fn Numerical Integration x = f(q(t),x(t)) x(ti) q dq (t ) q (t h) q(t ) lim h0 dt h f(q(ti),x(ti)) q(ti) 1 Euler or rectangular method. q (t h) q (t ) h q(h) q(0) dq (t ) dt 0 = f(q(t),x(t)) h q(2h) q(3h) 2h 3h q((n+1)h)=q(nh)+h*f(q(nh),x(nh)) Feedback Coupling qn f1 q1 f2 dq1 f1 (qn ) dt dq2 f 2 (q1 ) dt ... dqn f n (qn 1 ) dt q2 f3 q3 dqi f i (qi 1 ) dt Direct influence is negative if sign( f i (qi 1 )) sign(qi 1 ) (-) and positive if sign( f i (qi 1 )) sign(qi 1 ) (+) There is no connection if dq f i (qi 1 ) 0, i.e., i 0 dt ... qn Feedback Qualitative Analysis qn f1 q1 f2 q2 f3 q3 ... qn For a feedback connection there are no zero influences. Then the feedback loop is negative (positive) if Direct influences multiply in sign: (+)(+)= + N is odd (even) where N is the number of negative direct influences i.e., sign is determined by (-1) N (1) P (-1) N (+)(-)= (-)(-)= + e.g. N 0, P 1 positive feedback N 1, P 0 negative feedback N 2, P 0 positive feedback f But: N 1, P 1 oscillation 2nd Order Linear System (undamped) v v x P 2 exponential growth - x v v x N 2 exponential growth - x v v - x N 1, P 1 oscillation x angular frequency = 2 period = T = Continuous system simulation languages and systems state-space description languages: • Continuous System Simulation Language (CSSL) standard, e.g., ACSL • block oriented simulation systems, e.g., Simulink Van der Pol Oscillator CSSL PROGRAM Van der Pol INITIAL constant k = -1, x0 = 1, v0 = 0, tf = 20 END DYNAMIC DERIVATIVE x = integ(v, x0) v = integ((1 – x**2)*v – k*x, v0) END termt (t.ge.tf) END END Simulink building blocks 1/s + + integrator: dq / dt = x, y = q f(x) Sum: y = x1 + x2 * Multiplier: y = x1 * x2 c Gain: y = c * x Function: y = f(x) Sinusgenerator: y = sin (t) Subsystem: Placeholder for a subnetwork model Inport: Input from an external model 1 Constant: y = c c Outport: Output to an external model 1 Van der Pol Oscillator in Simulink Block Diagram k * 1 + * + v 1/s x 1/s 1 1st Order Linear System – exponential growth/decay c c0 q dq f (q) dt f (q ) cq c0 1st Order– constant input to exponential decay -c x + dq f ( q, x ) dt q f (q) x cq At equilibrium, dq 0= x cq qeq x / c dt difference(t ) x cq(t ) qeq x / c Damped Linear oscillator of second order -d m=1 F(t) k F(t) m + v d -k x (a) (b) x Van der Pol Oscillator Dynamic Behavior Lotka Volterra Model and Behavior Exercise: • write the ODE for the model • find the equilibrium point of the Lotka-Volterra model •investigate the oscillations around this equilibrium. •where do the maximum and minimum populations occur? •show that small oscillations around the equilibrium are approximated by the 2nd order linear oscillator. py = prey population pd = predator population b k d pyeq c pd eq pd pdmax b pd eq k pymin db pymax pd min d pyeq c py b k d py py c pd pd d py d dk [b k pd ] py kpd ( py ) pd o( py, pd ) dt c c d pd b cb [d cpy ]( pd ) py o( py, pd ) dt k k dk cb db c k Locating Min/Max using Zero Crossings dq dt q dq dt q dq 0 at t t ' dt q is maximum or minimum at t t ' Limit Cycle and Chaos are Opposites • • • • • limit cycles – initial state eventually winds up in a periodic loop or cycle chaos – trajectories are sensitive to initial states – small difference in initial state results in large difference in trajectory Note – ODE models are deterministic – if the input is zero, then if a trajectory returns to an earlier state, it will get into a cycle If a chaotic model has a trajectory that comes close to an earlier state than it diverges from that earlier portion due to its sensitivity to initial states BUT – a chaotic model can have a “strange attractor” i.e., a subset to which always returns, though not with a fixed period. Rössler Model and Chaotic Behavior fz (x, z) = b + (x – c)*z + y -1 + x fz z dx / dt - ( y z ) dy / dt x a y dz / dt b z ( x - c) -1 -a a = b = 0, c = 4.7 dx / dt =0 y=-z dy / dt 0 x= 0 dz / dt 0 z=0 or x=c z=0 equilibrium point = (0,0,0) state plane (v , z) to x time behavior interactive applet at: http://www.geom.uiuc.edu/~worfolk/apps/Rossler/ Rössler Behavior a = b = 0.2, and c = 8.0. http://mathforum.org/advanced/robertd/rossler.html http://astronomy.swin.edu.au/~pbourke/fractals/rossler/ Lorenz Attractor– Butterfly Effect dX / dt - c( X - Y ) dY / dt aX - Y - XZ dZ / dt b( XY - Z ) b 8 / 3 c 10 For a < 1 the solution rapidly decays to the origin X=Y=Z=0. This corresponds to no motion in the fluid context. For a > 1 (e.g. a=5) the orbit approaches one of two fixed points (depending on the initial values) away from the origin. The fixed points are at X 2 = Y 2=Z=a-1. In the convection context this corresponds to nonzero but steady fluid flow (in a circulating "roll" configuration). At larger values of a, for example a=24.1, the long time dynamics may either approach one of the fixed points or a strange attractor (depending on the choice of initial values), which coexist at these values of a. (Choose nearby initial values to find solutions that converge to the fixed points.) For a>24.74 the strange attractor collides with the fixed points, which become unstable so that practically all initial values lead to the familiar butterfly dynamics. a=28 gives the usual picture. Java applet: http://www.cmp.caltech.edu/~mcc/chaos_new/Lor_docs/intro.html http://astronomy.swin.edu.au/~pbourke/fractals/lorenz/ References/Literature • Course Notes from: B. P., H. Praehofer and T. G. Kim (2000). Theory of Modeling and Simulation: Integrating Discrete Event and Continuous Complex Dynamic Systems, (2nd Ed.) Academic Press, NY.) • On reserve: A First Course in Differential Equations: The Classic Fifth Edition (Hardcover) by Dennis G. Zill, Brooks Cole; 5 edition (December 8, 2000) Others: • – – – – – – The Nonlinear Workbook: Chaos, Fractals, Celluar Automata, Neural Networks, Genetic Algorithms, Gene Expression Programming, Support Vector Machine, Wavelets, Hidden Markov M (Paperback) by Willi-Hans Steeb, 588 pages, Publisher: World Scientific Publishing Company; 3rd edition (July 15, 2005) Modeling and Analysis of Post-Conflict Reconstruction, Damon B. Richardson, Richard F. Deckro, and Victor D. Wiley, JDMS: The Journal of Defense Modeling and Simulation,October 2004, Volume 1 Number 4 Fernando J. Barros, A Formal Representation of Hybrid Mobile Component, SIMULATION, May 2005; 81: 381 - 393. What is signal and what is noise in the brain? A.Knoblauch, G.Palm, Biosystems 79(1-3), pp 83-90, 2005. Discrete Event Multi-Level Models for Systems Biology, Uhrmacher, A.M. and Degenring, D. and Zeigler, B.P, LNCS Transactions on Computational Systems Biology, Vol. 1, 3380/2005, pp. 66-85. Modifications of the Helbing-Molnár-Farkas-Vicsek Social Force Model for Pedestrian Evolution, Taras I. Lakoba, D. J. Kaup, and Neal M. Finkelstein, SIMULATION 2005 81: 339352.