## Simulation of Dynamic Systems

Simulation of dynamic systems is the process of finding a numerical solution to a set of differential and algebraic equations (DAEs) with given initial conditions (*x _{0}*). A mathematical expression of an Initial Value Problem (IVP) is shown below.

0 = f(dx/dt,x,p)0 < g(dx/dt,x,p)Givenxand_{0}p

The DAE can be solved with a variety of analytic or numeric methods. Analytic approaches are possible for simple systems such as systems with one or two equations. Numeric methods are used with more complicated systems but these methods have approximation errors that may deviate from the exact solution. A first step in model development is to draw a schematic, list the assumptions, and write the differential and algebraic equations that describe the system.

- Mass Balance Solution
- Species Balance Solution
- Energy Balance Solution
- Funnel (Mass Balance) Solution

Two numerical methods reviewed are sequential and simultaneous simulation techniques.

### Sequential Simulation

Sequential simulation methods take successive time steps in the simulation horizon and often refine the size of each step to meet a specified error tolerance. Euler's method is the most basic method for sequential simulation while other methods generally offer improved accuracy and therefore allow larger step sizes.

### Simultaneous Simulation

Simultaneous simulation methods are used to converge all of the state variable predictions together instead of one step at a time. Orthogonal collocation on finite elements is a popular method to convert the DAE into a Nonlinear Programming (NLP) problem for solution by efficient solvers.

0 = f(x,p)0 < g(x,p)Givenxand_{0}p

Further details on orthogonal collocation are provided at the following references.

- Nonlinear Modeling, Estimation and Predictive Control in APMonitor, Hedengren, J. D. and Asgharzadeh Shishavan, R., Powell, K.M., and Edgar, T.F., Computers and Chemical Engineering, Volume 70, pg. 133–148, 2014. Available at: http://dx.doi.org/10.1016/j.compchemeng.2014.04.013

#### Exercise

This exercise involves the simulation of a Boeing 747 airplane at a cruising altitude of 40,000 ft. In this application^{1}, a model of the process is desired to relate the elevator (*e*) and thrust (*t*) to the airspeed and climb rate. The model equations are shown below in state space form that relates elevator angle in centi-radians and thrust to four states including airspeed in the horizontal direction (*u* - *u* _{w}), airspeed in the vertical direction (*w* - *w* _{w}), rotation of the aircraft (*q*), and angle of the aircraft (*theta*).

The wind speeds are given in the horizontal (*u* _{w}) and vertical (*w* _{w}) directions with a nominal velocity of the aircraft of *u*_{0}=774 ft/sec (0.8 Mach speed). The output *y*_{1} is the air speed and *y*_{2} is the climb rate.

Simulate step responses of the aircraft with respect to the elevator angle and thrust. Design a model predictive controller to respond to set point changes in the air speed and climb rate of the aircraft. Explain the coordinated movement of the manipulated variables to achieve the desired set points of the controlled variables.

#### Solution

#### References

- Camacho, E.F. and Bordons, C., Model Predictive Control, 2nd Edition, Advanced Textbooks in Control and Signal Processing, Springer, 2004.