question

Maksymilian B avatar image
0 Likes"
Maksymilian B asked Jordan Johnson answered

StatisticsCollectors - Dynamic adding columns

Hello Everyone,
Actually I`m trying to visualization the data from dynamic create table in a Bar chart. I read that I need to use a StatisticsCollector to visualization the data in chart, but I need to fill a StatisticsCollector from scripts. I was trying to add new columns by copy the sample column in StatisticsCollector>variables/columns by command "createcopy()". And It works. I see new columns in statisticscollectors tree, but when I modify "valueNode" in StatisticsCollector>variables/columns/NewColumn, FlexSim program doesnt react on my changed. I searched information about it and found that column in statisticsCollectior is SimpleDataType, and I must use setsdtvalue. I tried it but effect is the same.
Do you have any suggestion how can I resolve this problem?

FlexSim 18.0.3
dynamic columns in statisticscollector
· 2
5 |100000

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

Jordan Johnson avatar image Jordan Johnson ♦♦ commented ·

My guess is that you can achieve your goal without writing a script. Can you describe the chart you want?

0 Likes 0 ·
Maksymilian B avatar image Maksymilian B Jordan Johnson ♦♦ commented ·

@jordan.johnson Ok,

I have GUI where I initialize number of nodes which have group of tables. Each Tables can be modify on initialize process.

(e.g: On start I have 1 node with table - tab1, tab2, tab3 etc. I add another node with tab1, tab2, tab3 etc. but size of each table can be other than size in node1.)

Then I run model and, e.g: After some time I want to show data from node2 tab1. I open GUI and choose it. Then GUI scripts open dashboard with Bar Chart which should show the data.

Additionally, In script I configure which column and line will be show on the Bar chart(e.g: in tab1 I have line(load1, time1, state1, load2, time2, state2 etc. and I need to show only value from lines with load name and column 1).

0 Likes 0 ·

1 Answer

·
Jordan Johnson avatar image
0 Likes"
Jordan Johnson answered

The big issue that I see with what you want to do is that the Statistics Collector is not designed to work if configured during a model run. It needs a reset, and calling OnReset for just the Statistics Collector only does half of what happens when you reset the whole model.

To use the Statistics Collector, you will need to flatten your data as much as possible. Right now, you have many tables. See if you can combine those tables into a single table (or at least a fixed number of tables), by adding a column that specifies the table name:

Once you do this, you will probably be able to find a way to put the data in a Statistics Collector. Often, it is convenient to use Process Flow to listen to when values change, and set up the Statistics Collector to listen to appropriate activities in that flow.

You can then use a Calculated Table to change the data you view during a model run by just running a new query on the correct table.

To change which options are selected on a chart, you will need to make sure those changes are applied. You can do that by setting the initailized variable on the chart to 0. On the next paint, the settings will be re-applied.


flattentables.png (3.0 KiB)
5 |100000

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

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.