Stateflow messages and events
Mostrar comentarios más antiguos
I'm using stateflow for a state machine. I know that in state flow there are messages and events. With the first one I can associate a data but I can send the message only with the send(M) so I can't specify which state will receive the message M. Instead, if I use an event I can send this to a specific state with send(event,state) but I can't associate a data to the event. I need a kind of fusion between event and messages. I need to send a data in a particular state of the chart. I won't create a lot of messages like M1, M2 and so on. I ask this because i need that a message from a state 1 must be different form a message from state 2 but they must have the same name. So if the message has value 1 it comes from the state 1 and so on. Sorry for my bad english
Respuestas (2)
Harsha Priya Daggubati
el 27 de Mzo. de 2020
Editada: Harsha Priya Daggubati
el 27 de Mzo. de 2020
0 votos
Hi,
As per my understanding, you can attach a key (which can be distinct based on sender) to the message you intend to send, and can check for it at the receiver end. This might help you:
1 comentario
ANDREA DI MARTINO
el 27 de Mzo. de 2020
Harsha Priya Daggubati
el 27 de Mzo. de 2020
Editada: Harsha Priya Daggubati
el 27 de Mzo. de 2020
0 votos
By the following statement, 'I send a message from a state S1 like M.data =1 and send(M). The problem is that the state S1 recieve the same message that he sent', do you mean that the message is being received by the same state from which it is sent? But it is expected as 'send' broadcasts the message.
4 comentarios
ANDREA DI MARTINO
el 27 de Mzo. de 2020
Harsha Priya Daggubati
el 27 de Mzo. de 2020
Editada: Harsha Priya Daggubati
el 27 de Mzo. de 2020
I guess as of now, you couldnot send any data with event. You only have to use message for sending data and it cannot be directed to a particular state as of now.
ANDREA DI MARTINO
el 27 de Mzo. de 2020
ANDREA DI MARTINO
el 30 de Mzo. de 2020
Categorías
Más información sobre Decision Logic en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!