SimEvents - Block Exit based on external status

3 views (last 30 days)
Marc Elpel
Marc Elpel on 26 Apr 2021
Answered: Altaïr on 24 Apr 2025
New to SimEvents. Trying to create a model that entities only exist a server when a combination of external events are ready. Example below:
  1. Assume there are 5 server stations A - E.
  2. Each station serves only one entity.
  3. Transfer between stations is via shuttle S.
  4. Time at any station is random.
  5. The order an item progresses is also random (may go from A-D-B-D-C... can reuse a station multiple times before completing).
  6. There is no queuing - If the shuttle is busy or destination is busy the item must remain where it is until the destination is available and shuttle available to get you there.
There appear to be methods to block the entity output. So far it is unclear how to tie this back to the destination and shuttle availability?
Related to this - If two services are blocked waiting on the shuttle which comes available, will it properly unblock one, process it, then unblock the other? For example if A is going to C and B also to C; both waiting on the shuttle, only one should be unblocked and moved - the other will be blocked first waiting on the shuttle, then because C is occupied (even though briefly both A & B blocking conditions cleared when the shuttle first came available).

Answers (1)

Altaïr
Altaïr on 24 Apr 2025
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'))

Categories

Find more on Discrete-Event Simulation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!