Main Content

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.

Model using an Entity Generator, Entity Server, Entity Terminator and Simulink Function block

To open the example, seeCount Simultaneous Departures.

  1. In a new model, from the SimEvents®library, drag theEntity Generator,Entity Server,Entity Terminator, and万博1manbetx仿真软件的功能blocks. Add a Simulink®Scopeblock.

  2. Double-click theEntity Generatorblock.

    • In theEvent actionstab, to generate random attribute values, enter:

      entity.Attribute1=rand();
  3. Double-click theEntity Serverblock. In theMaintab:

    • In theCapacityparameter, enterinf.

    • For theService timeparameter, selectMATLAB action.

    • In theService time actionparameter, enter:

      dt = getServiceTime();
    • In theStatisticstab, selectNumber of entities departed, d.

  4. In the万博1manbetx仿真软件的功能block, add aRepeating Sequence Stairand define thegetServiceTimefunction.

    Inside the Simulink Function block including a Repeating Sequence Stair block. The Repeating Sequence Stair block window show the output values and sample time.

  5. Connect the blocks as shown and simulate the model. Observe that the scope displays simultaneous entity departures for the corresponding time.

    Scope block showing the entity departures

See Also

|||||||

Related Examples

More About