# Continuous Simulation

In *continuous* simulations, certain real-valued state variables (or states of simulation objects represented by real-valued attributes) change continuously,
as 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 time progression with fixed, or dynamically adjusted, increments for discretizing time into small time steps provide satisfactory approximations. The critical issue is controlling computing errors due to the limitations mentioned above.

*Continuous dynamic systems* (like physical systems with material objects moving in space) can only
be captured by a continuous simulation model, while *discrete dynamic systems* (like predator-prey
ecosystems) 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.

Notice that when a simulation model uses a continuous time model (and possibly a continuous space model)
or continuous state variables (in the form of attributes with a floating-point number range), this does not
imply that the model is a continuous simulation model. The term "continuous" in *continuous simulation*
does not refer to the underlying time and space models, nor does it refer to the range of state variables.
Rather, it exclusively refers to the nature of state changes, and we could therefore
also speak of *continuous state change simulation*.

## General Approaches to Continuous Simulation

Two prominent general approaches to continuous simulation are: *System Dynamics* and *Equation-Based Object-Oriented Modelling* with *Modelica*.

### System Dynamics

In System Dynamics, a dynamic system is modeled with the help of differential equations described in the form of
*stock-flow models*.

A web-based simulation platform supporting System Dynamics is Insight Maker. Any System Dynamics modeling framework could also be used for modeling continuous dynamic systems such as physical systems. However, typical application domains of System Dynamics are biology and social sciences, where systems are essentially discrete.

### Equation-Based Object-Oriented Modelling with Modelica

Modelica is a *declarative, equation-based* modeling approach defining a general-purpose language for continuous simulation. The Modelica paradigm is supported by many commercial and also by open source tools, mainly used for modeling continuous dynamic systems in science and engineering.

## Examples of System Dynamics Models

Notice that for all typical System Dynamics examples we could also have a Discrete Event Simulation model (often called "agent-based" or "individual-based" model since not based on modeling aggregates, but rather on modeling individuals).

- Predator-Prey Model
- Based on the Lotka-Volterra equations.
- Susceptible-Infected-Recovered (SIR) Disease Model
- An epidemiological model that computes the theoretical number of individuals infected with a contagious disease in a closed population over time. See also a discrete SIR model.
- World3
- A
*System Dynamics*model of the interactions between population, industrial growth, food production and limits in the ecosystems of the Earth. Reconstructed with Insight Maker. Originally due to the*Club of Rome*, see The Limits to Growth.

## Examples of Physics Simulation Models

- Solar System
- A simulation that is programmed with CSS 3D animations.
- Galaxy
- A spiral galaxy with 5000 stars (by Jonas Wagner, 2010-08-18).
- Mass-Spring Physics
- A 3D Double Pendulum
- In this Modelica example, the pendulum consists of two cylinders.