Search code examples
anylogic

How to collect average time in block data


My goal is to understand how much time throughout my model an agent is waiting (in the queue of a seize block) moving (through moveto) and working (delays). Originally I thought I could gather this from the built in database which has exactly this data in the flowchart_stats_time_in_state_log, however, I would like to collect this data throughout a parameters variation. Therefore, I need a way to collect this data and write it to a data set or excel. The problem is I can not find how to access block statistics.

Maybe my approach is incorrect and I should instead collect data on my various agents.


Solution

  • In your agent you can have a variable which saves the time the agent enters the seize block, and thus also the queue. And then you can save the delta between the enter time and the time it seizes a unit (i.e. it exists the internal queue of the seize block) and then save this calculated time to a statistic object.

    enter image description here

    At the end of the simulation you can then easily write this data to the DB or to Excel, or to a txt file for example

    enter image description here