question

Jason P2 avatar image
0 Likes"
Jason P2 asked Jordan Johnson commented

Partition Content in a Zone

I have a zone that is partitioned by a rack in a warehouse it is a number 1-8 the tokens is the zone represent pallets in the rack. I have another process in the model that needs to get the content of the partition in the zone. I am trying to use the get activity stat in the assigned labels. This does not work


FlexSim 20.1.2
flexsim 20.1.2content in zone
1590159463119.png (10.9 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.

1 Answer

Regan Blackett avatar image
2 Likes"
Regan Blackett answered Jordan Johnson commented

Without seeing your model and exactly the way it is set up, I can only offer some conjecture about what is possibly happening. My suspicion is that the tokens in the other process that you want looking at the Zone partition content, don't have the "Rack" label on them. In the attached example model, tokens created by the Zone Monitoring source are assigned a specific partition to look at and are correctly getting the Partition Content at the moment of their Assign Labels Activity.

partitioncontentstat.fsm


· 7
5 |100000

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

Jason P2 avatar image Jason P2 commented ·

I have what you have and it looks like it is working when the partition content is greater than 0 when the partition content is 0 I get this


0 Likes 0 ·
1590167265941.png (1.5 KiB)
Jordan Johnson avatar image Jordan Johnson ♦♦ Jason P2 commented ·

The popup in your original question uses the getstat() command. The getstat() command can return a giant number (STAT_UNDEFINED) if that stat isn't available. You can test this code in the script console, assuming you're using @Regan Blackett 's model:

int rack = 1;
double value = getstat(getactivity("ProcessFlow", "Zone"), "PartitionContent", STAT_CURRENT, 0, rack);
if (value >= STAT_UNDEFINED) {
    return 0;
}

return value;

At reset, the Zone doesn't have any partitions. So all Partition stats (like PartitionContent") aren't available. The partition isn't created until it's needed. So in Regan's example, Partition 1 doesn't exist until a token with Rack label 1 tries to enter. This may be happening to you.

Another possibility for this issue is that the instance is not correct. It looks like the pickoption just assumes "current", which means you are getting stats for the same instance as the token. In my code example, I passed a 0, because General Process Flows only have one instance, so that value is ignored. If you are trying to get statistics for an activity in an Object flow, where there is one instance per attached object, then you'd need to pass in the correct object there.

1 Like 1 ·
Pinakin K avatar image Pinakin K Jordan Johnson ♦♦ commented ·
@Jordan Johnson Thank you. I guess the above mentioned script is the only solution unless there is a pre-existing partition.
0 Likes 0 ·
Show more comments
Regan Blackett avatar image Regan Blackett ♦ Jason P2 commented ·

I think we should definitely see your model then. In my example model the first time the partition content is checked, the result is a properly reported zero.

0 Likes 0 ·
Pinakin K avatar image Pinakin K Regan Blackett ♦ commented ·

Hi @Regan Blackett I opened this model and it was giving out negative number on the token label when the content is 0. Is it because the zone status shown below does not have the partition in it yet?


1649347023950.png




0 Likes 0 ·
1649347023950.png (53.1 KiB)
Show more comments