필터 지우기
필터 지우기

Speed of Sfunction builder in Simulink

조회 수: 2 (최근 30일)
gdz
gdz 2023년 2월 7일
편집: Fangjun Jiang 2023년 2월 8일
Hi,
I have a S-function builder in Simulink, which reading and delopy data from/to arduino. I have also set the Fixed-step time(Fundamental sample time) to 0.1s. I would like to know what is the processing speed that executed the S-function. Is it equal to the sample time? If it is equal to the sample time, what is the minumum sample time I could set?
Thank you.

채택된 답변

Fangjun Jiang
Fangjun Jiang 2023년 2월 8일
편집: Fangjun Jiang 2023년 2월 8일
The execution time of the S-function depends on the processing task and the CPU. Generally, more complex task, more time. More powerful CPU, less time.
In simulation, it doesn't really matter. It could take 1 second to finish the task, and then the simulation moves to the next 0.1 time step. There is no constrain between the sample time and processing time. The speed of the simulation calculation could be faster or slower than the simulation clock. You can use Simulink Profiler to find out the processing time of each block.
In real-time simulation/execution involving hardware, of course, the processing time needs to be smaller (preferably quite smaller) than the sample time. Use the tools supplied by the hardware (arduino, dSPACE RTI, etc.) to find out the worst case execution time and then decide the proper sample time. Some system may report an "overrun" flag if execution time is longer than the sample time. The processing time could vary due to some processing being conditionally executed. So make sure to exercise the worst case processing.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Block and Blockset Authoring에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by