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
|
||||
|
||||
Queue Sorting
Quote:
__________________
Jeff Flexsim Support |
#2
|
||||
|
||||
Quote:
Thanks. Alan |
#3
|
||||
|
||||
Quote:
__________________
Jeff Flexsim Support |
#4
|
||||
|
||||
I was reading the section of "FixedResource" in the manual. It is really helpful to clarify issues when you see something wrong in the model. A clear image of the FixedResource logic is a must if you want to dynamically control the flows using code.
Something is not so clear in the flow chart. 1. What is the initial state of those ports? The chart only has steps of opening ports, but not closing ports. When those ports are closed in the logic? Cliff mentioned in the above post: "...In other words, a flowitem enters an FR, the input ports are closed, an event is created and put into the future event list, when the event fires the inputs are reopened...". Does this mean the input ports of an FR are closed once a flowitem enters it? What about the output ports of the upstream objects? 2. How many FixedResource are involved in the flow chart? 3 or 2? 3. Where is the point that the event is created mentioned in the Cliff's comments. 4. What determines when an upstream item gets released? Hope by discussing, more people will have better understanding of how Flexsim objects works. Thanks. Alan |
#5
|
||||
|
||||
Alan,
The documentation in the users manual is fairly comprehensive and detailed. I hope I can clear up your questions. 1. The initial state of all ports is open unless closed by the modeler. The documentation covers the opening of ports because the output port is always open unless closed by the modeler. Not all FRs are exactly the same. The queue is a good example of that. For our conversations sake, we will say that the FR we are talking about is a processor. The input ports are closed when a flowitem enters so no other flowitem can enter. This, of course is only true if the capacity of the processor is 1. The input port stays closed until the flowitem leaves through the output port. At that point the processor is ready to receive another flowitem and the input ports are opened. The output port of the upstream object remain open. But if there is a flowitem in the upstream object that is ready to leave, the status of the upstream object will be "blocked". 2. The chart itself references only one object. It may make references to some condition on an upstream object but the flow chart itself is of one object. 3. I think I probably covered this one in item 1. 4. A flowitem will be released from an object when it has a flowitem that is ready to leave and a downstream object that is ready to receive it. I hope that covers it?
__________________
Jeff Flexsim Support |
The Following 2 Users Say Thank You to Jeff Nordgren For This Useful Post: | ||
Cliff King (05-20-2008) |
#6
|
||||
|
||||
Jeff,
Thanks for your answer. One small thing remains. I assume that in the chart, the first opening of ports means input ports, while the second means output ports. So if the output ports are always open, why need to open it after "Call Sendto function"? Alan |
#7
|
||||
|
||||
Alan,
If you look at the shaded section of the chart on the left, it tells you that the first one is input ports and the second one is output ports. I guess I was answering the question from the modelers view and not the programmers view. From the programmers view (internally) the output ports do need to be opened. But from a modeler view, having no control over the internal stuff, the output port is always open unless the modeler closes it. In the normal flow of things the output port (modelers view) is always open unless you close it. So I guess it just depends on what view you choose to look at it.
__________________
Jeff Flexsim Support |
#8
|
||||
|
||||
Jeff,
Again, thank you very much! You've been very responsive and helpful. Best Regards, Alan |
The Following User Says Thank You to AlanZhang For This Useful Post: | ||
Jeff Nordgren (05-16-2008) |
#9
|
||||
|
||||
Problem with closing input port of a queue at entry
Jeff,
I have been trying to follow your guideline of Quote:
What I want in this simplified model is:
Can this be explained with the quote from Cliff you posted before: Quote:
|
#10
|
||||
|
||||
Goksin,
You may have found a minor "exception" to my rule. The queue is a little bit of a different animal. However the same rule can be applied if you use the "NoDelay" on the message you send in the OnEntry trigger of the queue. So if you change the Delay time to "NoDelay" instead of 0, it should work as you would expect it to.
__________________
Jeff Flexsim Support |
#11
|
||||
|
||||
The following rule is not as hard and fast as it seems:
"You should NEVER, repeat NEVER open or close input/output ports in the OnEntry or OnExit triggers." I think is more appropriately a guidline that should not be crossed without extreme caution. I have found that in most instances I can close input and output ports on entry and exit without any problems. I have not had as much luck with opening ports. With this in mind I still would not recommend that a user do this without first trying to do it another way. The case Goksin mentions where he is using a queue as a gate and he has another flowitem sneaking in before he can close the input port with a message is a case where that should be done on the entry trigger. However, if he tries to also include code that opens the output ports he could run into some serious problems. The bottom line is that if you are going to break the rule you need to make sure that you test, validate, and debug your model at the highest level and after that you will still need to keep that situation in the back of your mind as a potential cause for later problems. And always remember that nobody will be very happy with you if you conciously break the rule and then ask for help later because breaking the rule has caused you problems. If you're going to break the rules, break them responsibly! Brandon
__________________
thats not normal. |
The Following User Says Thank You to Brandon Peterson For This Useful Post: | ||
Goksin Yilmaz (05-19-2008) |
#12
|
||||
|
||||
When is there ever a problem with closing a port in the entry/exit trigger? I can only think of problems with opening them...
|
#13
|
||||
|
||||
Please don't break and drive!
__________________
Jeff Flexsim Support |