A value of a variable parameter is not stored with the model, but is supplied by the user when the model runs. The value can change during the simulation. There are several ways to set the value of a variable parameter. One is to use slider controls. These can be displayed in the run-time environment and provide a mechanism for the user to observe and adjust the value of the parameter. The other is to use scenario files. These are loaded as the model is built or reset, and can provide a time-series of values for the parameter.
Maximum and minimum values must be set to define the range of acceptable values for the parameter. This allows the slider control to be shown with the correct range. It is also possible to define whether the slider moves continuously or in integer increments. Use the "Units" field to define the units as integer (int) or real to effect this distinction. It is also possible to present a check-box to the user, to return the Boolean values true or false. This is accomplished by setting the "Units" field to boolean. Finally, a variable parameter can be an enumerated type; set the "Units" field to the name of the required type. In this case the slider helper will present a pull-down menu for the parameter, listing the type's members.
Use the equation dialogue box to designate a variable as an variable parameter. It is not possible to set the value of a compartment in the same way, as variable parameters get new values from outside during the execution of the model, while compartments' values are determined from their previous values by the rates of flows in and out. A variable parameter is shown on the model diagram with a slider bar behind its usual appearance.
In: Contents >> Working with equations >> Parameters