Multiple release criteria on entity selection gate

4 visualizaciones (últimos 30 días)
Andrew
Andrew el 13 de Jul. de 2022
Editada: Altaïr el 20 de Feb. de 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?

Respuestas (1)

Altaïr
Altaïr el 20 de Feb. de 2025
Editada: Altaïr el 20 de Feb. de 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.

Categorías

Más información sobre Discrete-Event Simulation en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by