Dialogs can be used to quickly allow changes to many of the simulation’s settings at once without having to separately navigate to the Tab/Properties Dialog of each feature.

They can appear as normal dialogs or as “Wizards” in a series.

Custom dialogs can display Simul8 -Information Store data and allow Information Store data and other Parameters to be changed by the user. This makes it very easy for someone to use the simulation without previous knowledge of how to build simulations (and without the user having to use external packages like Visual Basic or EXCEL).

Custom dialogs can appear when Components are clicked (replacing their Properties dialogs), as new menu items on the Simul8 menu bar, when simulations or templates for simulations are opened, or at any time driven by Visual Logic.

Building Custom Dialogs

  1. Select Dialogs from the Insert tab
  2. Click NEW to create a new Dialog. This opens up the Dialog Editor

Main Tab

The Main tab is used for setting the title and for controlling the look of the Custom Dialog. You can “Preview” it, decide whether you want the Dialog to appear as a Wizard (by checking the “Show as Wizard” checkbox), and how it appears on Custom Menus.

If Show as Wizard is checked you can control the Finish and Cancel buttons of the Wizard, and set a Picture to display when opening the dialog. In addition, if you type in the name of a file on the Help File Name field (e.g. Report.docx), the file will open when you open the Dialog. To use this functionality, make sure to save your simulation and the external file in the same directory.

Simul8 Dialogs Main

Controls Tab

The Controls tab lets you select the fields to be included in a Dialog. For some of the fields you can set a Global Data Item that gets a value depending on the user’s input to that field.

Simul8 Dialogs Controls

You can click on any of these fields to add them to a Dialog:

  • Titles: For adding titles and descriptions
  • Data Field: For setting the value of a Global Data Item
  • Checkbox: When checked, the Global Data item used for this field gets a value of 1
  • Radio Group: The Global Data Item gets a value depending on which Radio is selected (e.g., if the 1st Radio is selected, it gets a value of 1, if the 2nd Radio is selected a value of 2, and so on). To separate options, use a vertical bar ( | ) between them, for example “Radio 1|Radio 2|Radio 3”.
  • Button: This creates a new button that calls the on Button Click Visual Logic, i.e. triggers logic when the button within the dialog is clicked. Fill in “Text to display” to define how this will appear in the dialog. The name of this button can also be found as a variable in the Information Store.
  • Object Button: This creates a Button that displays a Simulation Object dialog. To do this, type the name of the Object (e.g. Activity 1) on the Global Data Item field
  • Drop-down: Use a Text Global Data Item that will take the value of the drop-down option you select. For example, if the second dropdown option is “Scenario 1”, your text variable will be set to “Scenario 1”. To separate options, use again a vertical bar ( | ) between them, for example “Text Item 1|Text Item 2|Text Item 3”.
  • Spreadsheet: This option displays a spreadsheet of your choice. The columns and the rows fields let you set the number of columns and rows shown by the Dialog. This option cannot be combined with other fields in the same Dialog.

To make sure users enter valid values based on the requirements of your model use the following fields:

  • Check “Must be number” if the input should be in numeric format.
  • If “Must be number” is checked, set the Minimum and Maximum values if there are constraints on the numeric input.

Using variables in Text

If you want to add descriptive text to your Dialog but want to reference a variable value in the text, then if you place the variable name in curly brackets. For example:

  Shift's 1 End time is {ss_Timings[2,2]}

Simul8 will put in the variable value when the Dialog is displayed. For example, the following set up uses a Radio Group for the user to select between 2 Options. Next to each option a spreadsheet value is displayed so the user has visibility of the values associated with this option. Therefore, the following dialog is set as shown below:

Simul8 Dialogs Using Variables in text set up

This will display the values of the Spreadsheet ss_Timings as follows:

Simul8 Dialogs Using variables in text display

Dialogs Example

This example presents how some of a simulation’s parameters can be set using Dialogs.

The following Dialog, called “Settings” is set as follows:

Simul8 Dialogs Example Set up

We note that gbl_duration, gbl_capacity and gbl_Scenario are numerical variables, while ss_Data is a spreadsheet that holds data on how many Resources we may have.

When opening the dialog, it will look like this:
Simul8 Dialogs Example display

The Titles here helps you indicate what each Data field and the Radio Group refer to.

The variable gbl_duration is directly linked to the Timing of Activity 1.

Simul8 Dialogs Example field 1

The variable gbl_capacity sets the Replication of Activity 1 and the Radio Group is used for defining which out of the 3 Resource Availability Scenarios will be selected. Both variables gbl_Capacity, and gbl_Scenario are used in the On OK Dialog logic of the dialog. These can be accessed from the Visual Logic tab of our window.

Simul8 Dialogs Visual Logic

The Visual Logic code is as follows:

Simul8 Dialogs Example Visual Logic

The Replication of Activity 1 is set to the value entered on the second field, i.e. to the value of gbl_Capacity, using the SET command. Instead, gbl_Scenario is set based on the Radio selected, i.e. the variable gets a value of 1 if Scenario 1 is selected, a value of 2 if Scenario 2 is selected, and a value of 3 if the third Scenario is selected. Resource availability is set accordingly.

Using Dialogs with Buttons

You can display the Dialog and set these parameters with the click of a Button on the Simulation Window, using Customizable Buttons. You can create a Button from the Insert Tab and set its Action to open a Custom Dialog, and select the “Settings” dialog, as shown below.

Simul8 Dialogs with Buttons

See Also