question

Herodes M avatar image
0 Likes"
Herodes M asked Ben Wilson edited

queue is full send to a second port and continuum sending to the first one.

i need to do this: when queue is full send to a second port and continuum sending to the first one, when is enough stop the second one and repeat that action.

FlexSim 19.1.0
full queue
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

·
Joerg Vogel avatar image
2 Likes"
Joerg Vogel answered Ben Wilson edited

You doesn’t need a source code logic. It is a logic by design of connections. The object (A), that fills the queue has got a second connection that goes to the second object. If object A “Send to Port” function on Flow tab is set to the default option “first available”, the queue is filled first then the items are being sent to the second object, if queue is full.

· 4
5 |100000

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

Herodes M avatar image Herodes M commented ·

I need the queue to be completely empty so that the second object stops receiving, it is not that it is sent to the second object only when it is full, but to send both until the queue is empty.

0 Likes 0 ·
Braydn T avatar image Braydn T Herodes M commented ·

@Herodes M you have an Onreset trigger that will close the queues second port. then, have an on entry trigger that opens the port when it reaches a certain number. It will look something like this:

if(queue.subnodes == 100){

openoutput(current);

}

you will have to specify which output to open.

You can have a similar bit of code in the same trigger that will close that input again when quantity reaches 1 (because that is an on entry trigger).

You can do this in several different triggers, but those are the basics.

0 Likes 0 ·
Ines L avatar image Ines L commented ·

Hi,

Doy you know how to send an item to the queue when its content its ONLY 1 or 0 but with preference with content=1???

0 Likes 0 ·
Ben Wilson avatar image Ben Wilson ♦♦ Ines L commented ·

Hi @Ines L,

This is a Question and Answer forum, not a threaded conversation forum. As such, posting a brand new question as a comment on an old question that already has an accepted answer is not the best way to get attention and help.

Please create a brand new question. In your question body, you can link back to any previous Q&As you think might be of help to others to understand what you're trying to do.

Lean more about this and other best practices in our article about the same.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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