Controlling the release of entities based on specific conditions can be accomplished using an Entity Gate block. By setting the Operating mode to "Release gate" in the block parameters, one pending entity is allowed to advance for each anonymous entity or message that arrives on the control port. At other times, the entity input port remains unavailable. Additional details on the Entity Gate block can be found with the following command:
web(fullfile(docroot, 'simevents/ref/entitygate.html'))
For scenarios involving random routing of entities between servers, the Custom Output Switch from the SimEvents Common Design Patterns can be explored. More information is available here:
web(fullfile(docroot, 'simevents/gs/common-design-patterns.html'))
The Custom Output Switch chart enables the implementation of advanced routing algorithms beyond what the Entity Output Switch offers. By default, this chart randomly directs entities to one of three output ports, but it can be adapted for five outputs or more complex routing logic as needed.
Entities arriving from five servers can be managed using an Entity Queue or a Selection Queue (also available in the SimEvents Common Design Patterns). These queues can temporarily store entities, and the Custom Output Switch can then reroute them to one of the servers at random.
If there is specific termination logic for entities, it can be incorporated into the Custom Output Switch as well. The Custom Output Switch processes and forwards one entity at a time, ensuring that if multiple entities are waiting to be routed to the same destination, only one proceeds while the others are processed sequentially.
For further examples related to routing, the following resources may be helpful:
- Distributing Multi-Class Jobs to Service Stations:
web(fullfile(docroot, 'simevents/ug/distributing-multi-class-jobs-to-service-stations.html'))
- Route Vehicles Using an Entity Output Switch Block:
web(fullfile(docroot, 'simevents/ug/route-vehicles-in-a-gas-station-by-controlling-entity-output-switch-block.html'))