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 11-04-2010
Congshi Wang Congshi Wang is offline
Student
 
Join Date: May 2010
Location: Germany
Posts: 58
Downloads: 2
Uploads: 0
Thanks: 48
Thanked 0 Times in 0 Posts
Rep Power: 124
Congshi Wang is on a distinguished road
Default Implementig Conwip Control

Hi,

I got a simple production line like this:

Source => JobQueue => Queue1 => Processor1 => Queue2 => Processor2 => Queue3 => Processor3 => Queue4 => Processor4 => Queue5 => Processor5 => Sink


And I want to use CONWIP to control the WIP of this production line.


I set two global variables:
  1. MaxWIP (Experimenter Variable)
  2. CurrentWIP (Initial = 0)
The JobQueue has an infinite maxcontent and should every job that comes.

The acutal production line starts with Queue1 and ends with Processor5. Therefor I set these objects to a group.

Now I don't know exactly how to control the flow from JobQueue to Queue1.

First approach
  • onentrytrigger job queue:
    • if (CurrentWIP<=MaxWIP)
      {
      openinput(outobject(current,1);
      }
      else
      {
      closeinput(outobject(current,1);
      }
  • onentrytrigger Queue1:
    • CurrentWIP = CurrentWIP+1;
  • onexittrigger Processor5:
    • CurrentWIP = CurrentWIP-1;
Doesn't work properly, the CurrentWIP is far more than MaxWIP (in that case 9).

Second approach:
  • onentrytrigger Queue1:
    • if (CurrentWIP<= MaxWIP)
      {
      openoutput(inobject(current, 1));
      CurrentWIP= CurrentWIP+1;
      }
      else
      {
      closeoutput(inobject(current, 1));
      }
  • onexittrigger Processor5:
    • CurrentWIP = CurrentWIP-1;
Doesn't work at all. Nothing exits the Job Queue.

Thanks for your help!

Congshi
  #2  
Old 11-04-2010
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

If you're not using transport to move the items from the JobQueue then the exit of the JobQueue can just be:

WIP++;
if (WIP>=WIPlimit)
closeoutput(current);



And on the entry to the sink:

WIP--;
openoutput(JobQueue);
Attached Files
File Type: zip conwip.zip (54.5 KB, 188 views)

Last edited by Jason Lightfoot; 11-04-2010 at 07:44 AM. Reason: Clarification
The Following User Says Thank You to Jason Lightfoot For This Useful Post:
Congshi Wang (11-04-2010)
  #3  
Old 11-04-2010
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

If you know that the items leave JobQueue on port one, then this is a solution with transport.

On the SendTo of the JobQueue:

if (WIP<WIPlimit){
WIP++;
return 0;
}


return -1 ;

And then on the sink entry:

WIP--;
for (int n=1;n<=content(JobQueue);n++){
if (getnodenum(first(itemtype(rank(JobQueue,n))))==FRSTATE_INQUEUE){
releaseitem(rank(JobQueue,n),1);
WIP++;
break;
}
}
Attached Files
File Type: zip conwip_transport.zip (83.6 KB, 163 views)
The Following User Says Thank You to Jason Lightfoot For This Useful Post:
Phil BoBo (11-08-2010)
  #4  
Old 11-04-2010
Congshi Wang Congshi Wang is offline
Student
 
Join Date: May 2010
Location: Germany
Posts: 58
Downloads: 2
Uploads: 0
Thanks: 48
Thanked 0 Times in 0 Posts
Rep Power: 124
Congshi Wang is on a distinguished road
Default

Thanks,

this solution is great because it is so simple ;-)
  #5  
Old 11-04-2010
Congshi Wang Congshi Wang is offline
Student
 
Join Date: May 2010
Location: Germany
Posts: 58
Downloads: 2
Uploads: 0
Thanks: 48
Thanked 0 Times in 0 Posts
Rep Power: 124
Congshi Wang is on a distinguished road
Default

Sorry,

but I got still two questions left:

What is

itemtype and FRSTATE_INQUEUE?

And, in which case it is better to use

- the send to funtion: only send (return 0) if WIP is lower than WIPlimit, otherwise return -1 (== closeoutput)
- the onexit trigger function: closeoutput if WIP reachs or exceed WIPlimit

to control the flow out of the JobQueue?

Thanks!

Thanks!

  #6  
Old 11-04-2010
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

The itemtype node of the item has underneath it another node (rank 1) which is used to flag whether it's scheduled to move out already - I'm just using that to see which ones are new items to be released, rather than ones that are are already released and just waiting to be moved.

If you plan to use transport to move items from the jobqueue, the first (simple) method will not work.
  #7  
Old 11-04-2010
Phil BoBo's Avatar
Phil BoBo Phil BoBo is offline
Flexsim Development
 
Join Date: Jan 2008
Posts: 756
Downloads: 109
Uploads: 18
Thanks: 385
Thanked 1,483 Times in 525 Posts
Rep Power: 1174
Phil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond repute
Default

There are commands to access all the information under the itemtype node. For this case, you should be using getitemstate()

if(getitemstate(rank(JobQueue,n))==FRSTATE_INQUEUE)
The Following 2 Users Say Thank You to Phil BoBo For This Useful Post:
Jason Lightfoot (11-04-2010)
  #8  
Old 11-05-2010
Congshi Wang Congshi Wang is offline
Student
 
Join Date: May 2010
Location: Germany
Posts: 58
Downloads: 2
Uploads: 0
Thanks: 48
Thanked 0 Times in 0 Posts
Rep Power: 124
Congshi Wang is on a distinguished road
Default

In a previous post it is said that:
You should NEVER, repeat NEVER open or close input/output ports in the OnEntry or OnExit triggers!
http://www.flexsim.com/community/for...+code#post1877

You suggested to use the closeoutput(current) command. Could it be problematic?
  #9  
Old 11-08-2010
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

There is a difference between opening and closing special ports and to open or close the output and the input in general.

Jörg
  #10  
Old 11-08-2010
Phil BoBo's Avatar
Phil BoBo Phil BoBo is offline
Flexsim Development
 
Join Date: Jan 2008
Posts: 756
Downloads: 109
Uploads: 18
Thanks: 385
Thanked 1,483 Times in 525 Posts
Rep Power: 1174
Phil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond repute
Default

Quote:
Originally Posted by Congshi Wang View Post
In a previous post it is said that:
You should NEVER, repeat NEVER open or close input/output ports in the OnEntry or OnExit triggers!
http://www.flexsim.com/community/for...+code#post1877

You suggested to use the closeoutput(current) command. Could it be problematic?
Opening ports using openinput() or openoutput() in an OnExit or OnEntry triger can be problematic. If you have problems with your model because you are using these commands, put them into a delayed message in 0 time instead. These commands are problematic in certain situations. If you are unsure whether it is going to work correctly or you just want to be safe, don't use them in OnEntry or OnExit. Presumably, Jason tested his code and it worked fine. If it didn't work properly, he would have put the code into a delayed message. If you modify his code and it no longer works properly, you should put the code into a delayed message.

From the command documentation on openoutput():
"It is advised that modelers never use this command in any field other than the OnMessage field which has been triggered with the senddelayedmessage() command, because commands which open ports often spawn several other activities that shouldn't be performed during transitional events."
The Following 3 Users Say Thank You to Phil BoBo For This Useful Post:
Lars-Olof Leven (11-09-2010)


Thread Thread Starter Forum Replies Last Post
GUI combobox control Sung Kim Q&A 1 04-01-2009 06:27 PM
Job Allocation using GUI Control Anthony Timmiss Q&A 1 01-26-2009 11:29 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.