How to Create a Cumulative Time Plot with Statistics Collector in FlexSim?

How to Create a Cumulative Time Plot with Statistics Collector in FlexSim?

mm_ighiri
Contributor Contributor
84 Views
2 Replies
Message 1 of 3

How to Create a Cumulative Time Plot with Statistics Collector in FlexSim?

mm_ighiri
Contributor
Contributor

Hi everyone,

I’m currently working on a FlexSim model where I use a Statistics Collector to track the tonnage transported every time a resource is used.

I’ve successfully collected the data including timestamps, and the table looks like this:

DateTime | Tonnage | Tonnage_Mng
---------------------------------------------------
02/06/2025 04:50:24 | 10000 |
02/06/2025 07:57:35 | 10000 |
02/06/2025 08:16:57 | 10000 |
... | ... | ...
07/07/2025 10:18:53 | 0 | 36.40
07/07/2025 10:38:23 | 0 | 54.60
...

 

Now, I want to generate a cumulative plot of the tonnage over time — something like a running total that increases as new data points are added : 

DateTime | Tonnage | Tonnage_Mng
---------------------------------------------------
02/06/2025 04:50:24 | 10000 |
02/06/2025 07:57:35 | 20000 |
02/06/2025 08:16:57 | 30000 |
... | ... | ...
07/07/2025 10:18:53 | 0 | 36.40
07/07/2025 10:38:23 | 0 | 91
...

mm_ighiri_0-1747917362576.png

I tried using the "increment data" option, but it only works when staying on the same row, which doesn't fit my use case where each data point is on a new row.
I also attempted to use custom code, but I couldn’t figure out how to access the value from the previous row (n-1) to calculate the cumulative total.

 

Has anyone faced a similar challenge or knows how to solve this ?

Thank you in advance

0 Likes
Accepted solutions (1)
85 Views
2 Replies
Replies (2)
Message 2 of 3

moehlmann_fe
Enthusiast
Enthusiast
Accepted solution

"collector.getValue(data.rowNum-1, data.colNum)" will get you the value from the previous row in the same column. You then just need to add a case for the first row where only the tonnage value is used.

(In general you can get data from a Statistics Collector table with the same syntax that is used for global tables)

 

0 Likes
Message 3 of 3

mm_ighiri
Contributor
Contributor

Thank you! That works perfectly

0 Likes