# System Dynamics

So far, we have discussed what dynamical systems are, and how we can approach solving these systems with a computer. These techniques can be applied through writing our own models using libraries that have been written for us, or with tools such as Matlab.

In addition to these code-based approaches, there are graphical tools for modelling system dynamics, including commercial: Stella or Vensim; and free: Netlogo. System dynamics is the most accessible tool of the simulations modelling umbrella, and has many uses outside academia, including management/business/management studies to analyse industrial processes.

System dynamics can also be used for natural resource modelling.

## History

In the 1950s and 60s, Jay Forrester looked at industrial processes such as the business cycles at General Electric. From this, the SIMPLE and DYNAMO packages were developed as the first simulation packages.

In the 1970s, Forrester was invited to help with a systems dynamics approach to develop models of global resource constraints, which led to the WORLD1,2 models.

The state-of-the-art today makes use of the Stella and Vensim packages, which are both proprietary. This course teaches the use of Netlogo for modelling, as it is FOSS.

## Motivations for Modelling Software

Historically, it has been quite difficult for the layperson to model systems, especially if they are not familiar with the differential equations. Furthermore, the dynamics as represented by these equations is quite hard to grasp visually, so a graphical language given by the arrows, valves, and taps is quite useful to allow us to develop conceptual models for the systems.

Modelling software is quite widely used in some areas, so it is important to be able to understand the software in addition to developing our own models. It can also be used when we want to have a bit of a play with a system, without going so far as to write our own code.

## Example: Introducing New Products to Market

We may wish to model what happens when we introduce a new product to the market. From an abstract point of view, we can think of what will drive the adoption rate up. Through word of mouth, the product spreads and gets adopters. These adopters then further spread the product via word of mouth.

Unfortunately, unless their idea is really new and patented, it is only a matter of time until competition make it to the market. As the market becomes saturated, the adoption rate declines, and thus there are less potential adopters. We can initially model this with a 'casual loop' diagram:

We can then model this a bit more rigorously, with a 'stock and flow' diagram, where the stocks are the total number of things at a time, and the flow of those is then modelled sort of as pipes, putting things in to, or taking things out of, stocks. A corresponding system dynamics model for the stock and flow diagram is as follows:

In addition to the stocks and flows, we can have variables, which can be equations, and links, which allow us to make values of variables available to other elements of the diagram.

## Using NetLogo

The package is easily downloaded from the website, albeit quite slowly. When launching the application, you are greeted with a window with what is the ABM window for NetLogo. Here, we are interested in the systems dynamics modelling aspect, and this can be launched through the `Tools > Systems Dynamics Modeller`

button.

The systems dynamics modeller window then allows us to draw the diagram and will very helpfully warn us if we try and create something that uses a label that doesn't exist.

The system dynamics modeller tool generates code which is then called from the main NetLogo window, so this is where we define the graphs and sliders in the main window. The big black box is what we use when writing simulations to show them visually.

## The Dynamics of Love Affairs (Linear, Oscillations)

Let's try and model Romeo and Juliet's love for each other. We'll first define a function \(R(t)\), which is Romeo's love or hate for Juliet, with \(R(t) < 0\) for hate and \(R(t) > 0\) for love.

Similarly, we define \(J(t)\) for Juliet's love for Romeo. Enter the modelling quandry:

- Romeo is in love with Juliet
- The more he loves her, the more she wants to run away
- When Romeo backs off, Juliet starts to find him attractive again
- Romeo mirrors Juliet's love, and loves her when she loves him, otherwise growing cold.

Let's model this with a few differential equations. The temporal dynamics of Romeo's love for Juliet can be modelled as:

Where \(a\) is some cooling parameter, and \(J\) is Juliet's love for Romeo at that specific time.

We can also define Juliet's love as:

With \(b\) some scaling parameter, and \(R\) Romeo's love for Juliet. In the lecture, \(a,b\) are defined as the response coefficients of the model. Putting these into the Netlogo system, we see that we get oscillations for \(R_0 = 1,J_0=-1,a=1,b=2\).

### Discovered Dynamics

From this system, where we can tinker with the initial values for \(R_0,J_0,a,b\), we get oscillations. By exploring the model, we can see that the structure for the oscillations is dependant on the parameters \(a,b,\) for frequency, and initial conditions for the amplitudes.

2D systems can also do other things besides simple linear oscillations, and this is where the shape only depends on the structure of the equations, which gives limit cycles.

## Wolves and Sheep (Nonlinear, Limit Cycle)

We can also model a system comprising wolves \(w\) and sheep \(s\). The sheep give birth with some probability \(r\), and a wolf dies with probability \(d\). Wolves also reproduce by eating sheep because why not, and eventually, we can derive the following differential equations:

These equations are nonlinear as the dependant variables are not linear. This makes it much harder to analytically compute the solutions to the variable. We can then model this in NetLogo, taking stocks for sheep and wolves, with inflows for sheep being the birth rate, which is dependant on the current number of sheep:

Then, we can model their death rate with the parameter \(r\):

Model the wolf births based on some predation factor \(r\) in conjunction with the parameter \(e\):

And they die with some probability \(d\):

For \(r=0.04,p=0.0003,e=0.8,d=0.15,s_0=100,w_0=30\), we yield oscillations, with the sheep population rising sharply, then curtailing as they are eaten by the wolves. This creates an oscillation. The frequency and the shape of this oscillation is independent of the chosen initial conditions, and is thus called a limit cycle.

## Lorenz System (3D)

This last one is to show that we can model higher-dimensional systems, and in this instance, we pick the Lorenz system, which are a set of equations to describe the dynamics of atmospheric convection. This model has the following equations: