Getting started with Simile: Bank account tutorial

Introduction

This introductory tutorial should be followed before exploring any of the others. It introduces click-by-click the actions needed to create a simple model, to simulate its behaviour, and to display results.

Stage 1: Drawing the model diagram

Step 1
Add a compartment to the model diagram.
  • Click on the  compartment symbol in the toolbar
  • Move the mouse to the middle of the desktop window, and click again

You should see a box labelled comp1.

Step 2
Rename the compartment account.
  • Click on the  select tool in the toolbar
  • Move to the compartment labelled comp1, and click on the compartment symbol
  • Delete the label comp1, and type in the label account

Step 3
Add an interest flow and a withdrawal flow.
  • Click on the  flow symbol in the toolbar
  • Move the mouse to the left of the compartment labelled account, hold the mouse button down, and drag the mouse into the centre of the compartment. Release the mouse button.
  • Move the mouse into the centre of the compartment, and drag to the blank area to its right. Release the mouse button.

Step 4
Rename the two flows.
  • Click on the  select tool
  • Click on the valve (bowtie) symbol on the first flow. Delete the label flow1, and type in interest.
  • Click on the second flow, and re-label it withdrawal

Step 5
Add a variable for the interest rate.
  • Click on the  variable symbol in the toolbar
  • Move the mouse to the blank area above the interest flow, and click once

Step 6
Rename the variable interest rate.
  • Click on the  select tool
  • Click on the variable labelled var1
  • Delete its label, and type in interest rate

Step 7
Draw the influences.
  • Click on the  influence arrow button in the toolbar
  • Move the mouse to the middle of the compartment labelled account, and drag an influence arrow to the flow labelled interest
  • Release the mouse button when the flow has turned green
  • Move the mouse to the middle of the variable labelled interest rate, and again drag an influence arrow to the flow labelled interest

Step 8
Re-arrange the model diagram.
  • Click on the  move button in the toolbar.
  • Move the mouse to the middle of the compartment labelled account
  • Drag the mouse, and watch the compartment and its associated arrows re-arrange themselves
  • Repeat for the cloud symbol at the end of each flow arrow, the variable, the valve symbols on the flows, the middle of an influence arrow, and the labels.

Stage 2: Adding initial values, parameter values and equations

Step 1
Click on the  select button in the toolbar.
Step 2
Assign an initial value for the compartment.
  • Click on the compartment labelled account
  • Enter the value 300 into the equation bar
  • Click on the  tick mark

Step 3
Add the equation for calculating interest.
  • Click on the flow labelled interest
  • Variables account and interest_rate are now listed as influences upon interest. These influences are visible by clicking on the  inputs button. Selecting an influence from the drop-down list, places the text in the equation bar.
  • Enter the expression account*interest_rate into the equation bar, either by selecting each variable in turn or by typing. Be sure to use an underscore rather than a space in interest_rate..
  • Click on the  tick mark
Step 4
Assign a value for the withdrawal flow.
  • Click on the withdrawal flow
  • Enter the value 10 in the equation bar
  • Click on the  tick mark
Step 5
Assign a value for interest rate.
  • Click on the variable interest rate
  • Enter the value 0.1 in the equation bar
  • Click on the  tick mark

Stage 3: Preparing to run the model

Step 1
“Build” the model.
  • Open the Model menu
  • Select the Build in Tcl item

Simile creates a new window: the Run-Time Environment window. This contains the controls for running the model; a list of the variables in the model; and an area where various displays for showing model results will appear.

Step 2
Change the from 0.1 to 1

This is because we want to use a time step of 1 year rather than the default value of 0.1 years.

Step 3
Change the value for from 100 to 10.

This is because we want to run the model for just 10 years at a time.

Stage 4: Choosing the output displays

Step 1
Select the graph-plot display.
  • Click on the  graph tool on the toolbar; or select “Plotter” from the list in the Add menu

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.

Step 2
Choose the variable you wish to have displayed.
  • Click on the  add button on the plotter toolbar
  • Click on the compartment labelled account in the list of model variables

Stage 5: Running the model

Step 1
Start the simulation.
  • Click on the  play button in the Run control dialogue window

Note the line that appears on the graph.

Step 2
Continue the simulation.
  • Click on the  play button again

The simulation carries on for another 10 years.

Stage 6: Repeating the model edit/run cycle

Step 1
Return to the desktop canvas.
  • Click on the “Go to Model Window” toolbar button
Step 2
Make sure you are in  select mode.

The simulation carries on for another 10 years.

Step 3
Change the interest rate from 10 to 15 per cent.
  • Click on the interest rate variable
  • Enter 0.15 in the equation bar
  • Click on the  tick mark
Step 4
Run the model again
  • Click on the  play button on the toolbar

The model will automatically rebuild, re-initialise and run again.

Stage 7: Saving and loading the model

Step 1
Save the model to file.
  • Select the  save item in the “File” menu or toolbar
  • Navigate through the file directory system in the normal way, to the directory where you wish to save the model
  • Enter a name for your model, and save it
Step 2
Clearing the model.
  • Select the  new item in the “File” menu or toolbar
Step 3
Loading a model from file.
  • Either: Select the  open item in the “File” menu or toolbar, search for your model, and click on the OK button
  • Or: Select the “Reopen -->” item in the “File” menu, and select from the list of recently-used models