SimEvents Control Entity Gate
2 views (last 30 days)
Show older comments
Hi all,
Within SimEvents I'm trying to model a system forwarding entities at a specified time by controlling an entity gate.
Up untill now, I haven't been succesfull trying several different approaches.
Basically, I'm sending an entity from the generator towards the enable gate, once the enable gate is not enabled (controlled by a step or signal editor) the entity may not be forwarded. Currently, the entity is being generated correctly but the control mechanism of the gate does not seem to work, in my idea the gate is always open.
Please see attached file.
Looking forward receiving your reply!
Kind regards,
Colin
2 Comments
Renato SL
on 27 Aug 2019
I'd like to help but my MATLAB version is R2017b. Can you provide the .slx file for version R2017b or below?
Accepted Answer
Renato SL
on 27 Aug 2019
You implemented the Entity Gate like this,
![ent_gate.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/235453/image.png)
Because you show the enable port, I found that the gate will be open once the enable port receives a positive signal (and will never close even though it receives 0 or negative value) and therefore as you put in the question, you think that "the gate is always open".
So I removed the enable port.
![ent_gate2.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/235454/image.png)
The description in the Entity Gate: "(1) Enable Gate opens when the control port receives a message with a positive value," so I believe that there is no need for an enable port to get the behaviour that you want.
I tested it and voila.
![ent_gate_result.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/235455/image.png)
So that's it.
Removing the enable port solved the problem.
PS.
I believe that is an appropriate result even though it seems not as the occurrence of entities are not in line with the time (first entity is not at t=1, second entity is not at t=2, third entity is not at t=4).
The reason for that is that Entity Generators in default are set to hold on to entities that cannot depart from the block. In this case the depart of entities is determined by the opening of the Entity Gate, so that in the plot:
- the first entity in the plot is actually the one generated at t=0 (the generate entity at simulation start tickbox in Entity Generator is ticked) and has just been released because the Entity Gate has just opened at that time
- the next entity is 1 time unit apart from the last departed entity (as period = 1 in the Entity Generator)
- the last entity was supposed to depart 1 time unit after the second one but it was blocked because the Entity Gate is closed. Therefore, it departs as soon as the Entity Gate opens (just before t=4)
0 Comments
More Answers (0)
See Also
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!