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
|
|||
|
|||
TE and TS learning?
TE and TS is great in flexsim, but hard to learn for me. I want to learn more about it.
In the mannual, in the TASKTYPE_SENDMESSAGE section, it says: You might think that delayed message sending is a bit redundant, because if you want to send a delayed message, why not insert a delay task followed by a regular send message task. There is a subtle difference. Say, for example, you want the TaskExecuter to wait until a certain number of requirements are met, and the only way you can check those requirements is by executing code. The way that you would do this is, when the TaskExecuter gets to the point where he needs to wait for the requirements to be met, he sends a message to some object, and then either does a utilize task, or a stop request begin task. When the other object gets the message, he is responsible for checking if the requirements are met. If they are already met, then he is to immediately call resumeobject() or freeoperators() on the TaskExecuter. Otherwise he must wait until the requirements are met, and then call resumeobject() or freeoperators(). A problem arises, however, when the requirements are already met and he can immediately allow the TaskExecuter to continue. If the message has been sent immediately, then the TaskExecuter hasn't started the utilize of stoprequestbegin task yet. He is still working on the send message task. So the other object can't immediately call freeoperators() or resumeobject() because he must wait until the TaskExecuter finishes the send message task, and goes on to the utilize or stop request begin. Sending a delayed message in 0 time allows the TaskExecuter to do exactly that, and thus allow the other object to immediately free him if the requirements are met. I hope someone to provide a model example to help those like me to understand the above description. Thanks |
#2
|
||||
|
||||
Qin Tian,
Your question has more to do with messages than it does with task sequences. The section that you quoted from is for the 4th variable for TASKTYPE_SENDMESSAGE. What this is saying is that all messages by default will be sent as normal messages with no delay. If you want a delayed message then you need to enter a value for the delay or a -1 for a delay of 0. Normally it is fine to send a message with no delay (beneficial even). However, if there is code that needs to be executed after the send message function call but before the message gets recieved then you need to use a delayed message with a delay time of zero. This ensures that the message happens as a seperate event at the same simulation time instead of happening as part of the current event. I hope that this has answered your question. If you have more questions or need more detail let us know. Brandon
__________________
thats not normal. |
The Following User Says Thank You to Brandon Peterson For This Useful Post: | ||
qin tian (06-01-2008) |
#3
|
||||
|
||||
Qian Tian,
Your question is better understood with an example. As Brandon pointed out, the question is more about the difference between sendmessage and senddelayedmessage with 0 delay time. I made a simple example to illustrate the difference. To understand the difference, you have to think about the way that the discrete event simulation works.
I have to say that the difference of the two is very subtle. And to figure out when to use which is even more subtle. But I guess the example illustrate the main difference of the two. And it is up to you to choose the right one according to the different circumstance.
__________________
Best, Alan |
The Following User Says Thank You to AlanZhang For This Useful Post: | ||
qin tian (06-01-2008) |
#5
|
||||
|
||||
Qin Tian,
When you send a delayed message with the senddelayedmessage command you should use a 0 to denote that you want the message to happen in zero time. In contrast when you send a message using a task sequence you need to use a -1 to denote that you want the message to happen as a seperate event but in zero simulation time, this would be the same as saying senddelayedmessage with a 0. If you use a 0 in the sendmessage task sequence the message will occur immediately and not as a seperate event, this is the equivelant of using the sendmessage command. Brandon
__________________
thats not normal. |
The Following 4 Users Say Thank You to Brandon Peterson For This Useful Post: | ||
Tom David (06-02-2008) |
#6
|
||||
|
||||
sendmessage- 'fromobject' parameter
Hello,
I would like to use a "sendmessage" command in my user-event, but do not want to reference an object which sends the message, because the message doesn't depend on a condition fulfilled by another object, i.e. the message is not occurence-based but time-based. Is it possible to leave out the 'fromobject' parameter in that command? If not, how can I send a message to an object after other sequences of commands in a user-event are completed? Thanks. |
#7
|
||||
|
||||
Yasemin,
The oject put in the from object field is referenced by the msgsendingobject variable in the message trigger, it's not used for anything else. So, you can put a pointer to any object or node in that field that you would want to have a reference to in the message trigger. If you absolutely want the field to be blank then you can always use NULL. Good Luck, Brandon
__________________
thats not normal. |
The Following 2 Users Say Thank You to Brandon Peterson For This Useful Post: | ||
Yasemin Vatandas (08-07-2008) |