Pull from List

Pull from List

miguel_p9
Not applicable
19 Views
12 Replies
Message 1 of 13

Pull from List

miguel_p9
Not applicable

[ FlexSim 21.0.5 ]

Hey everyone,


I'm trying to do a pull from list but i want the task executer to load all of the items he push and not just a part of it. Is there a way for it to pull everything from the list instead of putting a request/require fixed number?


The number of items that needs to pull isn't always the same.


Thanks, Miguel Pereira.

0 Likes
Accepted solutions (1)
20 Views
12 Replies
Replies (12)
Message 2 of 13

eric_m3
Not applicable
Accepted solution

Hi @Miguel Pereira if you want to pull all the entries off the list, just make sure the list is a global list and then use this code in the Request Number of the pull activity:

List("YourGlobalListName").entries().length

In general, a good option for pulling different numbers off the list is to use labels. The label would go in the Request Number. You would just need to figure out how to assign the right number to pull to the label before entering the pull activity.

Message 3 of 13

miguel_p9
Not applicable

In my case i push to list in the same process flow that i pull, i mean. When other task executers leave items they are pushed to a list, but when i want the AGV from another circuit to take it i'm trying to pull from that list, but what i want to do is to go just one AGV and load all bags in one time. That code didn't worked on my project because it isn't a global list.

I've tried that but this error occurs:

1626784571926.png

Also in the project i get the prompt error:

1626784673480.png

Is there another way to fix it?

Thanks.

0 Likes
Message 4 of 13

eric_m3
Not applicable
Try creating a global list in the toolbox and then connecting the list in process flow to the newly created list. Then use that new list name in the code. The pop up error looks like the location isn't correct in the travel activity.
0 Likes
Message 5 of 13

miguel_p9
Not applicable

I've did that but i'm still receiving the error:


time: 0.000000 exception: FlexScript exception: Invalid variant type used with [] array operator at MODEL:/Tools/ProcessFlow/Transportes/Travel~7>variables/involved1.


The thing is it works if i put a number in the request field instead of the code...

the next activity is a travel and is to "token.GrupoDesteAero[1].up", this token is given by this task of pull from list.

0 Likes
Message 6 of 13

miguel_p9
Not applicable
I'll make a new project file with this part of my project and send it to you so you can see what's going on.
0 Likes
Message 7 of 13

miguel_p9
Not applicable

PullFromListError.fsm

Confirm that if you type any number instead of the code it works...

0 Likes
Message 8 of 13

eric_m3
Not applicable

This is just a timing issue. The token was trying to pull items off the list before there were any because of the way the Wait for Event was working. Because the code pulls the total number on the list, if there are no values on the list, it will move on without pulling anything which is why you are getting errors (changing the Require Number to 1 will at least make it so the error goes away).

I'm not 100% sure what the purpose of this part of the model is, so the following is just meant as an example of the timing issues and how you might go about fixing them. The AGV that takes 2 seconds to unload will cause problems with the timing again.

I changed the subflows to send all the tokens at once instead of one at a time. That way they will all be unloaded at the same time instead of one by one. I then added a breathe activity to make sure the items were unloaded before the token tried to pull from the list. I don't know if this is acceptable or not in your model, you may need to change how your Wait for Event activity works (maybe make logic for when the AGV leaves or when the token enters the next activity). There will also be problems because both tokens will be in the Wait for Event at the same time so when it fires, both tokens will move on. I included a resource to avoid this.

All in all, you need to figure out when you actually want the tokens to pull items from the list and include logic to make that happen.

As another note, the travel activities are best outside of the subflow. There's no reason to create a travel task for each item for the AGV to complete if they're all going to the same place.

pullfromlisterror_1.fsm

0 Likes
Message 9 of 13

miguel_p9
Not applicable
I've took a look at it, but what's a breath? works like a delay?


But what i wanted is when the Plane loads, it should take all of the bags. Like in an airport, AGVs (bottom circuit) take bags to the plane but just one comes to load all of them, that's why i wanted a pull to take all entries.

0 Likes
Message 10 of 13

eric_m3
Not applicable
Yes, it's just a delay set to 0 seconds that can help with timing issues when things are happening at the same time.


You'll want to change the Wait For Event to be something different then. The way you have it set up now, the planes will pull everything off the list after 1 AGV unloads their items. So Plane 1 will get items from the first AGV and plane 2 will get items from the second AGV, etc. It would probably be better to have the wait for event be set to when the content in the queue passes a certain level (however many bags are in that group).

Message 11 of 13

miguel_p9
Not applicable

How can i put a wait for event set with that condition? like when bags are over 60.

0 Likes
Message 12 of 13

eric_m3
Not applicable

There's a "on content change" event that you can choose. It has a lot of options that you can choose from to specify what you want.

1626818700090.png

Message 13 of 13

miguel_p9
Not applicable

Thanks, that helped.

0 Likes