When Simulink converts code, how is the simulation step size (reference sampling frequency) of the system handled, and what variables in the code are reflected in the amount r
Afficher commentaires plus anciens
When Simulink converts code, how is the simulation step size (reference sampling frequency) of the system handled, and what variables in the code are reflected in the amount related to the simulation step, and whether it can be individually found and modified
Réponses (1)
Manoj Mirge
le 21 Fév 2023
0 votes
Hi,
I am assuming that you want to inspect the code generated by Simulink Coder.
In that case if you have model named My_Model.slx and you have generated code using Simulink Coder. Then you can see the step time initialized in your code in the My_Model.c file.
The step time initialization statement will be in My_Model_initialize(void) function in My_Model.c file.
The step time will be stored in variable named My_Model_M->Timing.stepSize0. As it is initialized inline you can change the step time in your code manually. I am attaching image of the same below.
In the above example, I have generated code for Simulink model named My_Model.slx and I have set step size as 0.147 in My_Model.slx file by following below steps:
- In Simulink, go to MODELING tab.
- Open Configuration parameters dialogue box.
- Go to solver Tab
- Change Fixed-step Size field and specify your step size.
As you can see step size specified by me in Simulink model can be seen in the generated code.
Hope this will help you.
Catégories
En savoir plus sur Texas Instruments C2000 Processors dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!