TANGRAM-II allows the description of general models (that is it is not tailored for a particular application). As such it is important to be aware of how TANGRAM-II handles messages and events to proper construct a model.
Messages are executed in zero time, so one issue is the order they are executed. TANGRAM-II executes the messages in the order they are generated by the actions. When an event triggers the event may send messages to other objects. The action associated to each message received may in turn generate more messages and the process continues until there is no more messages to be executed. When a message is processed during an action is included in a list of messages to be executed. After all messages in an action are processed the list of pending messages is searched, the action corresponding to the first message is executed and possibly new messages are added at the tail of the list.
When the simulation starts, samples for all the enabled events are generated and included in the event list in increasing order of time to trigger. (We recall that the value of the state variables changes only after the action is completely processed, including the execution of all messages associated with the action.) Whenever an event is enabled, a sample is generated. If more than one event is enabled after the execution of an action, then samples for them are generated and included in the event list. Assume that one of the enabled events triggers and the new state reached (after the execution of the action associated with the event) is such that all the other enabled events remain enabled. The TANGRAM-II simulator does not regenerate new samples for the events that remain enabled. The samples remain in the event list until either they trigger, or the associated event is disabled. In the last case the disabled events are removed from the event list.
To illustrate the process, consider an M/M/1/k queue. Assume that there are packets in queue when at time a packet departs from the server. A new customer enters service and a new sample for the departure event is generated, say to trigger at time . Now assume a new customer arrives at . The new state after the arrival is and so the departure event scheduled to trigger at remains in the event queue, and and no new sample for the departure event is generated.
Although the behavior above handles most situations, there are cases when the user needs to re-sample an event after an action is executed even if the event remains enabled in the new state. Although the current version of the simulator does not allow the user to automatically ask for re-sampling an event this can be easily accomplished as follows. Assume that two events and of object need to be re-sampled after any action is executed. Add a state variable Flush with gets only 2 values:0 and 1 (true or false). Then: (a) duplicate events and (name the ``new'' events as and ; (b) add a condition for events and and for events and ; (c) whenever an event triggers and the user wants to re-sample events and , change the value of the state variable. Assume that and and are enabled. If an event triggers and changes value, and are disabled even if the other conditions are enabled. Therefore, the samples for and are removed from the event list, and new samples are generated for and , since they became enabled. Since all actions in and are identical to and , what was accomplished with was simply to re-sample the events. An example will be given in the example section in example .
The user is encouraged to use the debug option in the config (ModelSpecific) menu and follow the execution of messages and events.
TANGRAM-II also offers the user the capability of generate several samples of an event after an action is executed. This is called event cloning, see §.
Guilherme Dutra Gonzaga Jaime 2010-10-27