Filter löschen
Filter löschen

How to trigger a State Chart using multiple function calls?

7 Ansichten (letzte 30 Tage)
I have a Stateflow Chart that has to be executed when either of my two/three function calls is made (I can alter the model to make sure only one function call happens at a time.)
From what I gathered till now from my online reading, a statechart can only have one input event port. So, I tried using a Mux (a Merge and a Bus Creator too) as suggested here. Might be because that functionality being discontinued in R2021a or so (I am not sure), I wasn't able to make it work still.
The test model image below describes the logic that I am trying to create.
Both the enabled subsystems just outputs a continuous function call throughout their active period.
The error I received from the above model:
Port width mismatch. Chart is expecting input events signal of length 1. The actual input events signal has length 2.
Component: Simulink | Category: Model error
Error occurred in 'test/Chart1'.
Component: Simulink | Category: Model error
NB: The model I am building is bound to be auto-converted into C code (Embedded Coder). So do mention if any of the stuff mentioned here or those in your solution affects that.

Akzeptierte Antwort

Deepu George Kurian
Deepu George Kurian am 10 Jul. 2021
Never mind. I just figured it out.
The Mux works fine, just as shown in the image or the link I shared before (in question description). I just had to define the required number of Input Events within the statechart; the same number as the number of function-calls connected through the Mux (previously I had defined only one). All of these input events will be taken from the same port, which could cause confusion (as it did in my case)

Weitere Antworten (0)

Kategorien

Mehr zu Simulink Functions finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by