You are here

Working with external data : Scenario file : Case 5

Case 5: providing a set of values for an array variable: values stored in a separate file

This case applies when you have an variable with a largish number of elements. A typical example might be a variable outside a large multiple-instance submodel, containing a set of values that are to be used for each instance of the submodel..

On the model diagram

  1. Open up the equation dialogue for the variable, by double-clicking on it.
  2. Click the radio button labelled Fixed Parameter.
  3. Enter the expression makearray(1.0,n), replacing n by the number of elements in the array, into the "Equation" edit field.
  4. Close the equation dialogue.

Note that the variable now appears with a tail, showing the change in its status. It also has a 'stack' outline to indicate that it is an array. Note also that it is black, even though you have not supplied a value for it.

Check or prepare the data file

The data file should be in standard csv (comma-separated value) format. It should have one header line, consisting of one or more labels, separated by commas, followed by n lines. Each line should have the same number of values as there are labels in the header line, and again the values should be separated by commas. The number (n) of data lines should be at least as great as the number of instances for the submodel. One column should contain the values required for the variable in the model.

When you come to run the model

Simile will produce a File Parameter dialogue window, and this will contain an entry for this variable.

  1. Click on the Read table button for this variable
  2. Select the "data in columns" tab of the table data dialogue.
  3. Browse through your file system to find the .csv file containing the data values.

    You will now see a window listing the columns in the table, by the label associated with each column.

  4. Double-click on the label corresponding to the column of values you wish to assign to the variable.
  5. Click on the OK button.
  6. Click Save if you wish to save this setting (along with any others), and specify a file to save it in.
  7. Click OK when you wish to proceed with the simulation.

In: Contents >> Working with external data >> Using scenario files

 

Comments

In the section "On the model diagram" for the second bullet point.

There doesn't seem to be a radio button labeled "File parameter". Should this be fixed parameter?  I've found this same issue in the help files with Simile.

Thanks for pointing that out, yes, it should be Fixed Parameter.

I've updated the page on the web and this change will show in the help for the the next Simile release built from this web-based documantation.

Thanks,

Jonathan