This section takes you through the whole process of building and running a model as quickly as possible. The exercise is based on a simple model of a bank account, since we are all familiar with this context, and we can readily do the calculations ourselves. This should save you from thinking that there is something mysterious about how Simile calculates the behaviour of a model.
The model: a simple bank account model
Step 1: Starting Simile: what's on the screen
Step 2: Making the model diagram
Step 3: Adding initial values, parameter values and equations
Step 4: Initialising the model
Step 5: Choosing the output displays
We will make a model for a simple bank account, with interest paid annually at a rate of 10%, and $10 taken out every year. The account initially contains $300. This is what we expect to happen:
Opening balance |
$300.00 |
|||
Interest paid in |
$30.00 |
0.1 x 300 |
||
Withdrawal |
$10.00 |
|||
Closing balance |
$320.00 |
300 + 30 - 10 |
Opening balance |
$320.00 |
|||
Interest paid in |
$32.00 |
0.1 x 320 |
||
Withdrawal |
$10.00 |
|||
Closing balance |
$342.00 |
320 + 32 - 10 |
Opening balance |
$342.00 |
|||
Interest paid in |
$34.20 |
0.1 x 342 |
||
Withdrawal |
$10.00 |
|||
Closing balance |
$366.20 |
342 + 34.2 - 10 |
And so on. Note that the increments are getting bigger each year because each time the balance goes up, so the interest paid increases. The balance of the bank account is increasing at a faster and faster rate.
Having understood the calculations that we are going to perform, we now turn to the concepts needed to express these ideas in Simile.
We use a compartment to represent the amount of money held in the bank account, since this a quantity that changes incrementally over time. We use two flows, one to represent the gain of money from interest and the other to represent the loss of money by withdrawal. One flow (interest) will go into the compartment, while the other flow (withdrawal) will come out of the compartment. We will also use a variable to represent the interest rate (10%, or 0.1). This variable will be linked to the flow representing the payment of interest by an influence arrow, indicating that the amount of interest paid depends on the interest rate. Since the amount of interest paid also depends on the amount in the bank account, there we will also use an influence arrow from the compartment representing the bank account to this flow.
In this tutorial we want to introduce you mainly to the mechanics of working with Simile, and these are explained in detail in the following steps. The concepts involved in representing even a simple system like this one in a modelling language can be quite complex.
You start Simile by double-clicking on the desktop icon created during installation, or by clicking on the Simile icon in the Start Menu.
These are both shortcuts to the file <Simile Program Files>\System\bin\Simile.exe, where <Simile Program Files> is the directory you chose to install the program. By default, this is commonly "C:\Program Files\Simile50", though if you are using a network, it may be on a remote hard drive. If you would like to be able to start Simile from a different location, create a shortcut to this file.
Linux users can start Simile by typing the command 'simile' in a terminal. Also, a shortcut is added to the Science/Education submenu of the Applications menu, which can be dragged to the desktop or taskbar, depending on your desktop environment.
On a Mac, Simile will be added to the Applications folder, from which it can be dragged to the desktop or task bar.
Within a few seconds, the main window will be displayed.
When Simile starts, you see a single window. This contains:
We begin by drawing the model diagram for the bank account model. A note on colours used in the following description: when you add a component to the model diagram, it is initially drawn in blue. This means that the component is selected. You will see the ways in which this is useful later on. When the component is not selected, it will turn red. This is its usual colour, and means that the component needs some extra information (like a value or equation) before the model can be built.
You should see a box labelled comp1.
As an alternative to dragging out the flow, you can just click on its start and finish positions.
This completes the drawing of the model diagram. In the next step, you will provide the numeric values and equations you need for simulating the behaviour of the bank account. Note, however, that this sequence (complete the model diagram before providing any quantitative information) is followed here for convenience: in general, you are free to provide the quantitative information at any stage in the diagramming process.
Notice that every component of the model diagram is now black, rather than red as it was before. This indicates that every component has been mathematically specified, and so the model is ready for running: Simile has enough information to work out the flows, and thus to update the amount of money in your bank account forward through time.
This and subsequent steps assume that you are using the single-window Run-Time Environment. This is the default, so it is the one that you will be using if you have installed Simile and not changed your Preference settings. If the windows that appear when you come to run the model differ from the ones shown here, then please go to the "Edit" menu, select the "Preferences" item, and then select the "Use single-window Run-Time Environment" option.
Simile creates a new window: the execution window. This contains the controls for running the model; a list of the variables in the model; and an area where any of a variety of tools for showing model results can be displayed.
Simile supplies a default time step of 0.1 when you first run a model. In natural science, a time step shorter than the time unit results in greater mathematical accuracy, but here we are dealing with an unnatural example; a bank paying compound interest on the balance of the account at the start of each year.
The above screenshot was taken from Simile v4; in v5 and later, the run settings are displayed on a separate tab within the run control notebook. Click on this tab to get at them, and then on the Run Control tab again to get the main controls back.
This is because we want to use a time step of 1 year rather than the default value of 0.1 years.
This is because we want to run the model for just 10 years at a time.
Note the graph window that appears. This is initially scaled with default values on both axes, but will rescale itself as needed. You can re-size the panel containing the graph by dragging on the little boxes on the horizontal and vertical panel separators.
You can either click on the line representing the compartment in the "Explorer" tab at the bottom left of the execution window, or you can go back to the model diagram and click on the compartment there.
Note the line that appears on the graph.
The simulation carries on for another 10 years.
The model will automatically rebuild, re-initialise and run again.
Either:
or: