Show available space of storage

Show available space of storage

sebastian_hemmannE3JAU
Collaborator Collaborator
17 Views
9 Replies
Message 1 of 10

Show available space of storage

sebastian_hemmannE3JAU
Collaborator
Collaborator

[ FlexSim 20.2.3 ]

Hi,

I´m looking for an easy way to show the available space in a storage system.

Something like x% of the storage is filled e.g.

Since I couldn´t find any Dashboards for tracked variables in the current version, it seems to be hard to add a "maximum" content line into a line graph or something similar.

Does anybody have a good idea?

@Jordan Johnson

0 Likes
Accepted solutions (1)
18 Views
9 Replies
Replies (9)
Message 2 of 10

JordanLJohnson
Autodesk
Autodesk
Accepted solution

The maximum can't always be calculated. You can have no maximum, where items can always successfully acquire a slot. You can also have the maximum depend on the items that appear. For example, supposed you limit slots by their available volume, and you put randomly-sized items in the rack. You could probably calculate a range for the maximum in that case. There are many other situations that make calculating a true maximum impossible.

If you want to count slots, here are two ways to do it:

Storage.system.querySlots("").length

or

int count = 0;
var objects = Storage.system.storageObjects;
for (int o = 1; o < objects.length; o++) {
    var bays = objects[0].bays;
    for (int b = 1; b <= bays.length; b++) {
        var levels = bays.levels;
        for (int v = 1; v <= levels.length; v++) {
            var slots = levels.slots;
            for (int s = 1; s <= slots.length; s++) {
                var slot = slots;
                if (slot.isStorable) {
                    // You may need to increment the count based
                    // on slot labels or something
                    count++;
                }
            }
        }
    }
}
// for a script window:
// return count;
.


Jordan Johnson
Principal Software Engineer
>

Message 3 of 10

sebastian_hemmannE3JAU
Collaborator
Collaborator

@Jordan Johnson, thanks for pointing this out. What do you think could be a good way to set the maximum capacity manualy and show both - my maximum and the actual filling (e.g. number of boxes) in one dashboard?

0 Likes
Message 4 of 10

JordanLJohnson
Autodesk
Autodesk

Here's one possibility:

Image.png

ValueVsMax.fsm

The idea is to calculate the max, and then show that line on the chart. All of that is done in the stats collector. I used a "When the Value is Accessed" for the time column, and intentionally didn't finish the second row for the Max data. I do finish all other rows, so they only update when the row is added. That way, I only have two rows of data for the Max series.

.


Jordan Johnson
Principal Software Engineer
>

0 Likes
Message 5 of 10

sebastian_hemmannE3JAU
Collaborator
Collaborator
Hi @Jordan Johnson, sadly the link is broken and I didn´t download the model until now. Please be so kind and upload the model again.
0 Likes
Message 6 of 10

JordanLJohnson
Autodesk
Autodesk

No problem, here's a link:

ValueVsMax.fsm

.


Jordan Johnson
Principal Software Engineer
>

0 Likes
Message 7 of 10

sebastian_hemmannE3JAU
Collaborator
Collaborator

@Jordan Johnson, thanks for the help. Can you please further explain what will happen to the tracked variables in future? Couldn´t find any dashboards supporting this?

0 Likes
Message 8 of 10

JordanLJohnson
Autodesk
Autodesk

I have a list of additional charts to make, and charts for Tracked Variables are on that list. For now, you have to set up your own stats collector.

.


Jordan Johnson
Principal Software Engineer
>

0 Likes
Message 9 of 10

hsiangchao
Not applicable

Hi,

I tried to calculate available space of storage using this model. But I failed, how can I calculate Current/Max in Statistics Collector?available.png

0 Likes
Message 10 of 10

moehlmann_fe
Observer
Observer

Since you want to display the ratio you don't actually need the "Max" rows that are created by the first two events.

Instead you could add code to the "On Row Adding" trigger that writes the maximum content to a label of the collector when the first row is created. This can then be used to calculate the ratio in each row.

1660285424312.png

1660285436340.png

1660285451834.png

0 Likes