Search code examples
anylogic

Access to ResourcePoll Utilization Data set


I'm trying to show ResourcePool utilization on a Time Plot chart.

Currently I use Time Plot to display by Value the utilization of the selected ResourcePool: enter image description here

My problem is that every time the stageIndex changes, the Time Plot resets and starts showing the data from that moment on.

Is there a way to directly access the DataSet of the ResourcePool (if there is one) and also get the past information about the utilization?

Thanks a lot.


Solution

  • Resource pools don't store historic utilisation information. (AnyLogic Datasets store time series, but most blocks/elements don't have built-in logic to store such a time series for every numeric statistic calculateable from them...)

    The simple (and design best-practice) alternative is to have plots showing the utilisations over time for all resource pools you're indexing into and just control the visibility of these plots dynamically (if, as you suggest, the user selects which agent (with embedded resource pool) they want to view the graph for). They could be at identical x,y coords if you want (with only 1 visible) or not.

    You can use AnyLogic's replication functionality to make this easy in this case: replication is useful when you have multiple charts or presentation elements with a common set of 'rules' regarding their number, placement and properties (including visibility). See the 2D and 3D animation --> Animating replicated objects help page. (In particular, this is the only way to have a dynamic number of charts/shapes depending on some potentially-changing-over-time and/or determined-only-at-run-time (e.g., related to input data) piece of information.)

    NB: You could define and populate the historic utilisation Datasets yourself, but you still can't use a single plot because the Dataset expression you enter is effectively static: it is only evaluated once at model start. The "Value" expression is 'dynamic' but only because that's how Value plots work: the expression is evaluated at the interval you specify to 'add the next value to the plot' (which is why the behaviour you observe occurs when you change your index).