SimEvents Common Design Patterns
The SimEvents® library provides design patterns that you can refer to while modeling. To access these patterns, open the SimEvents library and double-click the Design Patterns block.
Consider these design patterns while modeling:
Design Pattern | Description | Input Specifications | Output Specifications | Application |
---|---|---|---|---|
Entities with exponential random inter-generation times | Generates entities with random inter-generation times in exponential distribution fashion. | Not applicable | Structured entity with specified attributes | Model:
|
Service time from random distribution | Specifies waiting time in the Entity Server as a random number uniformly distributed from 0 through 1. | Any entity type | Inherited from the input | Model:
|
Extract attributes of entities as signals | Extracts one or more attributes of entities as signals. | A structured entity or bus object with specified attribute |
Extracted Attribute — Inherited from the input | Inspect or use a specific entity attribute |
Timestamp entities upon generation | Generates entities with an attribute TimeStamp that records the simulation time upon generation. | Not applicable | Structured entity with attributes | Use when generation time of entities is needed, for example, when calculating the priority in a combined scheduling algorithm. |
Release entity upon signal value change | Releases an incoming entity when there is a jump in the step function. | Any entity type | Inherited from the input | Use to control the passing of entities based on the change of a function. |
Open gate on service completion | Upon service completion, the gate opens and releases an entity. | Any entity type | Inherited from the input | Use task completion to trigger entity processing. |
Sense an entity passing from A to B and open a gate | Passing an entity from A to B opens the gate and releases an entity. | Any entity type | Inherited from the input | Use to model the passing of an entity in one route to control the passing of another route. |
Select an entity with a matching attribute | Select entities to advance whose specified attributes are matching the anonymous entity at the control port | A structured entity or bus object with a specified attribute | Inherited from the input | Select entities with a specified attribute to output |
Discrete Event Chart: Single Server with Pause | A Ctrl message triggers pause of service for the incoming entity. A second Ctrl message continues the service. Entity data conveys the service time. | Ctrl — Anonymous entity specifying the pause and resume Entity — Anonymous entity specifying service time | Inherited from the input | Use external events or signals to pause the service of entities. |
Discrete Event Chart: Single Server with Timeout | If the service time (which is random) exceeds the timeout limit specified by the entity data, the entity leaves the server. | Anonymous entity with specified timeout limit | Inherited from the input | Model:
|
Discrete Event Chart: Custom Output Switch | Randomly routes entities to one of the three output ports. | Anonymous entity | Inherited from the input | Implement a more complicated routing algorithm for an output switch. |
MATLAB Discrete Event System: Custom Generator | The Custom Generator block, defined using the MATLAB Discrete Event System block, is a basic entity generator. The generator block requires specification of generation period. | Not applicable | Anonymous entity | Implement a more complicated entity generator. |
MATLAB Discrete Event System: Custom Server | Custom Server block, defined using the MATLAB Discrete Event System block, is a basic entity server. The server block requires specification of server number and service time. | Any entity type | Inherited from the input | Implement a more complicated entity server. |
MATLAB Discrete Event System: Selection Queue | The Selection Queue block, defined using
the MATLAB Discrete Event System block, stores entities
of bus type | Key — Anonymous entity carrying the selection key IN — A structured entity or bus object with specified attribute | Inherit from IN | Select a specific entity to output from a queue. |
See Also
MATLAB Discrete-Event System | Discrete-Event Chart