question

Oscar C13 avatar image
0 Likes"
Oscar C13 asked Oscar C13 edited

Know if there is a specific item within a queue

Hello!
How can you know if there is a especfic item inside a queue? What code do you have to write?
I made a simple model where the operator has to take the item with the "cilindro" label from the queue, and if not wait.
This is not exactly what I want to do in my real model but the idea is that.

I have set "model().find("Queue1").subnodes=token.cilindro" in the decide tool but it doesn´t works.
cilindro.fsm

FlexSim 21.2.1
process flowqueuedecide
cilindro.fsm (37.8 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.

Joerg Vogel avatar image Joerg Vogel commented ·
Logical comparison
a == b
0 Likes 0 ·

1 Answer

Roi Sánchez avatar image
0 Likes"
Roi Sánchez answered Felix Möhlmann edited

The 'token.cilindro' label does not exist until you create the object in the second Create Object activity, after the Decide activity:

1635499599252.pngWhen you first create the object, you are storing a label called 'box', so I guess you should compare the subnodes with this label. What I don´t understand in your model is why you are checking if there is a certain item in the queue as you are always creating it before the condition.


1635499599252.png (73.9 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.

Oscar C13 avatar image Oscar C13 commented ·

What I am trying to simulate is that it checks if there something specific in the queue. If this is the first time the token has passed through there, the item being searched for in the queue has probably not been created yet. But since it will be process that ir repeated over time, in the following iterations that item will exist in the queue.

The problem is that if I search for something in the queue, that has not yet ben created in the model, it gives me an error.

Imagine that a worker looks at a table to see if there is an item, if there is not, he has to go to the warehouse to find it (create object). He uses that item and then leave it on that table, so the second time he goes to look, the item will be on the table. Within the 3rd iteration the item will no longer serve, and it will be destroyed, so he will look at the table again an there will be nothing.

Well, that is what I have done, but, if the operator looks for that item that has not been created, it gives me an error. Any idea how to deal with that? I don´t know if I have explained myself correctly

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Oscar C13 commented ·
You can use "token.cilindro?" to check whether the item in question exists. This will return "false" if either the label doesn't exist or the value of the label is zero/empty/"null" (for example after the previously assigned item got deleted).
0 Likes 0 ·
Oscar C13 avatar image Oscar C13 Felix Möhlmann commented ·

This is the error

1635925183276.png

I attach the mini-model
cilindro.fsm

0 Likes 0 ·
1635925183276.png (9.2 KiB)
cilindro.fsm (38.7 KiB)
Show more comments