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

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

답변 (1개)

Manoj Mirge
Manoj Mirge 2023년 2월 21일
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.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by