Filter löschen
Filter löschen

Stateflow Triggerring Entities Matching and Releasing

1 Ansicht (letzte 30 Tage)
Chate
Chate am 5 Dez. 2012
Hi,
I am trying to model an event where the arrival of entity will look for another entity. For example: when a book arrive it looks for an empty box to be stored, and vice versa; if the box arrive, it will look for the book. If they cannot find their partner upon arrival, they will wait in their queues.
How should I use stateflow to model this type of event triggering where arriving entity will look for its partner (that is waiting in queue). And if it does not find its partner, it will then join a queue and wait until its partner arrive (in which case the partner entity will come look for it).
So far, I think I need to send a signal to stateflow whenever an entity arrive. But I am not sure how to write the code/algorithm in stateflow so that the entities will look for each other. Do I use if-else statement to look for the number of entities waiting in queue? And how will stateflow send out signals to release gate for the awaiting entity in the queues?
Thanks!

Antworten (1)

Chetan Rawal
Chetan Rawal am 20 Dez. 2012
SimEvents is best suited for this kind of task. You can use attributes with entities to set up entity matches, and processing priority for a "Priority Queue" block to process the queue.

Kategorien

Mehr zu Messages finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by