Anylogic Histogram - Hourly Update Triggered by Event

Viewed 19

I am trying to get a histogram object that displays the distribution output of a timeMeasureEnd block, and have managed to get the histogram to display this output as a cumulative distribution and mean.

However, one objective of my model is to the measure the hourly average and distribution of the timeMeasureEnd block, and I am unable to make the histogram object reset on an hourly basis using an event block.

At present I have the following:

An event block called HourlyReset in cyclic mode using a 1h timeout based on model time, this element is functioning correctly.

I also have a histogram provisionally called chart, that is currently displaying timeMeasureEnd.distribution, this is also functioning correctly.

However, when I specify the action for the event block as chart.reset(); I get an error message:

Description: Type mismatch: cannot convert from TimeMeasureEnd to double. Location: Histogram Test/Main/data - Histogram Data

A second approach I tried was to have the timeMeasureEnd block write to a histogram data object, and have the event block reset a histogram data object but in this instance I get the same error message.

I am clearly missing something here, and I assume it is related to the agent object that is being injected into the system by the source block.

Any pointers in the right direction would be welcomed.

1 Answers

You can just call the resetStats() method of the timeMeasureEnd block. Just put code like timeMeasureEnd.resetStats() inside your event and the collected statistics inside this block and therefore the histogram will be reset every time you call this function.

Good luck (and please accept this answers if it solves your problem:))

Related