Multiple release criteria on entity selection gate

4 vues (au cours des 30 derniers jours)
Andrew
Andrew le 13 Juil 2022
Modifié(e) : Altaïr le 20 Fév 2025
Is it possible to have a selection release gate that lets an entity through if it's attribute matches any element in an array.
I.e I want entities with entity.att1 = 1 or 2 or 3 to pass through the gate
When i pass the array [1,2,3] i get an "error in port width or dimensions"
Any ideas or workarounds?

Réponses (1)

Altaïr
Altaïr le 20 Fév 2025
Modifié(e) : Altaïr le 20 Fév 2025
Hey @Andrew,
The Enable gate operating mode of the Entity Gate can be utilized to create a custom selection criterion. Here's an example: an entity is created with two attributes, each having a random integer value up to 10. The Entity Gate receives a logical true when the sum of these attribute values exceeds 10, else the Entity Gate1 receives a true. This selection condition is implemented using a MATLAB function block.
The getAttribute function is derived from the SimEvents common design patterns. More details can be found here: https://www.mathworks.com/help/releases/R2022a/simevents/gs/common-design-patterns.html
The attached image demonstrates that the entity passes through the Entity Gate if the selection condition is satisfied. Otherwise, it exits through Entity Gate1.
The corresponding Simulink file is attached for reference. A similar approach can be used to select entities based on any other custom selection condition.

Catégories

En savoir plus sur Discrete-Event Simulation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by