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
|
||||
|
||||
releaseitem command
When I call releaseitem command, is there any internal state associated with this item changed? I find it will cause big problem if I call releaseitem twice when a transportor is used. The transportor will get two task sequences for the same item. The Flexsim will crash when the transportor is not able to load the item when it arrives at the position the second time. More specifically, my question is, can I use some internal variable to tell if the item has been released, or I have to implement my own?
Thanks. Alan |
#2
|
||||
|
||||
You should not call releaseitem() on an item that has already been released (and if you're in a regular object like a Processor and use releaseitem(), you should make sure that the item is not released again by the Processor's normal releasing mechanism. You might accomplish this by destroying the Processor's events, but it is dependent on the point at which you want to do it, and it's not really encouraged to completely override a regular object's normal mechanism). To query whether an item is already released, use getitemstate(). If it's released, it will have either the FRSTATE_READY or FRSTART_MOVEREQUESTED state. You can call holditem() to "unrelease" an item, but you should only use holditem() when it is in the FRSTATE_READY state, and not in either of the other two states. Also refer to the FixedResource object's documentation in the user manual for a detailed description of the steps and states a flowitem goes through in a FixedResource.
|
#3
|
||||
|
||||
Hi Alan,
I encountered the same problem somewhere and what I did was simply an if statement in the request transport from trigger just before I made the tasksequence. In the if statement I checked if this tasksequence was already created and if so I used "return 0" to get out of the trigger. I actually used a label to check if I already released the item, but with Anthony's answer you could do that easier. It is not the most neat way of doing things but it worked. Regards, Steven |
#4
|
||||
|
||||
Thanks both of you for the suggestions. I guess the command getitemstate is what I need. Otherwise, I have to implement my own like what Steven did.
Anthony's explanation should be put into Flexsim user manual or Flexsim command help. Since releaseitem, holditem, and getitemstate these command are related and typically used together, adding a "See Also" section for each command in the command help will be really useful. Regards, Alan |