# System Dynamics Simulation

###### An introduction

In this section, we will create a simulation model based on the stock and flow diagram we developed in the previous section on stock and flow diagrams. For ease of reference, we have included the diagram here:

As noted in the previous section, this stock and flow diagram is just a visual notation for a mathematical model of the system that can be used to simulate the system’s behavior using computer software. In these mathematical models, stocks and flows are represented by integral equations, converters are represented by functions of their input and/or time. In most cases, these integral equations cannot be solved analytically but instead are approximated using numerical integration.

Many techniques exist for numerical integration, the most basic of these is

*Euler integration*, named after the Swiss mathematician Leonhard Euler (1707-1783): using this technique, we do not attempt to calculate the system’s state for every possible instance in time. Instead, we define a finite number of discrete time steps and make the basic assumption that the rates at which the system changes remain constant during these time steps. The smaller the time step becomes, the more precise our calculations will be. This approach is particularly reasonable in business because the accounting systems used in business are rarely updated more than once a day – it is also important to bear in mind here that our interest is not to precisely solve integral equations, but to make predictions about how your business will behave: mostly the simplifying assumptions you make about your business when creating your model have far more impact on the results than the size of the time step you choose.Based on these assumptions, we can now build a simulation based on the stock and flow diagram:

- System dynamics simulations run in simulated time. Simulation time starts at time t=0 and then runs for a predefined period of time. In business simulations, a typical time frame is 5 years of simulated time, but simulations may be shorter or longer. Thanks to modern computer power, simulating 5 years of time even in complex models only takes a few seconds of “real-time”.
- As explained above, the calculations needed to perform the simulation are performed in discrete time steps – typical time steps in business simulations are days or weeks. This time step is referred to as dt.
- The initial values for all stocks and constant converters need to be defined.
- The exact relationships between a converter and its inputs (i.e., those converters that are connected to it) have to be defined using mathematical equations.

For each of the model elements, the following paragraphs give an overview of the initial values and equations for our simple project management simulation:

**Open Tasks**

To make our model concrete, let us assume our project sets out to complete 100 tasks.

**Closed Tasks**

We assume that no tasks have been completed at the beginning of a simulation run.

**Effort**

This is the average planned effort of all tasks in the project. We make the following assumptions:

- Every task requires the same average effort to be completed. This assumption is fine for the purpose of this model. In a more realistic model, we could use different stocks for different kinds of tasks and assign individual efforts for each kind of task.
- To simplify calculations, we define this average effort to be 1 day/task.

**Completion Rate**

`Completion Rate (t) = Productivity(t)*Overtime(t)/Effort`

In an ideal situation, the actual time taken to complete a task is equal to the planned effort, and then the completion rate could be calculated as 1/Effort. But the discussion in the section on causal loop diagrams showed that the completion rate also depends on our productivity (how much of our time do we actually spend working on the task) and on overtime.

**Schedule Pressure (t)**

`Schedule Pressure (t) = Open_Tasks(t)*Effort/Remaining_Time`

The schedule pressure is just an indicator that compares the time that is needed to complete the remaining tasks to the time that is actually available. We, therefore, arrive at the formulation:

`Schedule_Pressure = Open_Tasks*Effort/Remaining_Time. Take`

a look at the above diagram – according to the diagram, the effort has no effect on schedule pressure! Clearly, at the time we had not thought of this connection – this is quite normal when creating system dynamics models: the initial causal loop diagrams and stock and flow diagrams are always less accurate than the final simulation models because our initial understanding of the problem situation is less mature.**Current Date(t)**

`Current Date(t)=t`

The current date is always just equal to the simulated time.

**Deadline**

To make calculations easy, we set our deadline to be equal to 100.

**Remaining Time (t)**

`Remaining Time (t)=100 - Current Date(t) = 100-t`

We assume the project deadline is at 100 days, hence the remaining time must be equal to 100 minus the current date.

**Productivity**

The productivity is calculated using a Look-up-Table depending on schedule pressure.

There seems to be no intuitive mathematical equation that defines the relationship between schedule pressure and productivity (or overtime, respectively). This happens quite often when creating simulation models, especially when it comes to modeling soft factors such as these ones. Experience shows that most people invest less time in projects when schedule pressure is low and work overtime when schedule pressure is high. The combined effect of schedule pressure on productivity and overtime can be sketched as in the following graph:

This graph corresponds to the following look-up-table:

For any given schedule pressure we can use this table to find the corresponding values of productivity and overtime. If the exact value of the schedule pressure is not found in the left column, we find its nearest neighbors in the table and then calculate the corresponding values of productivity and overtime using linear interpolation.

Now that we have defined the initial values and equations, we can then set about simulating our model as follows:

- First, we need to ensure that all elements in our model have a defined value at time t=0.
- We then calculate the value of all flows at time t=0.
- We can now calculate the value of our stock at time t=dt using the following formula:
`Stock(dt)=Stock(0)+ Sum of all Inflows(0)×dt − Sum of all Outflows(0)×dt`

- We now repeat this process for every time step using the general formula:
`Stock(t+td)=Stock(t)+ Sum of all Inflows(t)×dt − Sum of all Outflow(t)×dt`

To let you experiment with this model we have uploaded an interactive simulation model. We have also created a set of videos that explain how we built this model using ®iThink 10:

#### Email newsletter

Subscribe to our newsletter and stay up to date about the latest trends and news.