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 10-26-2009
zhang xin zhang xin is offline
Flexsim User
 
Join Date: Dec 2008
Location: China
Posts: 136
Downloads: 147
Uploads: 0
Thanks: 81
Thanked 6 Times in 6 Posts
Rep Power: 150
zhang xin is on a distinguished road
Default 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  
Old 10-27-2009
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

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  
Old 10-27-2009
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

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)
  #4  
Old 10-31-2009
zhang xin zhang xin is offline
Flexsim User
 
Join Date: Dec 2008
Location: China
Posts: 136
Downloads: 147
Uploads: 0
Thanks: 81
Thanked 6 Times in 6 Posts
Rep Power: 150
zhang xin is on a distinguished road
Default

An additional problem, how to determine how many items are blocked when there are still items moving on this conveyor?
  #5  
Old 11-02-2009
Carsten Seehafer's Avatar
Carsten Seehafer Carsten Seehafer is offline
FlexSim Geek
 
Join Date: Oct 2008
Location: Ritterhude, Deutschland
Posts: 230
Downloads: 45
Uploads: 1
Thanks: 474
Thanked 320 Times in 143 Posts
Rep Power: 379
Carsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud of
Default

Quote:
Originally Posted by Brandon Peterson View Post
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. ...
Brandon,

do you have a list of all 3 item variables for each fixed resource? It could be very useful.

Thanks
  #6  
Old 11-02-2009
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

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  
Old 11-03-2009
RalfGruber's Avatar
RalfGruber RalfGruber is offline
FlexSim Software Products
 
Join Date: Jul 2007
Location: Orem, UT, USA
Posts: 195
Downloads: 37
Uploads: 0
Thanks: 518
Thanked 294 Times in 124 Posts
Rep Power: 345
RalfGruber is a splendid one to beholdRalfGruber is a splendid one to beholdRalfGruber is a splendid one to beholdRalfGruber is a splendid one to beholdRalfGruber is a splendid one to beholdRalfGruber is a splendid one to beholdRalfGruber is a splendid one to behold
Default

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


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.