question

SudheerReddy avatar image
0 Likes"
SudheerReddy asked Joerg Vogel edited

Doubt on dynamic capacity to Task Executer

22937-22932-acquireresource-ms.fsm

As shown in below image I need to set Task Executer2 capacity to be dynamic based on Queue3 content.

I need to maintain Queue capacity to be 3. If Queue3 content is 1 then Task Executer2 should deliver 2 items. If Queue3 content is 2 then Task Executer2 should deliver 1 item. How to achieve this in my model.

I am attaching my model for your reference.

FlexSim 19.1.2
task executer
· 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.

Joerg Vogel avatar image Joerg Vogel commented ·

@Sudheer R , if you build the model around of Queue3 in classic 3D logic with basic settings, you get what you want by default. Unfortunately, your supply for the Queue2 is to low, that the Taskexecuter2 can build up a stock in Queue3.

0 Likes 0 ·
SudheerReddy avatar image SudheerReddy Joerg Vogel commented ·

This is just sample model....If I want to implement this for bigger model, classic 3D logic will be time taking. So I used process flow. If I want to achieve this in process flow?How to do then.

0 Likes 0 ·
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Joerg Vogel edited

The available capacity of a queue sets the value to synchronize the items to be transported.

A first batching activity gets the amount of items being simultaneously transported by using a max wait timer. And a second batching activity reduces the tokens in the process.

replace-3d-logic-queue-max-capacity.fsm

replace-3d-logic-queue-max-capacity-19-1.fsm


5 |100000

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

Braydn T avatar image
0 Likes"
Braydn T answered Braydn T commented

@Sudheer R

If I understand you correctly, you want a Task Executor to automatically know how many items are "missing" from the queue and get that many and load them.

You could create a model where Process Flow creates a token when an item exits a queue and assigns a Task Executor to go pick up a flow item and put it in the Queue that you want to keep full, but you cant dynamically change the amount a Task Executor is supposed to pick up once a task has been assigned. In other words: once the Task Executor has been assigned to pick up 1 flow item, you cant tell it to pick up 2.

The other issue you would run into by doing this with Process Flow is the trigger to tell the Task Executor to pick up a flow item would be an item leaving the Queue you want to keep full. Those items do not leave the Queue in the same instance, and therefore would assign work to the task executor in two separate instances.

I have 2 ideas about how to make this work. They depend on how your model is going to work. They will both take a bit of time to create.

If you have items leaving the queue and you can guarantee that the TE that is loading the queue will be able to re fill the queue before more is taken, you can have a variable that represents the amount that is pulled from the queue, and assign the task executor to pull that many from the queue. You would do this by pushing all the items in the queue before the queue you want to keep at 3 to a list, and having the Task Executor pull that many items from that list and load. Again, this will only work if you know the amount leaving the queue, and the TE can fill it before it leaves.

The other way I can think of is more flexible, but has more potential to go wrong. You would push all of the items in the Queue before you the queue you want to keep full to a list. You would generate a token every time an item leaves the queue you want to keep full. You would also have a global variable that increments every time an item leaves the queue, and decrements every time an item is reintroduced to the queue. You could also conceivably make this variable a pointer to the Queues content minus 3. Once you generate a token, you would have a decide with this criteria: if the Task Executor is acquired, or the content of the queue is 3, sink the token. Otherwise, you would acquire the Task Executor, have them travel to the queue, check the number in the global variable, pull that many items from the list and save them in an array in a label, load them, and unload them in the queue you want to keep full, and then release the TE and sink.

This solution has alot of potential to go wrong, so if you can I would implement the first. Feel free to reply if you have questions about these solutions since they are a bit complicated.

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

SudheerReddy avatar image SudheerReddy commented ·

@Braydn T Could you implement the first

thank you

0 Likes 0 ·
Braydn T avatar image Braydn T SudheerReddy commented ·

We are not here to build your models for you, but here is an example that could be implemented for both. The global variable numToPull represents how many should be pulled from the list. Right now it is one, because that is the number that is always pulled. if you decide to move a different number from Queue2, you need to update numToPull every time you pull from Queue2.

I hope this helps:

example.fsm

0 Likes 0 ·
example.fsm (37.9 KiB)
anthony.johnson avatar image
0 Likes"
anthony.johnson answered SudheerReddy commented

This is the default logic of the standard Queue. If the queue's capacity is 3, and it has 1 in it currently, it will receive 2 simultaneously.

queuecapacity3.fsm


queuecapacity3.fsm (21.6 KiB)
· 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.

SudheerReddy avatar image SudheerReddy commented ·

This is not what I am looking for

0 Likes 0 ·