TimeMeasureEnd as well as TimeMeasureStart compose a pair of blocks measuring the time the agents spend between them (given points in a flowchart), such as "time in system", "length of stay", etc.
For each incoming agent this block measures the time it spent since it has been through one of the corresponding TimeMeasureStart blocks. There can be more than one TimeMeasureEnd block referencing a number of TimeMeasureStart blocks.
TimeMeasureStart keeps record of all agents that have flown through it and have not yet gone through a paired TimeMeasureEnd. Therefore you should make sure there is no way for such agents to exit the system without going through TimeMeasureEnd, otherwise memory leak will occur.
If you see "The TimeMeasureStart objects must be specified" runtime error, it means that the TimeMeasureEnd block, mentioned in the first line of the error message, has empty TimeMeasureStart blocks property. Specify there the TimeMeasureStart block that starts measuring time in your flowchart.
The statistics collected is available in the form of a distribution (HistogramData element distribution) and in the form of a dataset (Dataset element dataset).
Agents do not spend any time at 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).- 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)
- On enter
- Code executed when the agent enters the block.
Local variable: T agent — the agent
- 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.
- Reset statistics
-
Function Description void resetStats() Resets the statistics collected for this block in dataset and distribution data items.
- in
- The input port.
- out
- The output port.
-
How can we improve this article?
-