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

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

Réponses (1)

Charu
Charu le 19 Fév 2025
Modifié(e) : Charu le 19 Fév 2025
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 commentaire
KATHIRVEL
KATHIRVEL le 19 Fév 2025
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.

Connectez-vous pour commenter.

Catégories

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

Produits


Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by