The Output element is used to store and display a single scalar data value after (or during) the model run. Examples of such values include important quantitative indicators (mean time in system, profit, cost, customer satisfaction level, and so on), that provide an “at-a-glance” view of the simulation results.
You define an output by specifying its Value as a Java expression. Typically, this expression is evaluated at the end of the simulation experiment. If needed, you can evaluate it at the predefined moment in time or manually by calling the update_outputName() function from anywhere in the model.
Similar to a Parameter, an output can be of any Java primitive type (int, double, boolean, or String). Unlike a parameter, an output cannot contain values of the Object class. You can also set the output to one of the measurable types (that is, time, rate, length, speed, acceleration, area, amount or flow rate) and select the corresponding measurement units for it. For example, if Length is selected as the output type, length units (inch, mile, meter, and so on) will be available for selection.
For example, you have a pedestrian model that includes a Service with Lines element, and you want to display the current length of the queue line during the model run. To implement this, you can add an Output element and set its value to queueName.size(), which returns the length of the queue. This value should be updated each time a pedestrian enters or leaves the queue. To do this, you should call the update_output name() function in the On enter queue and the On exit queue actions of the PedService flowchart block.
To create an output
- Drag the Output element from the Analysis palette into the graphical editor.
- Go to the Properties view.
- Type the name of the Output element in the Name edit box. The name is used to identify and access the Output element.
-
If your output defines one of the following: time, speed, length, acceleration, rate, or area, you should specify it explicitly by selecting the appropriate Type for this parameter. Then select the Unit from the drop-down list below.
Otherwise, specify the Java type for the output. You select one of the most commonly used Java types (int, double, boolean, String) by selecting the appropriate option from the Type drop-down list. - Specify the value of the output in the Value edit box in the form of a Java expression. The value of the output can be changed later during the model simulation by using the update_outputName(new value) function.
- Finally, select when the output value should be calculated by selecting one of the available Calculated options. The value can be calculated either automatically (at the specified moment in time or at the end of the simulation experiment) or manually when the update_output name() function is called.
- General
-
Name — The name of the output. The name is used to identify and access the output.
Type — The type of the output. Select a measurable type (Time, Speed, Length, and so on) or one of the Java primitive types (int, double, boolean, String) using the appropriate option from the list. Note that if a measurable type is selected for the output, its value data type is implicitly set to double.
Unit — [Visible if Type is set to one of the measurable types (Time, Speed, Length, and so on)] The measurement units of the output’s value. The set of available units depends on the currently selected Type. For example, if Length is selected as the Output type, length units (inch, mile, meter, and so on) will be available for selection.
Value — The value of the output. Here you specify a Java expression that will be used to calculate the value. The provided expression is evaluated according to the Calculated option. If no value is specified, Java rules apply: that is, a double parameter is set to 0, a boolean parameter is false, a String parameter is null.
Calculated — The time at which the value of the output is calculated. In most cases, the value of the output should be calculated at the end of the simulation.
On simulation end — The value will be calculated after the simulation ends.
At model time — The value is calculated after the specified number of time units has elapsed since the start of the simulation. The number of time units is set using the Update time (absolute) controls below.
At calendar date — the value is calculated on the specified model date, which is set using the Update date controls below.
User control (call update()) — the value is calculated when the update_outputName() function is called. If no arguments are passed to the function, the expression specified in the Value field will be evaluated. If an argument is passed (i.e., update_outputName(new value)), it is evaluated and used as the value of the output.Update time (absolute) — [Visible if Calculated is set to At model time] The time since the simulation started after which the value of the output will be calculated.
Update date — [Visible if Calculated is set to At calendar date] The model date, at which the value of the output is calculated.
Show name — If selected, the name of the output is displayed on the presentation diagram.
Visible — If selected, the output is visible in the presentation at runtime.
Ignore — If selected, the output is excluded from the model.
-
How can we improve this article?
-