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 03-15-2010
m matias m matias is offline
Flexsim User
 
Join Date: Feb 2010
Location: USA
Posts: 13
Downloads: 0
Uploads: 0
Thanks: 8
Thanked 0 Times in 0 Posts
Rep Power: 124
m matias is on a distinguished road
Default Global variables to control state of a machine

Hi everyone,
In my model I am trying to use global variables in order to control a machine.
In brief - there is a machine and a queue. The queue has certain capacity. When the capacity is lower (or equal) than certain value (e.g. low_value) the machine starts filling up the queue. When the queue reaches upper value (e.g. high_value) the machine stops feeding the queue.
Every time when the machine starts there is setup time.
I tried to use two variables but I can't make it working.
If someone has an idea that would be very much appreciated.

Thanks in advance,
Mike
  #2  
Old 03-16-2010
Tom David's Avatar
Tom David Tom David is offline
Flexsim User
 
Join Date: Aug 2007
Location: Schwaebisch Gmuend, Germany
Posts: 430
Downloads: 157
Uploads: 47
Thanks: 486
Thanked 450 Times in 233 Posts
Rep Power: 520
Tom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant future
Default

Mike,

First I thought it is a very easy task, but it was getting interesting because of the setup. So it is easy and not very easy.

I built a small model to solve it.
Main idea is to control the Processor with the Queue depending on the content (Queue OnEntry OnExit). For LowLevel and HightLevel I use labels to easily adjust them.
The Processor has a label for the SetupTime and a label FlagSetup. This label is used to indicate if there is a setup or not. If flag is set the SetupTime is used otherwise the SetupTime is zero.
Processor has code in Setup Time and OnReset.
Interesting was also that the second arriving item will get setup, because the condition content <= LowLevel is true. To prevent this there is an if-statement to check if the first item leaves the Queue.

I hope everything is understandable, because I put some comments into the code.
Attached Files
File Type: zip Support_QueueControlsProduction_TD.zip (34.5 KB, 152 views)
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions."
The Following 3 Users Say Thank You to Tom David For This Useful Post:
Sebastian Hemmann (03-16-2010)
  #3  
Old 03-16-2010
Sebastian Hemmann's Avatar
Sebastian Hemmann Sebastian Hemmann is offline
Flexsim User
 
Join Date: Sep 2009
Location: Braunschweig (Germany)
Posts: 439
Downloads: 52
Uploads: 0
Thanks: 472
Thanked 217 Times in 154 Posts
Rep Power: 319
Sebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to behold
Default

I probably would try it with open and close the input port of the processor in equal to the filling of your queue. This would be done with:

In the queues triggers.

ONEntry Trigger
if(content(current)>250)
{
closeinput(current);
}

ONExit Trigger
if(content(current)<30)
{
openinput(current);
}


Instead of "current" you can use your global variables or even conect the queue and processor via centerport and use "centerobject".
Now you only have to look, how to implement the setup.

Greetings
__________________
Hemmi
  #4  
Old 03-16-2010
m matias m matias is offline
Flexsim User
 
Join Date: Feb 2010
Location: USA
Posts: 13
Downloads: 0
Uploads: 0
Thanks: 8
Thanked 0 Times in 0 Posts
Rep Power: 124
m matias is on a distinguished road
Default

Thanks for your solution, Tom. It's very elegant.
I was like you - thought it's easy but it's not. Well, at least to me.
From what I see you don't use any global variables. Just labels. Am I correct?
I have noticed when I increase SetupTime to (for example) 50 every part gets setup. I am not sure where it is coming from.

Last edited by m matias; 03-16-2010 at 07:35 PM.
  #5  
Old 03-17-2010
Tom David's Avatar
Tom David Tom David is offline
Flexsim User
 
Join Date: Aug 2007
Location: Schwaebisch Gmuend, Germany
Posts: 430
Downloads: 157
Uploads: 47
Thanks: 486
Thanked 450 Times in 233 Posts
Rep Power: 520
Tom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant future
Default

Mike

You are right, that I just using labels. You could also use Global Variables. It is just information and in my eyes it makes not differences if the information is on a label or Global Variable (or Global Table). Just change it the way you like to have it.

If you increase the SetupTime to (e.g.) 50 every part gets setup, because the condition in the OnExit Trigger of the Queue is always true (if(content(current) <= getlabelnum(current,"LowLevel"))), because the Queue will not fill up because of the long setup time and stay under the LowLevel.
You need additional information, if you want to prevent this. The question is what will be the rule for doing setup? If this information is available, I am pretty sure it can be implemented.
In the moment the model solves the task you described in your first post. So you need to be more precise to solve your second task.
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions."
  #6  
Old 03-18-2010
m matias m matias is offline
Flexsim User
 
Join Date: Feb 2010
Location: USA
Posts: 13
Downloads: 0
Uploads: 0
Thanks: 8
Thanked 0 Times in 0 Posts
Rep Power: 124
m matias is on a distinguished road
Default

Thank you for your reply, Tom.
I was just experimenting with the first model and was curious why it was happening. I understand now


Thread Thread Starter Forum Replies Last Post
Global variables juan alberto Q&A 5 11-10-2010 05:47 PM
Update of global variables BenjaminBuecklein Q&A 4 11-18-2008 03:43 AM
Limit in the completion hints? Global Tables, Global Variables, etc.? Tom David Gripes and Goodies 6 09-09-2008 04:05 PM
State files and global variables Markus Bans Q&A 3 07-08-2008 12:22 PM
State Graph in Model Control GUI Tom David Q&A 4 11-21-2007 12:50 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.