How to control entity forwarding with entity gate

1 visualización (últimos 30 días)
Aditi Gupta
Aditi Gupta el 25 de Oct. de 2019
Respondida: Renato SL el 30 de Oct. de 2019
I am trying to control entity forwarding from generator to server.I have put a compare to constant block between entitiy queue and entity server.
basicaly,I want if no. of entities in a queue are >=3 ten only entities should be forwarded to server else it should block on the queue itself.But this is not happenening.
  1 comentario
Renato SL
Renato SL el 30 de Oct. de 2019
If you haven't solved the issue, can you upload what you get in the Scope at the right side & the setting for the Entity Gate?

Iniciar sesión para comentar.

Respuesta aceptada

Renato SL
Renato SL el 30 de Oct. de 2019
I tried to recreate your issue, and I believe originally it happens for me too. I have 2 suggestions.
Suggestion 1: the Entity Server
In your screenshot, I see that the capacity of the Entity Server is 1 (inside the icon of the block), so the Entity Server will receive 1 entity, process it, push it out, then accept another entity, and so on.
=> Change the capacity of the Entity Server to inf or a large finite number so that this block will consume multiple entities at the same time.
Suggestion 2: the Entity Queue
By putting a Sequence Viewer, I observed that immediately after the size of the queue is equal to the compared value (in your case, it's 3), the Entity Gate will open and the Entity Queue will push 1 entitiy out. This is desirable. However, I found another issue.
It seems that the internal priority of the process of pushing entities out of Entity Queue is less than the priority of generation of entities (seen on the Sequence Viewer, screenshot below).
In my trial, this makes the Entity Queue receive 1 extra entity. In my trial, I put the value 5, but then for each output I would have 6 entities pushed out of the Queue.
entity_batch_sequence1.png
So, I put another Entity Gate at the beginning to act as a blocker for such undesired extra entities.
The screenshot is below. Please don't mind the scopes + To Workspace blocks. They are just for observations.
The Compare To Zero block ( <= 0 ) is used to flip the logic of the Compare To Constant block, so that it controls the closing of the Entity Gate in front.
entity_batch_model.png
So now you can see clearly that I put the value 5 for my trial.
Below is the observation from the Sequence Viewer:
entity_batch_sequence2.png
Now, after every 5 entities, the Entity Queue will push all 5 entities out before allowing new entities to enter.
=> So that's it. If you encounter similar issue, then I suggest you do the same. Put another Entity Gate before the queue.
Conclusion
I think if you need to do both of these suggestions. I tried to do only the first one, but then I observe the next problem so in the end I do both things.
Comments:
If this question is related to your other question about varying the capacity of Entity Batch Creator, then I have tried to address that as well by trying to make the value for the Compare To Constant block change through time, I have not found anything useful. I assumed a Repeating Ladder Sequence will be enough, but it was not the case.
For the moment I have no other ideas and I don't really have a lot of time to try things, so good luck on that.

Más respuestas (0)

Categorías

Más información sobre Messages 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