ATTENTION

This 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

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 12-03-2008
Lilian_wulp Lilian_wulp is offline
Flexsim User
 
Join Date: Jan 2008
Posts: 4
Downloads: 19
Uploads: 0
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
Lilian_wulp is on a distinguished road
Default 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  
Old 12-03-2008
Jörg Vogel's Avatar
Jörg Vogel Jörg Vogel is offline
Flexsim User
 
Join Date: Sep 2007
Location: Hannover, Germany
Posts: 643
Downloads: 35
Uploads: 0
Thanks: 802
Thanked 665 Times in 410 Posts
Rep Power: 642
Jörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond repute
Wink

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
  #3  
Old 12-03-2008
Lilian_wulp Lilian_wulp is offline
Flexsim User
 
Join Date: Jan 2008
Posts: 4
Downloads: 19
Uploads: 0
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
Lilian_wulp is on a distinguished road
Default

okay, what should i do in the if-statement part. To be more exact what do i have to input in ?
  #4  
Old 12-03-2008
tobias.biemueller tobias.biemueller is offline
Flexsim User
 
Join Date: Aug 2007
Location: Bielefeld, Germany
Posts: 42
Downloads: 22
Uploads: 0
Thanks: 23
Thanked 18 Times in 16 Posts
Rep Power: 164
tobias.biemueller is on a distinguished road
Default

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;
Best regards
Tobias
  #5  
Old 12-03-2008
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

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  
Old 12-03-2008
Brandon Peterson's Avatar
Brandon Peterson Brandon Peterson is offline
The Flexsim Consultant
 
Join Date: Jul 2007
Location: Salt Lake City, Utah
Posts: 382
Downloads: 29
Uploads: 6
Thanks: 192
Thanked 516 Times in 235 Posts
Rep Power: 490
Brandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant future
Default

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


All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.