Why aren't my Simulink functions being called properly when using nested Simulink functions, Stateflow charts, and Data Store blocks?

6 ビュー (過去 30 日間)
I used three subsystems: one subsystem contains a Stateflow chart, which includes the state. The other two subsystems contain Simulink functions, each with its own Stateflow block. I am using nested Simulink functions, and I am calling them through Stateflow. Additionally, I used Data Store blocks, but the Simulink functions are not being called properly. why? what is the reason anyone help me on that ?

回答 (1 件)

Charu
Charu 2025 年 2 月 19 日
編集済み: Charu 2025 年 2 月 19 日
Hello Kathirvel,
When dealing with Simulink functions in a Stateflow chart, especially when using nested Simulink functions and Data Store blocks, there are several potential areas that can be investigated:
-Ensure that the Data Store blocks are correctly configured and accessible by all relevant subsystems.
-Verify that the variable names used in the Data Store Read and Write blocks match those defined in the Data Store Memory block.
-Simulink functions should be defined in a way that makes them accessible from the Stateflow chart. If they are nested, ensure that their scope allows for external calls.
-Check that the function prototypes in Stateflow match those defined in the Simulink functions.
-Ensure that the Stateflow chart's execution order is correct and allows for the functions to be called in the intended sequence.
-Additionally, ensure that the data types of inputs and outputs in the Simulink functions match those expected by the Stateflow chart.
By addressing these areas, you can help ensure that your Simulink functions are called correctly, and your model operates as intended.
Hope this helps!
<Additional>
To know more about Stateflow functions you can refer to the Stateflow Onramp Course:
  1 件のコメント
KATHIRVEL
KATHIRVEL 2025 年 2 月 19 日
Hi @Charu, thank you for answering me. I have attached my models and .slx file. While debugging the model, it's calling the function in Stateflow, but it only reaches the first state and doesn't return anything. Please see through the snippets for details.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by