Dynamic Systems Simulation PART I
This course really goes like a train.
Lec 1&2: Mathemetical models
Went through the course plan quickly, surely a lot of topics, a lot of labs, and 3 tests.
Mathematical modelling definitions
Mathematical modelling is
is the act of building a model.
a process in which real-life situations and relations in these
situations are expressed by using mathematics. (Haines and
Crouch, 2007)
the art of translating problems from an application area into
tractable mathematical formulations whose theoretical and numerical analysis provides insight, answers, and guidance useful for the originating application. (A. Neumaier, 2004)
a cyclical process in which real-life problems are translated into mathematical language, solved within a symbolic system, and the solutions tested back within the real-life system. (Verschaffel, Greer, and De Corte, 2002)
Mathematical model
- a representation in mathematical terms of the behavior of real devices and objects. (What Is Mathematical Modeling? by Clive L. Dym)
- a description of a system using mathematical concepts and language to facilitate proper explanation of a system or to study the effects of different components and to make predictions on patterns of behaviour. (Abramowitz and Stegun, 1968)
The real systems are too complicated. Model shoud be simple as possible, but not simpler. And which can be used to predict the behaviour of the real system.
Simulation
Simulating is the act of using a model for a simulation.
Major steps
- Formulate problem and model.
- Construct system model.
- Conduct simulation experiments.
- Interpret results.
- Document study.
Implement conclusions.
X. Validate model.
Types of methematical models
Models can be divided to three types by used information about real objects or processes, according to adversary’s knowledge
• White-box • Black-box • Grey-box
Black box
System which are modelled entirely based on experimental data (input-output measurements) are called black-box models. The user can observe the response (output) of the model for a certain stimulus (input) but has no information about the internal mechanism (principles).
Gray-box
Most of the time, it’s better to benefit from the advantages of both methods. In this case we’ll end up with gray-box models.
Simplification examples2:
Non-linear parameters or processes are often approximated by
linear ones.
Areas of physical detail are often simplified by averaging the localised properties.
Contact between one part of a model and another is sometimes considered perfect.
Model Classification
• Linear vs Nonlinear
• Static vs Dynamic
• Time-invariant vs Time-variant
• Discrete vs continuous
• Explicit vs Implicit
• Deterministic vs Probabilistic (stochastic). • etc.
Linear & Nonlinear
A linear mathematical model is governed by linear differential equations. A linear model is a model for which the superposition principle can be applied (Additivity and Homogeneity properties).
As for nonlinear, ones for which the principle of superposition does not apply.
Static & Dynamic
• Static models are not affected with time, only reply on present input.
• Dynamic models are affected with time
Time-invariant & Time-variant
• Time-invariant — the behaviour does not depends on time. If y(t) is a output for u(t), then y(t −τ) is a output for u(t −τ)
• Time-variant — output response depends on moment of observation as well as moment of input signal application.
Discrete & Continuous
• Discrete system is affected by the state variable changes at a discrete point of time.
• Continuous system is affected by the state variable, which changes continuously as a function with time.
Classification by sampling
See page 24, very direct.
Lec 3&4: Linear models
Linear time-invariant system (LTI)
As the name suggest, any linear time-invariant (LTI) system has two defining properties: linearity and time invariance.
Linearity
If input u1(t) produces response y1(t), input u2(t) produces response y2(t), …,and uk(t) produces response yk(t), then input $\sum_k c_ku_k(t)$ produces response $\sum_k c_ky_k(t),\ c_1,c_2,\dots,c_k$ Are real scalars.
Time invariance
If input u(t) produces response y(t), then input u(t − τ) produces response y (t − τ ), where τ is a time delay.
N-order differential equations
Linear dynamical models of continuous-time system could be given as n-order differential equations (DE) :
Causality condition for DE
The LTI system is called causal, if $n\ge m$
Differential operator and Characteristic equation
Some operator form, and characteristic equation, whoose roots determine a behavior of the system.
That can be demonstrate by a phase portrait.
Behaviour of the second-order LTI system
A phase portrait is a representative set of LTI system‘s solutions, plotted as parametric curves (with t as the parameter) on the Cartesian plane tracing the path of each particular solution ((x,y) = (y(t),y ̇(t)), −∞ < t < ∞.
The Cartesian plane where the phase portrait resides is called the phase plane.
The parametric curves traced by the solutions for specific initial conditions are called phase trajectories.
Second order LTI system
Mainly the classification for different root conditions. Just like old courses or what learn from Dr.Can’s Ch.
Roots are all real and negative - Stable
Roots are all real and positive - Unstable
Both real and is positive and negative respectively - Saddle
Both complex and $Re(\lambda_1,\lambda_2)<0$ - Stable focus
Both complex and $Re(\lambda_1,\lambda_2)>0$ - Unstable focus
Both complex and $Re(\lambda_1,\lambda_2)=0$ - Center
Followed by Laplace transformation and transfer function, which should be very familiar with.
Control System
Feedback control (closed-loop) enables to achieve new parameters of the system.
The modal control is based on this idea. The input signal is set as
where K is k × n matrix of feed-back gain coefficients.
Thus the augmented system is described in State-Space representation as
Here F is a n × n matrix that describe augmented closed-loop system.
Lec 4&5: Nonlinear systems
Definition 1.
The equilibrium point x = 0 of $\dot{x} = f(x)$ is
stable if for each $\epsilon>0$ There is $\delta>0$ (dependent on $\epsilon$ ) such that
Unstable otherwise
Definition 2. Asymptotic stability
Let the origin be an asymptotically stable equilibrium point of the system $x ̇ = f(x)$, where f is a locally Lipschitz function defined over a domain $D⊂\mathbb{R}^n (0∈D)$
Definition 3. Exponential Stability
The equilibrium point x = 0 of x ̇ = f(x) is said to be exponentially stable if
Some linearization and bifurcation, check slides for more detail.
Lec 6&7: Numerical methods for ordinary differential equations (ODEs)
Intro
Differential equations are an essential tool in a wide range of applications. Many phenomena can be modelled by a relationship between a function and its derivatives.
Differential equations can be divided into several types namely: • Ordinary Differential Equations
• Partial Differential Equations
• Linear Differential Equations
• Non-linear Differential equations
• Homogeneous Differential Equations
• Non-homogeneous Differential Equations
We will consider ordinary linear homogeneous and non-homogeneous differential equations.
Why we use numerical solutions of differential equations?
- Numerical solution of differential equations used, if impossible to find an analytic solution of the math system.
- Also, computing machines usually work with numerical methods, so programming numerical methods are simpler than programming analytical methods.
The use of high iteration frequencies produces a more realistic simulation than the lower frequency models. But high iteration frequencies produces a harder for computing machines
Euler’s method
The simplest of numerical methods is Euler’s method which is based directly on the geometric interpretation in observation.
Error analysis
Consider polynomial of second degree of the Taylor series:
Where $\frac{1}{2}h^2Y’’(\xi_n)$ - the truncation error
$Y(t_n)-y_n+h[f(t_n,Y(t_n))-f(t_n,y_n)]$ - the propagated error
Using the mean value theorem obtain
For the global error:
General error
Euler method modifications
If $Y’(t)=f(t,Y(t))$, then
Trapezoidal Riemann sum
and cuz $y_{n+1}$ is unknown
Midpont Riemann sum
Remember to replace $y_{n+0.5}$ with $\hat{y}=y_n+\frac{h}{2}f(t_n,y_n)$
Taylor methods
Use the quadratic Taylor approximation
The truncation error: $T_{n+1}(Y)=\frac{1}{6}h^3Y’’’(\xi_n),\ \xi_n\in[t_n;t_{n+1}]$
See general in page 22.
Error analysis
It’s an asymptotic error formula.
To avoid the need for the higher-order derivatives (in the Taylor method), the Runge - Kutta methods evaluate f(t,y) at more points, while attempting to retain the accuracy of the Taylor approximation.
Let’s take a look at Runge - Kutta method of order 2:
See 24 for more detail.
Runge - Kutta methods
The explicit methods
where
Note the construction of matrix of coefficients on page 29.
Numerical methods in Matlab
In a Matlab, the choice of solver depends on many factors:
- System dynamics (stiff, nonstiff, linear, nonlinear)
- Solution stability
- Computation speed
- Solver robustness
Model states:
- Continuous solvers
Use numerical integration to compute continuous states of a model at the current time step based on the states at previous time steps and the state derivatives. - Discrete solvers
Primarily used for solving purely discrete models.
Computation step size:
• Fixed-step solvers
Solve the model using the same step size from the beginning to the end of the simulation
• Variable-step solvers vary the step size during the simulation
Explicit form of ODE
Implicit form of ODE (usually used in stiff solvers)
Check the provided diagram for reference. at Page 33.
Just like manual.
Stiff equation
A stiff equation is a differential equation for which certain numerical methods for solving the equation are numerically unstable.
The main idea is that the equation includes some terms that can lead to rapid variation in the solution
Conclusion
About methods
1.1 Euler’s method plotting tangent lines with fixed step h, $Y_{n+1} = Y_n + hf (t_n , Y_n )$. The local error may become smaller, opposite global error only increase
1.2 Taylor methods use high order derivatives
1.3 Runge–Kutta methods. The idea of Runge–Kutta methods is to use
combinations of compositions of the right-side function of the equation to approximate the derivative terms to a required order
The use of high iteration frequencies produces a more realistic simulation than the lower frequency models. But high frequencies of iterations requires more computing power.