# Continuous simulation

Continuous Simulation refers to simulation approaches where a system is modeled with the help of variables that change continuously according to a set of differential equations.

## History

It is notable as one of the first uses ever put to computers, dating back to the Eniac in 1946. Continuous simulation allows prediction of

Established in 1952, the Society for Modeling and Simulation International (SCS) is a nonprofit, volunteer-driven corporation dedicated to advancing the use of modeling & simulation to solve real-world problems. Their first publication strongly suggested that the Navy was wasting a lot of money through the inconclusive flight-testing of missiles, but that the Simulation Council's analog computer could provide better information through the simulation of flights. Since that time continuous simulation has been proven invaluable in military and private endeavors with complex systems. No Apollo moon shot would have been possible without it.

## Clarification of concepts

The distinction between continuous and discrete applies both to real-world dynamic systems and to their simulation.

A (real-world) dynamic system may be continuous or discrete. Continuous dynamic systems (like physical systems with material objects moving in space) are characterized by state variables the values of which change continuously, while the state variable values of discrete dynamic systems (like predator-prey ecosystems) "jump", that is, they are changed at discrete time steps only.

In continuous simulation, continuously changing state variables of a system are modeled by differential equations. However, in digital computing, real numbers cannot be faithfully represented and differential equations can only be solved numerically with approximate algorithms (like the method of Euler or Runge–Kutta) using some form of discretization. Consequently, digital computers cannot run truly continuous simulations. Only analog computers can run truly continuous simulations. In many cases though, digital computing approaches based on incremental time progression (with either fixed or dynamically adjusted increments) for discretizing time into small time steps provide satisfactory approximations.

Discrete event simulation, on the other hand, changes state variables only in response to events, typically using next-event time progression.

Continuous dynamic systems can only be captured by a continuous simulation model, while discrete dynamic systems can be captured either in a more abstract manner by a continuous simulation model (like the Lotka-Volterra equations) or in a more realistic manner by a discrete event simulation model, since birth, death and predator-prey encounters are discrete events. When using a continuous simulation model of the discrete dynamic system of a population of animals, one may get results like 23.7 animals, which first have to be rounded for making sense.

In the example shown to the right, the sales of a certain product over time is shown. Using a discrete event simulation makes it necessary to have an occurring event to change the number of sales. In contrast to this the continuous simulation has a smooth and steady development in its number of sales.  It is worth noting that "the number of sales" is fundamentally countable and therefore discrete. A continuous simulation of sales implies the possibility of fractional sales e.g. 1/3 of a sale. For that reason, a continuous simulation of sales does not faithfully model reality but may nevertheless capture the system's dynamics approximately.

## Conceptual simulation model

Continuous simulations are based on a set of differential equations. These equations define the peculiarity of the state variables, the environment factors so to speak, of a system. These parameters of a system change in a continuous way and thus change the state of the entire system.

The set of differential equations can be formulated in a conceptual model representing the system on an abstract level. In order to develop the conceptual model 2 approaches are feasible:

• The deductive approach: The behaviour of the system arises from physical laws that can be applied
• The inductive approach: The behaviour of the system arises from observed behaviour of an example

A widely known example for a continuous simulation conceptual model is the "predator/prey model".

### The predator/prey model

This model is typical for revealing the dynamics of populations. As long as the population of the prey is on the rise, the predators population also rises, since they have enough to eat. But very soon the population of the predators becomes too large so that the hunting exceeds the procreation of the prey. This leads to a decrease in the prey's population and as a consequence of this also to a decrease of predators population as they do not have enough food to feed the entire population.

Simulation of any population involves counting members of the population and is therefore fundamentally a discrete simulation. However, modeling discrete phenomena with continuous equations often produces useful insights. A continuous simulation of population dynamics represents an approximation of the population effectively fitting a curve to a finite set of measurements/points.

## Mathematical theory

In continuous simulation, the continuous time response of a physical system is modeled using ODEs, embedded in a conceptual model. The time response of a physical system depends on its initial state. The problem of solving the ODEs for a given initial state is called the initial value problem.

In very few cases these ODEs can be solved in a simple analytic way. More common are ODEs which do not have an analytic solution. In these cases one has to use numerical approximation procedures.

Two well known families of methods for solving initial value problems are:

When using numerical solvers the following properties of the solver must be considered:

• the stability of the method
• the method property of stiffness
• the discontinuity of the method
• Concluding remarks contained in the method and available to the user

These points are crucial to the success of the usage of one method.

### Mathematical examples

Newton's 2nd law, F = ma, is a good example of a single ODE continuous system. Numerical integration methods such as Runge Kutta, or Bulirsch-Stoer could be used to solve this particular system of ODEs.

By coupling the ODE solver with other numerical operators and methods a continuous simulator can be used to model many different physical phenomena such as

• flight dynamics
• robotics
• automotive suspensions
• hydraulics
• electric power
• electric motors
• human respiration
• polar ice cap melting
• steam power plants
• coffee machine
• etc.

There is virtually no limit to the kinds of physical phenomena that can be modeled by a system of ODE's. Some systems though can not have all derivative terms specified explicitly from known inputs and other ODE outputs. Those derivative terms are defined implicitly by other system constraints such as Kirchhoff's law that the flow of charge into a junction must equal the flow out. To solve these implicit ODE systems a converging iterative scheme such as Newton–Raphson must be employed.

## Simulation software

To speed creation of continuous simulations you can use graphical programming software packages like VisSim or Simcad Pro. The packages provide options for integration method, step size, optimization method, unknowns and cost function, and allow for conditional execution of subsystems to speed execution and prevent numerical errors for certain domains. Such graphical simulation software can be run in real-time and used as a training tool for managers and operators.

## Modern applications

Continuous simulation is found

• inside Wii stations
• commercial flight simulators
• jet plane auto pilots