Pulling Items from Queue Based on Multiple Conditions

Pulling Items from Queue Based on Multiple Conditions

leonize_meiring
Participant Participant
391 Views
12 Replies
Message 1 of 13

Pulling Items from Queue Based on Multiple Conditions

leonize_meiring
Participant
Participant

Hi everyone,

I’m currently working on a model where I need to pull items from a queue based on specific attributes.

The requirement is to select items that meet two conditions simultaneously (e.g., a quantity-related value and a classification/type attribute). I would like to ensure that only items matching both criteria are pulled from the queue.

Could anyone please advise on the best approach to:

  • Filter items in a queue based on multiple conditions

  • Control the pulling logic so that only qualifying items are selected

on this model a certain amount (ton) of a specific commodity has to be packed (combined) on a pallet at combiner 1.

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

moehlmann_fe
Collaborator
Collaborator
Accepted solution

The combiner is designed to pull a specified quantity from each input port of rank 2 and up for each container item that entered throught port 1. Pulling the correct quantity can thus be achieved by setting the relevant variables to the "Ton" label value. You already added the entry trigger that updates the component count based on a label and table. Since there is only one input and the quantity is given directly by the "Ton" label, we can simplify the code of that trigger option and just set both variable (the quantity through port 2 and the total quantity) to be equal to the label.

Pulling the correct type can be achieved by checking the "Pull" option in the Input tab of the combiner properties and defining a Pull Requirement. In this case, that the "Commodity" label of the pulled item and the pallet (first item on combiner -> "current.first") have to match.

You have posted previously about issues with the fluid library objects (like sending specific quantities and tracking labels). The truth is that those objects are quite old and haven't been maintained and updated since the 3d party FlowWorks module was released. Trying to make them work for things that they weren't really designed for is complex and I honestly don't think worth the effort. I don't see any functional reason why the fluid library would be needed in this model. Items are turned into a fluid. That fluid moves some distance and is then turned back into items. The correct travel time and throughput can just as well be achieved by setting the speed and Entry/Stopping Space on a standard conveyor. The visuals when using the default conveyor can also be improved somewhat with simple means. In the attached model I added a new flowitem with a shape I quickly created in Blender, meant to resemble a heap of some bulk material.

0 Likes
Message 3 of 13

leonize_meiring
Participant
Participant

Hi Felix, thank you so much this makes sense and worked, Also I agree the fluid model is not worth it, I also just want to know how do I tell the conveyor that only 1 type of commodity can be on the conveyor at a time (prevent the grain from mixing) - and it should only open the port of each q if there is actually a pallet waiting - because currently the grain starts flowing on the conveyor even though there isn't even a pallet

 

 

 

 

0 Likes
Message 4 of 13

moehlmann_fe
Collaborator
Collaborator
Accepted solution

I would suggest to build a small Process Flow that releases the required amount of goods when a pallet enters the combiner. I updated the model to use continuous values for the grain mass. The items entering the input queues are pushed to a list. Checking the "Use First SELECT Value As Quantifier" option for the list makes it so that instead of pulling as many values from the list as are required in the Pull From List activity, it deducts the quantity from the specified label. The value is removed from the list when the label reaches zero. This allows to have items in the queues that each represent a certain amount of grain, then pull any amount and delete the items that are 'used up' because their token will be released from the Push To List activity. The puller token then creates new items to be send to the combiner.

0 Likes
Message 5 of 13

leonize_meiring
Participant
Participant

Felix I am forever grateful for you, thank you so much... I have tried working with process flows before but struggled to work it with object modelling - this makes a lot of sense -How did you become so good at Flexim?

0 Likes
Message 6 of 13

moehlmann_fe
Collaborator
Collaborator

Thanks. It's just experience. I have been working with FlexSim professionally for six years and have been answering forum questions for four of those. So I have seen lots of potential problems and processes and thought about, as well as built solutions for many.

0 Likes
Message 7 of 13

leonize_meiring
Participant
Participant

I hope to become as good as you one day 🙂

 

I added the rest of my model to your model (the unload part (act=1) that should connect to the load part (act=2)), but I am now uncertain how I should do it,

