question

Karan avatar image
0 Likes"
Karan asked Karan commented

Tracked variable chart

I have a warehousing model where I am trying to track the available stock of all parts at a particular location. At the start of the simulation I am creating each part with a tracked variable label called "availableStock" that gets updated upon consumption and replenishment. I need to create a chart that lets me look at the availableStock for all the parts at a particular location.

Ideally I could easily do this by pinning this variable to a dashboard, run the model and see the data. However, since the parts and their tracked variables are created after running the model, the dashboard chart will not be able to plot anything. As explained here as well, reference: How to plot Tracked Variable label? - FlexSim Community

In such a scenario, is it possible to create the dashboard chart via custom code or flexscript after the part is created? This would probably allow me to add all parts to one chart via process flow custom code which is what I need. Attaching a sample of how my larger model works.

replenish-sample.fsm

FlexSim 23.1.2
chartstracked variables
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

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

You can customize the chart's internal Statistisc Collector (after installing the chart's components) to allow for this.

The collector stores the labels to plot as a list of nodes under the LabelList label.

1687934531621.png

So if you add the item's labels to this list the collector will track them from that point onwards. In the attached model I added a second event to the collector (On Entry of the queue). In the code of the condition field I add the entering item's availableStock label to the label list.

The row value is normally an array of all labels in the list (adding a row new row for each label). For the OnEntry event I only return the newly added label, so that an initial data point is generated for it.

Some other changes compared to the default collector:

- By default the second column contains a reference to the label node that the row belongs to. The syntax used there does not work for transient objects (flowitems), so I replaced it by instead writing the item's Type value to this column.

- The collector's label list gets reset back to empty on every model reset, to prevent keeping empty nodes forever.

replenish-sample_fm2.fsm


Alternatively, wouldn't it also make sense to track the stock on persistent labels on the queue that get updated when a new item enters the queue?

This would require to know how many labels you will need beforehand but also allow to sum the labels of items with the same type together (if that is a possibility in your model).

replenish-sample-fm.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.

Karan avatar image Karan commented ·

Thank you Felix, this is exactly what I was looking for.
Yes I could have that as a static label on the queue, however the number of parts my case is around a 100 or so for multiple queues.
In hind sight, a line chart is very cluttered for 100+ parts but at least I can collect the data accurately and choose to plot it outside of flexsim.

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.