Entity Output Switch changes results based on output label
Afficher commentaires plus anciens
Hello,
I have a SimEvents model with an Entity Output Switch with two outputs, called 1:"OUTPT" and 2:"OUTPI" that go to different parts of the model. I have the switching behaviour of the switch set to "First port that is not blocked" with the idea that entities will be released to the first path which can accept them independent of the number or order of the outputs. I found my model gives very different output if i change which output is attached to 1 and which is attached to 2 in the image below Shouldn't this switching criteria guarantee symmetry of outputs? What could account for this behaviour?

1 commentaire
Ben Freedman
le 14 Fév 2022
Réponses (1)
Altaïr
le 3 Jan 2025
0 votes
The First port that is not blocked switching criterion indeed causes the Entity Output Switch to select the last active port unless it's blocked. An alternative approach would be to use the Round robin or Equiprobable switching criteria.
Round robin is ideal when the throughput rates of the downstream lanes are similar, though it might lead to large waiting times if they aren't. Equiprobable is suitable if the entity generation rate and downstream throughput rates are time varying.
Additionally, here's an example for port selection based on the availability of downstream lanes.
The Custom Switch selects the available lane when only one is available, otherwise using Round robin to alternate between lanes.
The logic for choosing the corresponding output port is implemented using a Simulink Function block.
The corresponding Simulink model is attached for reference. For more details, please refer to the following documentation pages:
- Switching Criterion - https://www.mathworks.com/help/releases/R2021b/simevents/ref/entityoutputswitch.html#mw_3b33800e-6af8-4223-b3cc-a1d1e0e2b187
- Simulink Function Block - https://www.mathworks.com/help/releases/R2021b/simulink/slref/simulinkfunction.html
I believe this will assist you!
Catégories
En savoir plus sur Discrete-Event Simulation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!