ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices. |
flexsim.com |
|
Downloads |
Q&A Using Flexsim and building models |
#1
|
|||
|
|||
How to open/close processor when there is a long queue
How to open/close processor when there is a long queue.
Two processor available. Currently, there is one working processor. When the queue has more than 20 items, the second processor will start operation. After the queue has been shorten.The second processor will stop its operation. |
#2
|
||||
|
||||
Hi Lilian,
use a if-statement in the Send To function of the Queue. If the content of the queue is greater than x send to first available. Otherwise send to a specific port. That is not the explicit solution but it gives you a hint. Jörg |
#4
|
|||
|
|||
You can also find a description of if - statements in the user commands and in the manual
I think he mean something ie.: Code:
int i_returnport = 1; if ( content(current) > 20) { i_returnport = 2; } return i_returnport; Tobias |
#5
|
||||
|
||||
With this solution all the products go to the 2nd machine if the content is larger than 20 and the first machine doesn't get anything anymore. In my opinion it is better to close the input of the 2nd processor and open it when the content is > 20. You could also use the pull rule on the 2nd processor but that slows down your model if your queue gets large.
To close the input of the 2nd machine select on reset to close and open ports. (the standard option already closes input so is fine) then on entry of the queue if content > 20 openinput of the machine 2: if( content(current) > 20 ) openinput( outobject( current, 2)); onexit of the queue if content < 20 closeinput again: if( content(current) < 20 ) closeinput( outobject( current, 2)); the sendto port should simply be first available. Steven |
The Following User Says Thank You to Steven Hamoen For This Useful Post: | ||
Brandon Peterson (12-03-2008) |
#6
|
||||
|
||||
Just a little hint: In the on exit of the Queue you would want to check for the content of the Queue being == 21 or <= 21 instead of < 20. The reason for this is that on exit the item is still considered to be in the Queue. So in order to close the input of the Processor at 20 items in the queue (2nd processor only used if content > 20) you would want to close the input if the content of the queue was 21 or lower (as the 21st if the one leaving).
Also, I haven't tested your method yet and I would definitely try this first but I am interested to see what the result will be if the closing item is going to the 2nd processor. This would result in a situation where the item exiting the queue would be closing the input port of the object it was going into. There is a big potential for problems there. So, if problems do come up I would suggest closing the output of the queue and sending a delayed message of 0 time to the queue in the on exit trigger of the queue (only if content(queue) == 21). The message could then open the output ports back up after running the check to see if it needed to close the input port of the 2nd pocessor. This way you don't have any possibility of object code undoing our code. The reason for closing the output here would be to insure that the 20th item doesn't sneak off to the 2nd processor. This would happen if you had the 21st item going to the 1st processor at the same moment in time that the next item (20) would want to exit to go to the 2nd processor. Good Luck, Brandon
__________________
thats not normal. |
The Following User Says Thank You to Brandon Peterson For This Useful Post: | ||
Steven Hamoen (12-04-2008) |
Tags |
inoutport |
Thread | Thread Starter | Forum | Replies | Last Post |
Pulling from a Queue vs Sorting the Queue | Brandon Peterson | Tips and Tricks | 3 | 03-03-2010 01:27 AM |
how to open another GUI | qin tian | Q&A | 13 | 01-04-2010 06:52 AM |
Close A Specific Port | Joe Allen | Q&A | 2 | 09-11-2008 06:30 PM |
Vitor - warehouse operations for long steel products | vgeorge | Pre-sales Questions | 2 | 07-12-2008 09:52 AM |