The Output element stores and displays a single scalar data value after (or during) a model run. Examples include key quantitative indicators (mean time in system, profit, cost, customer satisfaction level, etc.) that provide an at-a-glance view of simulation results. Output elements are primarily used to display values in the dedicated Outputs section of the experiment screen.
You define an output by specifying its Value as a Java expression. By default, this expression is evaluated at the end of the simulation experiment. You can also evaluate it at a predefined time or manually by calling the update_outputName() function from anywhere in the model. For more information on accessing model elements programmatically, refer to the Accessing model elements from code section.
Similar to a Parameter, an Output can be any Java primitive type (int, double, boolean, or String). Unlike a parameter, an output cannot be an Object class. You can also set the output to a measurable type (time, rate, length, speed, acceleration, area, amount, or flow rate) and select the corresponding measurement units. For example, if Length is selected as the output type, length units (inch, mile, meter, etc.) 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 queue length during the model run. To implement this, add an
Output element and set its value to queueName.size(), which returns the queue length. This value should be updated each time a pedestrian enters or exits the queue. To do this, call the update_output name() function in the On enter queue and On exit queue actions of the
PedService flowchart block. If you need to update the output value periodically, add a Timeout Triggered Event to your model, set its Mode to Cyclic, and call the update_outputName() function in the event's Action field.
To create an output
- Drag the
Output element from the
Analysis palette into the graphical editor.
- Go to the Properties view.
- Enter the output element’s name in the Name field. This name is used to identify and access the element.
- In the Type drop-down list, specify the output data type. You can select a Java primitive type (boolean, int, double, String), Date, or a measurable type (Flow Rate, Length, Speed, etc.). If you select a measurable type, choose the appropriate Unit from the drop-down list that appears below.
- Specify the output value in the Value edit box as a Java expression. The output value can be updated during model simulation using the update_outputName(new value) function.
- Select when the output value should be calculated using the Calculated options. The value can be calculated automatically (at a specified time or at the end of the simulation experiment) or manually by calling the update_output name() function.
- General
-
Name — The name of the output. Used to identify and access the output.
Show name — If selected, the element name is displayed in the presentation diagram.
Ignore — If selected, the output is excluded from the model.
Type — The output data type. You can select:
a Java primitive type (int, double, boolean, String),
Date,
or a measurable type (Acceleration, Amount, Angle, Area, Flow Rate, Length, Rate, Rotation Speed, Speed, Time).If a measurable type is selected, its value data type is implicitly set to double.
Unit — [Visible if Type is set to a measurable type] The measurement units for the output value. The available units depend on the selected Type. For example, if Acceleration is selected, the appropriate units — meters per second² and feet per second² — will be available.
Value — The output value. Specify a Java expression that will be evaluated to calculate the value. The expression is evaluated according to the Calculated option below. If no value is specified, Java default rules apply: double is set to 0, boolean is false, String is null.
Calculated — Specifies when the output value is calculated. In most cases, the output value should be calculated at the end of the simulation.
On simulation end — The value is calculated after the simulation ends.
At model time — The value is calculated after the specified number of time units has elapsed since simulation start. The time 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, the expression specified in the Value edit box is evaluated. If an argument is passed (update_outputName(new value)), it is used as the output value.Update time (absolute) — [Visible if Calculated is set to At model time] The time since simulation start after which the output value will be calculated.
Update date — [Visible if Calculated is set to At calendar date] The model date at which the output value is calculated.
- Expert
-
Visible — If selected, the output is visible in the presentation at runtime.
-
How can we improve this article?
-