This example shows how to count the simultaneous departures of entities from a server. Use the d output from the Entity Server block to learn how many entities have departed (or arrived at) the block. The output signal also indicates when departures occurred. This method of counting is cumulative throughout the simulation.
In a new model, from the SimEvents® library, drag the Entity Generator, Entity Server, Entity Terminator, Simulink Function, and Scope blocks.
Double-click the Entity Generator block.
In the Event actions tab, to generate random attribute values, enter:
Double-click the Entity Server block. In the Main tab:
In the Capacity parameter, enter
For the Service time parameter,
In the Service time action parameter, enter:
dt = getServiceTime();
In the Statistics tab, select Number of entities departed, d.
In the Simulink Function block, define
Connect the blocks as shown and simulate the model.
Composite Entity Creator | Composite Entity Splitter | Discrete Event Chart | Entity Gate | Entity Generator | Entity Input Switch | Entity Multicast | Entity Output Switch | Entity Queue | Entity Replicator | Entity Server | Entity Terminator | MATLAB Discrete Event System | Multicast Receive Queue | Resource Acquirer | Resource Pool | Resource Releaser