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 |
#1
|
|||
|
|||
How to determine special state of conveyor?
I have a conveyor(No downstream object). I set it's maxcontent to 5 and accumulating.
When it reaches it's maxcontent and blocked and every items on it reach their ends, I want to triggger some code. The problem is I don't know when and how to detect this special state. The items on the conveyor have different xszie. Any idea? thanks |
#2
|
||||
|
||||
This is a nice one. The only solution I can come up with is using the "filledlength" variable and when the 5th comes in, simply calculates how long it will take before this product hits the back (= conveyorlength - filledlength) of the 4th one and create a senddelayedmessage with the calculated time.
|
The Following 4 Users Say Thank You to Steven Hamoen For This Useful Post: | ||
zhang xin (10-27-2009) |
#3
|
||||
|
||||
Zhang,
If you want to make your code robust and usable for any situation then use the following to calculate the time: double traveltime = (getvarnum(current, "conveyorlength") - getvarnum(current, "filledlength") + getitemvar(item, 3)) / getvarnum(current, "speed"); Other than using getvarnum() instead of static values you'll notic the getitemvar() command. The getitemvar command is getting the 3rd variable on the item. This variable is set to the spacing value for the item prior to the entry trigger being called. So, it has basically already figured out the correct rotation, size, and spacing values that the conveyor is using for you. It is important to add this value on to the result of the length - filled equation because the length associated with the item has already been added on to the filledlength variable before the entrytrigger is fired. **Warning** while it is OK to view the item variables (there are only 3 of them) with the getitemvar() command, DO NOT change the values of the item variables. They are set and used by the objects in the model and changing them can have very bad consequences. I hope this helps, Brandon
__________________
thats not normal. |
The Following 7 Users Say Thank You to Brandon Peterson For This Useful Post: | ||
zhang xin (10-27-2009) |
#5
|
||||
|
||||
Quote:
do you have a list of all 3 item variables for each fixed resource? It could be very useful. Thanks |
#6
|
||||
|
||||
getitemvar(obj item, num var)
Description: This returns the value of a FixedResource variable for the item. The var parameter should be either 1, 2, or 3. The FixedResource class allows sub-classes to keep up to 3 number variables on each flowitem. What these variables mean is dependent on the type of class. For example, a Processor uses variable 1 to store the time the item started its processing time, and variable 2 to store the item's processing time. If you are using the explicit FixedResource class as an object in your model, you can use this command, along with the setitemvar, getiteminvolved, and setiteminvolved commands, to store variables on the items the object receives. Example:getitemvar(first(current), 3) The command overview says that it is depending on the class of the object. In a processor it is in my eyes: var 1 = arrival time in processor var 2 = process time var 3= setup time By the way, the Visual Tool is using this information if you switch it to show the setup time or proecess time in a Processor: Display Object Stat Text: Current Process Time. But Carsten is right, would be nice to have an overview for all Fixed Resources, because I also did not find it in the manual.
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions." |
The Following User Says Thank You to Tom David For This Useful Post: | ||
Nico Zahn (11-06-2009) |
#7
|
||||
|
||||
To come back to the original point of the thread:
Wouldn´t this be the perfect application for the OnStateChangeTrigger? I think you just have to check if the state changes from conveying to blocked. If so, you found the situation you are looking for. This is just meant as a hint, no time for a demo model, sorry. Good luck! Ralf aka ralle |
Thread | Thread Starter | Forum | Replies | Last Post |
What is the difference between a Conveyor and Basic Conveyor | shivrash | Q&A | 2 | 07-21-2009 04:09 AM |
Setting Custom State | Francois Perron | Q&A | 1 | 04-06-2009 02:37 AM |
GUI State Graph | Anthony Timmiss | Q&A | 6 | 01-26-2009 02:30 AM |
State Waiting for Operator | Nico Zahn | Q&A | 6 | 01-15-2009 09:00 AM |
State files and global variables | Markus Bans | Q&A | 3 | 07-08-2008 12:22 PM |