question

Mohamed Eldakroury avatar image
0 Likes"
Mohamed Eldakroury asked Mohamed Eldakroury commented

Acquire multiple operators from a resource list

Hello,


I need to a acquire multiple operators and assign the same tasksequence to all of them. It seems like a token is able to acquire the resources needed and assign them to a label called "resource". "resource" is an array of all the operators acquired. However, when I use the "resource" label for subsequent tasks, only the first operator in the array gets assigned things to do while the rest are marked as idle.


Is there a way I can reference the whole array of operators in subsequent tasks?


This is a model that was posted by @Jeanette F that I'm trying to build on and learn how to create my own custom basic FR.


Acquire Multiple Operators.fsm

FlexSim 23.2.0
processs flowcustom object
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

Paula LG avatar image
0 Likes"
Paula LG answered Mohamed Eldakroury commented

Hi Mohamed,

There are several ways of doing what you asked. One easy option is creating a SubFlow where you send a quantity of tokens (in this case, the quantity would be NumOperators parameter), so that each one of them can handle its own resource.

I attach your modified model here: acquire-multiple-operators.fsm. Take a look at it and let me know if this is something that could work for you.

I hope it helps!


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

Mohamed Eldakroury avatar image Mohamed Eldakroury commented ·

Hi Paula,

Thank you for your answer and yest that works! But I am curious why it didn't work when I had the subflow as part of the main flow?


To me, it looks like the subprocess flow is doing the same thing as I was doing before, however, it recognizes that when you create a task sequence for "token.resource"
you are creating the task sequence for all members of that array not just the first one.






0 Likes 0 ·
Paula LG avatar image Paula LG Mohamed Eldakroury commented ·

Hi Mohamed,

The difference that makes it work is this line in the "Run Sub Flow" block:

1709106711424.png

What this is doing is creating a label called resource on the new token that contains only one member of the resource array assigned in order; for the first token, token.resource is going to be token.resource[1] and so on. You can change the name of the children label to a different one, I guess that may be confusing and it's definitely not a good practice on modelling, sorry I didn't notice when I first answered your question!

0 Likes 0 ·
1709106711424.png (26.6 KiB)
Mohamed Eldakroury avatar image Mohamed Eldakroury Paula LG commented ·
Thank you, that makes sense now.
0 Likes 0 ·
Mohamed Eldakroury avatar image Mohamed Eldakroury commented ·

Hi Paula, I also have a follow-up question on the model. Let me know if you want me to create another post for that. I'll post it here for now.

Eventually, I'll need each operator to pick a task and do it instead of having all operators go through all tasks together. The model I posted here is a demo model for a bigger scope. I want to mimic the behavior of a multiprocessor but with the option that multiple operators can execute different processes at the same time.


My custom multiprocessor have many tasks (let's say 20 tasks/delays). And when I acquire multiple resources, in this case let's say 3, I expect every resource (operator) to pick a task and complete it so that the overall delay (processing time) of the processor goes down.

I'm thinking of two options:

1. grouping tasks together and create branches so that every child token goes to a branch. But that won't work because the number of branches will be fixed, while the number of operators is variable and maybe more or less than the branches, which means one branch may end up never getting executed. This will also assume that the set of activities in a branch are always executed together with one person which is not what I want to do.


2. When the child tokens enter the subflow, I only allow one token per delay (process) at a time, and if the delay is executed/being executed by one token, I don't want the next token to stop by that delay again and jump to the next one. This contradicts how the process flow works, because every token needs to go through the process flow activities in sequence. One way I see doing this is by changing the value of the delay to zero if a token already went trough it, but I think I will be overcomplicating things. Is there a better way of doing this?


Sorry if my explanation is confusing, please let me know if you need more details and I can explain a little bit more or post a diagram.


0 Likes 0 ·
Paula LG avatar image Paula LG Mohamed Eldakroury commented ·
Hi Mohamed, have you thought about using a list? If I'm understanding this correctly, you could push all your tasks to a list and then make the operators pull them and execute them.

You should definitely post this as a separate question as detailed as possible and see what suggestions the users come up with!

0 Likes 0 ·
Mohamed Eldakroury avatar image Mohamed Eldakroury commented ·

@Paula LG Yes, that's what I did. I used a resource list and it's working! I still need to tweak many things to have it work the way I want, but Lists is the way to go.

Here's my updated model for everyone's benefit. I posted a separate question about how to use acquire resources from multiple lists in a separate post.


AcquireResourcesFromMultipleLists.fsm

0 Likes 0 ·