question

Sebastian Hemmann avatar image
0 Likes"
Sebastian Hemmann asked Felix Möhlmann commented

Show available space of storage

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

FlexSim 20.2.3
flexsim 20.2.3fill level
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

Jordan Johnson avatar image
1 Like"
Jordan Johnson answered Felix Möhlmann commented

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:

  1. Storage.system.querySlots("").length

or

  1. int count = 0;
  2. var objects = Storage.system.storageObjects;
  3. for (int o = 1; o < objects.length; o++) {
  4.     var bays = objects[0].bays;
  5.     for (int b = 1; b <= bays.length; b++) {
  6.         var levels = bays[b].levels;
  7.         for (int v = 1; v <= levels.length; v++) {
  8.             var slots = levels[v].slots;
  9.             for (int s = 1; s <= slots.length; s++) {
  10.                 var slot = slots[s];
  11.                 if (slot.isStorable) {
  12.                     // You may need to increment the count based
  13.                     // on slot labels or something
  14.                     count++;
  15.                 }
  16.             }
  17.         }
  18.     }
  19. }
  20. // for a script window:
  21. // return count;
· 8
5 |100000

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