Count Simultaneous Departures from a Server
This example shows how to count the simultaneous departures of entities from a server. Use thedoutput from theEntity Serverblock 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.
To open the example, seeCount Simultaneous Departures
.
In a new model, from the SimEvents®library, drag theEntity Generator,Entity Server,Entity Terminator, and万博1manbetx仿真软件的功能blocks. Add a Simulink®Scopeblock.
Double-click theEntity Generatorblock.
In theEvent actionstab, to generate random attribute values, enter:
entity.Attribute1=rand();
Double-click theEntity Serverblock. In theMaintab:
In theCapacityparameter, enter
inf
.For theService timeparameter, select
MATLAB action
.In theService time actionparameter, enter:
dt = getServiceTime();
In theStatisticstab, selectNumber of entities departed, d.
In the万博1manbetx仿真软件的功能block, add aRepeating Sequence Stairand define the
getServiceTime
function.Connect the blocks as shown and simulate the model. Observe that the scope displays simultaneous entity departures for the corresponding time.
See Also
Entity Generator|Entity Queue|Entity Server|Entity Terminator|Resource Acquirer|Entity Multicast|Entity Gate|Composite Entity Creator
Related Examples
- Generate Entities When Events Occur
- Specify Intergeneration Times for Entities
- Working with Entity Attributes and Entity Priorities
- Generate Multiple Entities at Time Zero
- Replicate Entities on Multiple Paths