How to trigger a State Chart using multiple function calls?

9 vues (au cours des 30 derniers jours)
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.

Réponse acceptée

Deepu George Kurian
Deepu George Kurian le 10 Juil 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)

Plus de réponses (0)

Catégories

En savoir plus sur Simulink Functions dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by