question

mfrsagfm avatar image
0 Likes"
mfrsagfm asked Jeanette F commented

Regarding ASRS and decide looping

The way it currently works is boards are taken from the combiner and placed onto the entry queue. The purpose of the entry queue is that it holds the boards, which need to be placed on the racks. We can consider the previous to be Step 1.

An ASRS takes a board from the entry queue, one at a time, and places a board onto the testing rack. If a board has been successfully tested, the board's color changes to red. After the board has been tested, it is taken by the same ASRS onto the exit queue.

I'm trying to set up the wanted logic, which is:

If there are boards waiting to be removed from the rack and placed on the exit queue vs. boards on the entry queue waiting to be placed on the rack, we want to prioritize the boards waiting to be removed from the rack and placed on the exit queue.

This is what I have set up right now:

A "Decide" block in FlexSim. The Decide block contains some code that makes it decide which output to go to. There are 2 outputs:

Output 1: A subflow in which the ASRS takes the tested board to the exit queue.

Output 2: A subflow in which the ASRS takes a board from the entry queue into the testing rack.

When the board has been tested, it is assigned a token label of "DoneItem" using a source block after a given dwell time and then placed onto a list called "Pallets in POD".

Output 2 has an arrow pointing back to the "Decide" block creating a loop to constantly make the ASRS evaluate what to do next.

Here's the code I have inside the Decide block:

/** Custom Code */

Object current = param(1);

treenode activity = param(2);

Token token = param(3);


print("Reached the decide block");


// Check if the "DoneItem" label exists on the current token

if (objectexists(getlabel(token, "DoneItem"))) {

print("Tested board token exists, returning connector rank 1"); // Debug statement

return 1; // Assuming the connector leading to the "Move to Exit Queue" subflow is ranked 1

} else {

print("No tested board token exists, returning connector rank 2"); // Debug statement

return 2; // Assuming the connector leading to the "Move to Testing Rack" subflow is ranked 2

}

This works, in that the ASRS is able to retrieve boards from the entry queue and place them onto the testing rack. However, the code never hits the "if" statement, so the ASRS never takes the boards off of the testing rack and places them onto the exit queue. I'm confused, because when I check the items in the "Pallets in POD" list during the simulation period, there are definitely tokens with the label "DoneItem".

Would really appreciate any help.

FlexSim 24.1.0
process flowasrsconditional decidedecide activity process flow
· 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.

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @mfrsagfm, was one of jc's or mfrsagfm's answers helpful? If so, please click the "Accept" button at the bottom of the one that best answers your question. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·
mfrsagfm avatar image
0 Likes"
mfrsagfm answered

No worries - I figured it out. I changed the "if" condition to:

List("List1").entries().length > 0

"List1" is the list that the tested boards enter - I made this a global list. The process works now as intended.

5 |100000

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

jc avatar image
1 Like"
jc answered mfrsagfm commented

Hello! Could you try replacing

(objectexists(getlabel(token, "DoneItem")))

by

(token.DoneItem?)

Let me know if that works! ;)

· 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.

mfrsagfm avatar image mfrsagfm commented ·
Hi jc,


Thanks for your reply. I tried that, but it still doesn't seem to be working for me. I know for sure that the decide block is being reached due to the print statement inside it, but it never goes inside the "if" portion, it continually hits the "else", even when there are tested boards complete left on the rack.

0 Likes 0 ·