Flush Entities from a Queue-Server
This example shows how you can use a Discrete-Event Chart block to model a queue-server that can flush entities when it receives a message on the "FlushCmd" port.
The Discrete-Event Chart implements a single server with two states "Idle" and "Busy". The server is busy when an entity arrives at the IN port. It holds the entity in a local queue named "LocalQueue" until its service time expires. After this time the entity is forwarded out.
While serving an entity, if a "FlushCmd" command is received, it transitions to the "Flushing" state in which it iterates over its input queue and forwards each of its waiting entities out from the FLUSH output port. Additionally, it also forwards the entity that is currently being served in the LocalQueue.
The results show that a flush command was received at times 10 and 20 during the simulation. At these instants, all entities in the queue-server were flushed out.