question

Jon Abbott avatar image
1 Like"
Jon Abbott asked Daniel Saravia commented

How to determine the index of a Process Flow resource being acquired?

I have a simulation model with a Process Flow resource called Operators set to numeric mode with a count of 3. Is there a way to get and set a label for the index that represents which number out of the three operators that a token has acquired? Here is an example of what I am trying to achieve:

  • At the beginning of the model, the operator resource has a count of 3 that are all available.

  • Token 1 would acquire the first operator out of the three, so it would set a resource index label value of 1 to represent this.
  • Token 2 would acquire the second operator out of the three available, so it would set a resource index label value of 2.
  • Token 3 would acquire the last available operator, and would set a resource index label value of 3.
  • Token 4 arrives while all operators are acquired, so it would wait to get the next available operator. For example, token 2 releases the operator soonest, so that freed up the second resource and then token 4 would have a resource index label of 2.
  • Token 3 finishes and releases the operator resource.
  • Token 5 arrives, acquires an operator resource, and would set a resource index label of 3.

The FlexSim documentation says, "If the Resource is in numeric mode, the label will be assigned the quantity acquired which will always be the same as the Quantity box." I'm looking not for the quantity acquired but for which of the three operators is being assigned when the resource acquisition happens.


Please let me know if you have any questions. Thanks in advance for your help.

FlexSim 20.0.3
process flowresourceresources
5 |100000

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

Matthew Gillespie avatar image
0 Likes"
Matthew Gillespie answered Matthew Gillespie commented

The numeric mode is very simplistic and won't do what you're looking for. However, you can set the resource's Reference to an array of values and acquire specific values that way. This is effectively just pushing those values to a list and then pulling something off when you acquire. Here's an example model.

arrayresource.fsm


arrayresource.fsm (27.4 KiB)
· 2
5 |100000

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

Jon Abbott avatar image Jon Abbott commented ·

Thanks @Matthew Gillespie and @Benjamin W2. For resources with larger resource counts, I've added custom code in the Resource Reference box with a for loop that creates the array, and that seems to work well. If you know of a better way to do this (using an auto-incrementing array function that creates arrays with [1,2,...,n], or similar), please let me know.

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Jon Abbott commented ·

That sounds like the best way to me.

0 Likes 0 ·
Benjamin W2 avatar image
0 Likes"
Benjamin W2 answered Daniel Saravia commented

Hi @Jon Abbott,

One way to accomplish this is to change your resource to reference an Array of values, then create an array containing 1, 2, and 3. Then, when your tokens acquire the resource, they will acquire one of those numbers.

This should give you the behaviour you are looking for.


arrayofvaules.png (23.3 KiB)
· 3
5 |100000

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

Daniel Saravia avatar image Daniel Saravia commented ·

How will this work if your resources belong to a group ? I would like to refer to the resources acquired so operators can go to a corresponding queue where they have to unload. I do have 3 resources, operator (2), crane (1) and machine(2). Each machine has a corresponding queue where operator has to unload pallets according to what machine has being acquired. @Benjamin W2

1641844277443.png

Thanks1

0 Likes 0 ·
1641844277443.png (45.7 KiB)
Felix Möhlmann avatar image Felix Möhlmann Daniel Saravia commented ·

When acquiring a resource that reference a group, the acquired object will be assigned to the label you set in the "Assign to Label" field in the acquire activity.

1641893254865.png

From there you have multiple options to get a reference to the correct queue. The easiest two would probably to either have each processor have a label that points to the correct queue or use a- or s-connections. Both cases are demonstrated in the attached model.

PF_Referencing.fsm

You could also, similar to the original question, get the index of the processor in the group and then use that number in some way to find the correct queue.

Group("Processors").indexOf(token.processor)
1 Like 1 ·
1641893254865.png (11.7 KiB)
pf-referencing.fsm (58.1 KiB)
Daniel Saravia avatar image Daniel Saravia Felix Möhlmann commented ·

@Felix Möhlmann Thank you! I knew I had to use a label on the processor but I did not know how to make the connection to the Q. The example is spot on!

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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