The Output element is used for storing a single scalar data value and displaying it after (or during) the model run. Examples of such values include important quantitative indicators (mean time in system, profit, expenses, customer satisfaction level, etc.), which provide an "at a glance" view of the simulation results.
The Output elements are primarily used for displaying values in the dedicated Outputs section of the model screen in AnyLogic Cloud. To add outputs, as well as other elements of the Analysis palette, to the cloud version of your model, use the Run Configuration editor.
You define an Output by providing its Value in the form of an arbitrary Java expression. Commonly, 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 any place of the model. For more information on programmatically accessing various parts of the model, which you can use in an expression, refer to the Where am I and how do I get to…? section.
Similarly 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 (i.e., 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's Type, length units (inch, mile, meter, etc.) will be available for selection.
For example, you have a pedestrian model involving a Service with Lines element and you would like to view 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 will return the length of the queue. This value should be updated each time a pedestrian enters or exits the queue. For this reason, you should call the update_outputName() function in the On enter queue and the On exit queue actions of the PedService flowchart block. If in some other case you need to update the Output's value periodically, you can add a Timeout Triggered Event to your model, set its Mode to Cyclic and provide the update_outputName() function call in the Event's Action field.
Note: If a measurable type is selected for the Output, its values data type is implicitly set to double.
create an Output
Name – The name of the Output. The name is used to identify and access the Output.
Ignore – If selected, the Output is excluded from the model.
Visible – If selected, the Output is visible on the presentation at runtime.
Show name – If selected, the name of the Output is displayed on the presentation diagram.
Type – The type of the Output. Choose a measurable type (Time, Speed, Length, etc.) or one of the Java primitive types (int, double, boolean, String) using the corresponding option from the list. Note that if a measurable type is selected for the Output, its values data type is implicitly set to double.
– [Visible if Type is
set to one of the measurable types (Time, Speed, Length, etc.)] The
measurement units of the Output's value. The set of available units
depends on the currently selected Type. For example,
is set as the Output type, length units (inch, mile, meter, etc.) will
be available for selection.
– The value of the Output. Here you provide a Java expression that
calculating the value. The provided expression will be evaluated
option. If a value is not specified, Java rules apply, for example a
parameter of type double
is set to 0, a
parameter of type boolean
is false, a parameter
of type String is null.
– The time at which the Output's value is calculated. In most cases,
the value of the Output is supposed to be calculated on simulation end.
On simulation end – the value is calculated after the simulation is finished.
At model time – the value is calculated after the certain number of time units pass since the simulation start. The number of time units is specified using the Update time (absolute) controls below.
At calendar date – the value is calculated at the specified model date, which is specified 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 will be evaluated and used as the Output's value.
(absolute) – [Visible if Calculated is
set to At model time] the
time period since the simulation start, after which
the output's value will be calculated.
Update date –
[Visible if Calculated is
set to At calendar date]
the model date, at which
the output's value will be calculated.