In a discrete-event simulation, an event is an observation of an instantaneous incident that may change a state variable, an output, and/or the occurrence of other events. Events can correspond to changes in the state of an entity.
Specify event actions based on entity status. A typical event sequence in a SimEvents® model is:
The generation of an entity.
The advancement of an entity from an Entity Generator block to an Entity Server block.
The completion of service on an entity in a server.
The exit of an entity from one Entity Server block to an Entity Terminator block.
The destruction of an entity.
Events do not have a graphical representation. However, you can associate actions
with events. The SimEvents software maintains an event calendar to schedule events. For more
information about observing the event calendar, see Debug SimEvents Models. You can also interact with the event
calendar using simevents.SimulationObserver
methods. You can create a custom event observer using this class and its methods.
For more information, see Use SimulationObserver Class to Monitor a SimEvents Model.
SimEvents lets you create custom actions to happen when an event occurs for an entity. Every event can have a corresponding action. You can write actions for many events using MATLAB® code or Simulink Functions. For more information, see Events and Event Actions.
SimEvents lets you select from a list of statistical distributions that generate template code for simulating stochastic event actions. Also, you can automatically generate MATLAB code that allows for simulating repeated sequences of event actions.
Open a new model and add the Entity server block from the
SimEvents library.
In the block dialog box, from the Insert pattern
list, select Repeating sequence
or
Random number
if you want to insert event
action code from a template.
Repeating sequence
allows you to:
Fix the sequence by settingSequence
value
Select a Output after the final
value of the sequence
toRepeat
, Set to
zero
, or Set to
infinity
Select a variable to Assign output to
Random number
allows you to:
Provide an initial value to the random generator
engine by setting the Seed
Select Distribution to select from a list of statistical distributions
Select a variable to Assign output to
Code is automatically generated in the block dialog box
Discrete Event Chart | Entity Generator | Entity Queue | Entity Server | Entity Terminator | MATLAB Discrete Event System | Multicast Receive Queue | Resource Acquirer