Multiple release criteria on entity selection gate

2 views (last 30 days)
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?

Answers (1)

Altaïr
Altaïr on 20 Feb 2025
Edited: Altaïr on 20 Feb 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.

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!