Page 1 of 1

Queue problem

Posted: Wednesday 21 May, 2014 - 16:29
by joseba92
Good afternoon!
I am a student of the Universidad Pública de Navarra (Spain) and i am doing my final proyect and i need your Help.
After a productive process the products are stored in a queue and these are automatically going to the sink. I wonder if is there any atom that allows me to empty the store when it have 10 pieces.
Thank you!
Regards

Joseba

Re: Queue problem

Posted: Thursday 22 May, 2014 - 11:12
by Nick
Hi Joseba,

Based on your model description you don't need any additional atoms.
Enter the following code on the 'Trigger on Entry' of the Queue atom (the 'store'):

Code: Select all

Do(
   CloseOutput(c),
   if(
       Content(c) = 10,
       OpenOutput(c)
   )
)
Some remarks:
1. 'c' is the current atom; the atom the products enter; the queue
2. If the content of c is 10, the output channel of c is opened and all products in the queue are sent to the next atom
3. Every product that enters the queue closes the output channel. if the output channel is already closed then it stays closed

Regards, Nick