question

Mohamed Eldakroury avatar image
0 Likes"
Mohamed Eldakroury asked Mohamed Eldakroury commented

Zone data into Statistics Collector

Hello,

I am building a statistics collector to pull data from zones. I need to get the total value of a subset calculation. I'm using a timer event, so every 7 days I'll pull all zones data.


The stat collector gives the option to get data from zones and I can specify that I need a calculation request input. However, I can't find a way to tell it what calculation I need to pull data for, and I end up with a long number that doesn't really represents what I want. Is that what the "requirement" filed is for? or do I need to edit the code to do this?



1711553955119.png

1711554030684.png


1711554288458.png


FlexSim 23.2.0
statistics collectorzonezone statistics
1711553955119.png (30.8 KiB)
1711554030684.png (23.1 KiB)
1711554288458.png (29.7 KiB)
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Mohamed Eldakroury avatar image Mohamed Eldakroury commented ·

I don't think the format is the issue. This number is way more than my zone calculation. Here's a demo model. I want to know the total weight of all tokens in Zone 3. I put a bar chart for reference. If you look at my stat collector, I'm getting another huge number.


Zone_StatCollector.fsm

0 Likes 0 ·

1 Answer

·
Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Mohamed Eldakroury commented

If there is a working default chart, then you can install its components to inspect how they work and even possibly start from there to adjust the Statistics Collector to your needs.

1711561422505.png

The correct expression in this case is the following.

getstat(data.rowValue, "CalculationTotal", STAT_CURRENT, instance, "Weight", "TotalWeight")

The "requirement" is two separate values in this case, so the GUI is actually inadequate and doesn't allow you to input both. Only option I see is to edit the code manually.

In the attached model I also modified your collector further to get the sum of the calculation over all four 4 zones by using an array with all zones as the row value and running a for-loop over all of them when determining the column value.

zone-statcollector_1.fsm


· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Mohamed Eldakroury avatar image Mohamed Eldakroury commented ·

Thank you!

That saved me hours of having to manually create 6-7 columns for every zone. I can now loop through the whole group. My actual model has 30+ zones. I was sure there's a smarter way to do this!

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.