Transition from one Sub State to Another State

3 visualizaciones (últimos 30 días)
Rithik
Rithik el 20 de Oct. de 2022
Respondida: Purvaja el 3 de Abr. de 2025
Hi All
I have two States
State A and State B
In State A there is one more State A1
In State B there are two more Sub State State B1 and B2
Output of B1 State has two values say x=2,x=3
When x=2 it Will transition to B2,
But When x=3 it should transition to State A1,
PLease can anyone tell which condition to add to transition to State A1
  1 comentario
Muthukumar Ganesan
Muthukumar Ganesan el 25 de Oct. de 2022
Hi,
There is an ambiguity in your question. What do you refer by output of State B1 ?
Please clarify to help you better
Thanks

Iniciar sesión para comentar.

Respuestas (1)

Purvaja
Purvaja el 3 de Abr. de 2025
Hey @Rithik,
I see that you want to change states with certain conditions. Transition from a sub state in a state to another sub state in another state will be similar to transition from a sub state to another sub state within same state. So, therefore we can simply use transition condition on transition arrows to change sub-states.
I have created the following dummy model as per the requirements given in question. There are 2 states “A” and “B”, with sub states, “A1”,”B1”,“B2” accordingly. State B1 inside state B has default transition, that uses the input given to the entire stateflow chart. There is an if-else condition that produces output x based on the input fed to the stateflow chart. And hence based on this output next state is determined.
Refer to the below diagrams for a better clarifications on the stateflow chart and how the result is achieved:
  • Simulink Model consisting of dummy signals, showing input and output of “Stateflow” block:
  • Stateflow diagram indicating states and sub-states, along with transition conditions:
For more information, kindly refer to the following MathWorks documentations:
  1. Stateflow: https://www.mathworks.com/help/stateflow/getting-started.html
  2. Transition Between operating modes: https://www.mathworks.com/help/stateflow/ug/transitions.html
To access the documentation for the MATLAB release you are using, please execute the following command in the MATLAB command window:
web(fullfile(docroot, 'stateflow/getting-started.html'))
web(fullfile(docroot, 'stateflow/ug/transitions.html'))
Hope this helps!

Categorías

Más información sobre Decision Logic en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by