My first issue is on the unload_elevator 1 that should split the truck and make the boxes (that is equal to the ton values that was on that truck and also of that commodity) - ex truck 1 will will have commod 1 and ton 10 - so 10 boxes of commod 1 should make (1 box=1 ton) and go on the elevator - then that should go to the different bins (commodity wise) and then from that bins should be pulled (for the load act (act=2))

0 Likes
Message 8 of 13

moehlmann_fe
Collaborator
Collaborator

There are some minor issues in the model:

- The grain source is set to push the items to a list in the exit trigger but that list does not exist in the model.

- The combiner that merges the truck and item after the sampling process is set to "Join", thus deleting the item and the commodity information on it. It should "Pack".

- The "Weigh_in1" processor is using a non-existant empirical distribution for its process time.

 

Unloading the items could be done by adding a second separator. The first unpacks the single item from the truck (and writes the number of tons to the item in the entry trigger). The second splits the item, creating as many copies as there should be depending on the Tons label. The decision point then sends the item to the correct queue.

0 Likes
Message 9 of 13

leonize_meiring
Participant
Participant

Hi Felix I added some final details to the model and then I broke it - I added 3 sources instead of one each making its own Act (so that each can have its onw arrival distribution), but now the grain is making at the conveyors when the model is staring - not as the truck arrives it makes what the truck label said - I also might have broken the pick up - not sure how i can see in an easy way that the correct commod and load is being loaded/ unloaded - could you please help

0 Likes
Message 10 of 13

moehlmann_fe
Collaborator
Collaborator

There are sources that are created items in the storage queues. I guess you added those for debugging at some point(?).

I also found several issues with missing labels and triggers:

- The "Act" label is not being created on the grain items at the start.

- The triggers on the load and unload queue that set labels like "Ton" and "Commodity" are missing.

- The distribution function in the process time of the "Grading" processor is missing a comma between two parameters.

There might well be more issues. I suggest you carefully compare the previous version to the current one in terms of triggers and the labels they set.

0 Likes
Message 11 of 13

leonize_meiring
Participant
Participant

Hi Felix, I think I fixed most of the issues - it seems like the grain in unloaidng correctly , but now it is not unloading - I compared the 2 versions - it seems something to do with the red token that is not creating can because of a list missing or a wrong label but I dont see it (seems root cause is that Q7 is not pulling the currect commod and ton grain)

0 Likes
Message 12 of 13

moehlmann_fe
Collaborator
Collaborator

Thinks I changed/fixed:

- The commodity label for unloading is currently generated twice. Once at the start on the truck and then again on the item after separating it from the truck. The second value can be different from the first, as they are both randomly taken from an empirical distribution. It might make more sense to copy the label from the truck to the item on the Unload_elevator. Same as the Unload_Ton label.

- Fractional quantity is currently ignored when creating the 'unloaded' items. This was the same in the previous model.

- The Pull Requirement on the Load_elevator combiner is trying to read a label called "Commod_2" instead of "Commodity".

Thinks that still need to be fixed:

- The "Commod_2" distribution returns the values 1, 4, 5 but "Commod_1" generates 1, 2, 3. This is the reason the loading is not working. Can't pull items with a label value that is never generated.

- The process time field on the "Weigh_out" is using an empirical distribution that does not exist in the model (Weigh_out2).

0 Likes
Message 13 of 13

leonize_meiring
Participant
Participant

Hi Felix, thank you it worked 

I have however 2 other problems now

 

Max content of each hopper should be 30 - I did this by setting the max content of the hopper q to 30 but the truck should not even be able to start unloading if that q qty has reached it max, commodities should not be able to mix, so there cant be 2 different commodities in hopper Q - so how do I put a check on the unload q even before the unload processors to check that q qty and commodity on the hopper_1 (q), also commodities cant mix on the conveyor belts 

 

Another issue I have is that I have reached my model limit but I still need to add operators and more hoppers - Are there any strategies to reduce my current object count without losing functionality — for example combining multiple queues into one, or using a single processor to represent multiple parallel hoppers?

0 Likes