AnyLogic
Expand
Font size

TimeMeasureEnd

AnyLogic: The TimeMeasureEnd block

TimeMeasureEnd and TimeMeasureStart form a pair of blocks that measure the time that agents spend between them (given points in a flowchart), such as “time in system”, “length of stay”, and so on.

For each incoming agent, this block measures the time it has spent since passing through one of the corresponding TimeMeasureStart blocks. There can be more than one TimeMeasureEnd block that references a number of TimeMeasureStart blocks.

TimeMeasureStart keeps track of all agents that have passed through it and have not yet passed through a paired TimeMeasureEnd block. Therefore, you should make sure that there is no way for such agents to leave the system without going through TimeMeasureEnd, otherwise a memory leak will occur.
If you see the runtime error "The TimeMeasureStart objects must be specified", it means that the TimeMeasureEnd block, mentioned in the first line of the error message, has the TimeMeasureStart blocks property empty. Specify there the TimeMeasureStart block that starts the time measurement in your flowchart.

The collected statistics are available as histogram data and as a data set. They can be accessed as variables.

Agents do not spend any time in this block.

Demo model: Measuring Length of Stay Open the model page in AnyLogic Cloud. There you can run the model or download it (by clicking Model source files).

Parameters

TimeMeasureStart blocks
Specify one or several TimeMeasureStart blocks where time measuring starts (and ends here, in this TimeMeasureEnd block). Add blocks into the list either by clicking the button and choosing the names from the list, or clicking the button and selecting the required blocks in the graphical editor.
Syntax: TimeMeasureStart[] startObjects
Dataset capacity
Capacity of the block's dataset where the time measure history is kept — maximum number of data samples that can be stored in this dataset.
Syntax: int datasetCapacity
Default value: 100
Set new value dynamically: set_datasetCapacity(new value)

Actions

On enter
Code executed when the agent enters the block.
Local variable: T agent — the agent

Variables

DataSet dataset
Data set that stores for each incoming agent the time it spent since it has been through one of the corresponding TimeMeasureStart blocks.
HistogramData distribution
Histogram data element that stores distribution of time agents spent since they have been through one of the corresponding TimeMeasureStart.

Functions

Reset statistics
Function Description
void resetStats() Resets the statistics collected for this block in dataset and distribution data items.

Ports

in
The input port.
out
The output port.
How can we improve this article?