필터 지우기
필터 지우기

How to trigger a State Chart using multiple function calls?

조회 수: 7 (최근 30일)
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.

채택된 답변

Deepu George Kurian
Deepu George Kurian 2021년 7월 10일
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)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by