question

Bernard L2 avatar image
1 Like"
Bernard L2 asked Bernard L2 commented

Sankey Diagram as in the user manual

Sankey Diagram as in the user manual

In the user manual, it is presented an Sankey Diagram. It says it was made with a datatable where there is an unique row for each From-To combination with the total count of its occurrence.

How can I create such datatable? I’ve tried using MilesCollector and StatiscCollector making it listening to a flowitem on its “on exiting” and “on entrying” trigger, but no luck.

Does anyone managed to make a data table for the Sankey Diagram in such that way?

Sorry, I meant to add the images from the user manual but for some reason I can't add any kind of attachments in my post.

FlexSim 19.2.2
statistics collectormilestone collectorsankey diagram
5 |100000

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

1 Answer

Brittany Evans avatar image
4 Likes"
Brittany Evans answered Bernard L2 commented

You can actually create this table using a single StatsCollector. I have attached an example model that has it set up so you can see how I set it up.

Basically what I did was create a group that contained all my processors and sinks. Then in my StatsCollector on the Event Listening Tab, I added in a "Listen to group" event listener that listened to the OnEntry Event for the whole group. Then I added three Event Data Labels:

  • From: That was the object the item just came from, which looked at the current objects input ports and found which object it came from.
  • To: That was the object the item just entered, which in this case was current.
  • RowValue: This is a unique label that is actually an array where the first value was data.From and the second value was data.To.

Next, I switched over to the Data Recording Tab and set my Row Creation Mode to be "Unique Row Values" where the row value was my RowValue label. This will create one row for each From-To Combination. Once I had the Rows set up I added in three Columns:

  • From: This is the object where the item came from. This value is only updated "When the Row is Added". To make sure that it formatted correctly, I made sure to get the ID of the object as my value.
  • To: This is the object the item just entered. This value is only updated "When the Row is Added". To make sure that it formatted correctly, I made sure to get the ID of the object as my value.
  • Count: This is the current number of items that have followed this path. This value is only updated "By Event Dependency". For this column, I just incremented the value every time somethings followed the path. In order for this event to update, you do need to make sure you "Edit Event/Column Dependencies..." so it increments when something enters.

Once you have done this, you will have a StatsCollector that creates the table you find in the user manual to use for a Sankey Diagram.

sankey-data-table-example.fsm


· 3
5 |100000

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

Bernard L2 avatar image Bernard L2 commented ·

Britany, thank you for your reply. It worked and I manage to replicate it changing to "on exit" of the group, so really thanks for your help! :)

Do you think it is possible to make as I first thought? Extracting the data from the flowitem would bring the advantage of gathering the data no matter how many new objects is added. It would even be a good way the check if the flowitem is not passing thru any wrong object.

Regards, Bernard

0 Likes 0 ·
Brittany Evans avatar image Brittany Evans ♦ Bernard L2 commented ·

You would be able to do that. It would require the use of a Statistics Collector where you use an Event Condition and Row Tracking Settings, as well as, a Calculated Table for the count column. I know that with the next release there is some functionality that may make this easier in the future.

0 Likes 0 ·
Bernard L2 avatar image Bernard L2 Brittany Evans ♦ commented ·

That sounds complicated. I was trying to do it using a Statistic Collector and setting to TransientEvent in the "Event Listening" and following the example you sent me as a base, but no luck. I still have a lot of doubts about Statistic Collector and as I can't debug the codes in the Statistic Collector (at least I can't find a way to do it) it make it even harder for me. If you have any other idea, I'd much appreciate, otherwise, I'll just keep using your first suggestion and wait for the new release to try again.

0 Likes 0 ·