Event listening is primarily used for two purposes:
Whenever you are using one of the event listening tools, there are two fundamental questions that need to be answered:
In other words, you need both an object and event to set up an event-listening activity. These two requirements usually correlate with the properties on event listening tools.
You have a couple of different options when deciding which object to link to:
In general, there are two different types of events:
The event-listening activity will create and/or release a token whenever the activity you select occurs in the simulation model.
Standard, object-based events have specific parameters associated with them. These parameters contain basic information about the event, such as which flow item or token triggered the event. You'll usually want to preserve some of this information by putting it into a label that can be referenced by other process flow activities or by putting the value in a statistics collector's data table.
The best way to preserve this information is to use the Label Assignment or Label Matching table that is available in event listening tools. This table will be explained in more depth in the Label Matching topic.
Be aware that event-listening process flow activities have the ability to override the return value of events they listen to when they're used in a sub flow. For example, you may want to perform some complex logic using the Process Flow tool to define the process time of a processor, as illustrated in Process Flow Tutorial 3 - Sub Flows.
The method you will use to set up an event listening will depend on 1) which tool you are using and 2) the type of object you want to listen to.
To listen to events in the Process Flow tool, you'll need to use an event-listening activity. The two process flow activities that can listen for events are:
These two activities have properties where you can specify which which Object and Event that should be listened to:
The Statistics Collector creates a data table by listening to events, and then recording information about those events. For more information, see the Statistics Collector topic.
Before you can set up event-listening for a static object, make sure the object you want to listen has been added to your 3D model or process flow.
To set up event-listening for a static object:
You can set the object to be context-sensitive, meaning it will change based on certain
conditions. One way to do this is to use the
current keyword on any type of
process flow except general process flows. The event-listening activity will listen to the
object that is attached to each instance of that process flow. (See
Flow Instances for more information.)
Be aware that you cannot listen to a dynamic object on a general process flow. But the other three types of process flows have this ability.
Before setting up event-listening for a dynamic object, you might want to add at least one of the type of objects to which you will listen to the 3D model or process flow. Even though you won't link to this object directly, you'll need this object so that you can sample its events.
To set up event-listening for a dynamic object:
current, which is the default value for this property. If it says something else, click the arrow next to the Object box to open a menu. Select current (Instance Object) from the menu.
Before setting up event listening for a group, you need to first create the group. Make sure the group has at least one member. Even though you won't link to this object directly, you'll need this object so that you can sample its events.
To set up event listening for a group:
To listen to flow items or tokens, you'll need to create a dynamic reference to them on the event-listener. Before setting up event listening for a flow item, you need to add a source to your 3D model. Before setting up event listening for a token, you need to make sure the activity to which you want to listen has been added to the process flow.
Flow items have the following events:
|On Entering||Fired when the flow item enters a fixed resource or is loaded by a task executer object|
|On Exiting||Fired when the flow item exits a fixed resource or is unloaded by a task executer object.|
Tokens have the following events:
|On Entering||Fired when the token enters an activity|
|On Exiting||Fired when the token exits an activity.|
|On Manual Release||Fired when the token is manually released from an activity using the releasetoken() command|
|On Asset Allocated||Fired when the token allocates a shared asset. This may be acquiring a resource, entering a zone being pushed onto a list or creating a backorder when pulling from a list.|
|On Asset Deallocated||Fired when the token deallocates a shared asset. This may be releasing a resource, exiting a zone being pulled from a list, or completing a backorder.|
|On Label Value Change||Fired when a label value changes. This is only available if a label is stored as a tracked variable.|
To set up event listening for a flow item or token:
You can use the sampler to hover over objects in the Toolbox and select the desired event, or you can hover over the picklists in their properties windows to select one of these events.
You can listen to a statistical event on a 3D object or process flow activity. The process is the same as setting up a static event, except that you will choose a statistical event from the menu when you sample the object you are going to list to.
The following table gives examples of some of the most common statistical events:
|On Content Change||Fires when the number of flow items inside a fixed resources changes or when the number of tokens in an activity or zone changes|
|On Input/Output Change||Fires when a flow item enters or exits a fixed resource or when a token enters or exits an activity|
|On Staytime Change||Fires when a flow item exits a fixed resource or when a token exits an activity; this event will track different statistical information about how long the item or token remained at the activity|
|On State Change||Fires when an object changes states, such as from Idle to Processing|
|On Resource Available||Fires when a task executer has finished a task or task sequence|
After you've set up event listening to one of these events, you can further specify the statistical conditions that will trigger the event, as shown in the following table:
|Change||The event will be fired whenever the value changes at all.|
|Increase||The event will be fired whenever the value increases.|
|Decrease||The event will be fired whenever the value decreases.|
|Arrive At Value||The event will be fired whenever the value changes to a specific user-defined value.|
|Increase To Exact Value||The event will be fired whenever the value increases to a specific user-defined value.|
|Decrease To Exact Value||The event will be fired whenever the value decreases to a specific user-defined value.|
|Increase To Or Through Value||The event will be fired whenever the value changes from being less than a user-defined value, to being greater than or equal to that value.|
|Decrease To Or Through Value||The event will be fired whenever the value changes from being greater than a user-defined value, to being less than or equal to that value.|
|First Increase||The event will be fired whenever the value changes from decreasing to increasing.|
|First Decrease||The event will be fired whenever the value changes from increasing to decreasing.|
|Update||The event will be fired whenever the value is set, whether or not the value changes. This event is only available on the Statistics Collector.|
Some additional considerations: