question

Pinakin K avatar image
1 Like"
Pinakin K asked Pinakin K commented

How to select operator in subflow?

I have a subflow that is used by 2 different processes as the operation is same. I want to select an operator to go to a specific location when 2 tokens arrive at the same time in the sub flow:

Only operator 2 goes to its destination, but operator 1 does not move.

The two labels used in assign labels as HSG_Hopper & PAP_Hopper

How should I reference the operators in the travel activity so that they can use the same subflow to travel to different places and load & unload the respective items?

I cannot provide the model due to security reasons.

FlexSim 18.0.2
task sequencesubflow
code.png (23.5 KiB)
flow.png (37.8 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

Jordan Johnson avatar image
2 Likes"
Jordan Johnson answered Pinakin K commented

In the Run Sub Flow activity, you should assign a label called Operator on the tokens that are created. For the value of the label, you can use the code you have given above. Then, in the Task Sequence activities, you can just reference token.Operator, and it will reference the correct operator.

· 6
5 |100000

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

Pinakin K avatar image Pinakin K commented ·

@jordan.johnson

thanks, I tried that, but only one operator (operator2) is traveling to his specified destination, and the other operator doesn't move. there is an error message, that operator 2 does not exists on the token that the Operator 1 is supposed to follow. As I only specified operator 1 for 1st process and operator 2 for 2nd process. I also tried specifying both operators to each process (in the Run Sub Flow activity). Not sure why it is happening

0 Likes 0 ·
Jordan Johnson avatar image Jordan Johnson ♦♦ Pinakin K commented ·

Without having a model file, it will be difficult to answer. You can either post a private question, so that only FlexSim employees see the question, or you can replicate the problem in a non-proprietary model, and post that as a question.

0 Likes 0 ·
Pinakin K avatar image Pinakin K Jordan Johnson ♦♦ commented ·

@jordan.johnson

test-subflow1.fsm

the attached moidel is a test model with similar process flow, however, i did not use custom code anywhere just conditional object

0 Likes 0 ·
test-subflow1.fsm (31.2 KiB)
Show more comments
Jordan Johnson avatar image Jordan Johnson ♦♦ commented ·

Here's a working model:

test-subflow-2.fsm

Here are the changes I made. First, I updated the the Run Sub Flow activities, so that both assigned Operator, Location, Destination, and Item labels:

Note that in both cases, the label names are the same, but the label values are different.

Then, I updated the subflow activities themselves, to use the labels:

Notice how the activities refer to the labels assigned by the Run Sub Flow activities. This makes it so that as long as a token has an Operator, Location, Destination, and Item label, it can use this sub flow. The values of those labels can be very different, but the logic is the same.

0 Likes 0 ·
Pinakin K avatar image Pinakin K Jordan Johnson ♦♦ commented ·

Thank you so much!

I applied in my model, its works

0 Likes 0 ·