question

Kari Payton avatar image
2 Likes"
Kari Payton asked Phil BoBo commented

Batch in queue with process flow.

In my model I have a forklift taking trash to a big scrap zone. I want the forklift to collect all items in the trash can (queue) and transport. However I'm having trouble implementing the logic.

I am trying to batch incoming items in the queue and send it to a list so the forklift knows what bins need emptying. Is it possible to batch objects created in process flow into a queue in 3D?

I also tried having the forklift request 100 items of scrap and only require 1 item. However it's only pulling 1 item and leaving the other 4 on the list, for example.

FlexSim 17.2.3
batch
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

Jacob Gillespie avatar image
1 Like"
Jacob Gillespie answered Phil BoBo commented

Here is a small sample model I made. I made it request 100 items but only require 1. The tricky thing is you can't pass an array into the load and unload activities.

batchforklift.fsm


batchforklift.fsm (22.5 KiB)
· 5
5 |100000

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

Kari Payton avatar image Kari Payton commented ·

Thanks Jacob!

0 Likes 0 ·
Jason Merschat avatar image Jason Merschat commented ·

Hi @Jacob Gillespie

This line is very interesting token.i == 1 ? token.pulled : token.pulled[token.i]

Can you explain what this is doing please?

Thanks, Jason

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Jason Merschat commented ·

it is the short structure of the statement if (logical condition) true instruction else false instruction.

logical condition ? true instruction : false instruction 
2 Likes 2 ·
Phil BoBo avatar image Phil BoBo ♦♦ Joerg Vogel commented ·

This is known as the ternary operator.

I'm not sure why it isn't documented in the user manual.

0 Likes 0 ·
Jacob Gillespie avatar image Jacob Gillespie ♦ Jason Merschat commented ·

When you pass an array into the load or unload activity then only the first element of the array is used. So if the index (token.i) is 1 then I made it use token.pulled.

I did it this way because token.pulled is not an array if only one thing was pulled and so token.pulled[token.i] would throw an exception in this case.

1 Like 1 ·