Effacer les filtres
Effacer les filtres

Speed of Sfunction builder in Simulink

2 vues (au cours des 30 derniers jours)
gdz
gdz le 7 Fév 2023
Modifié(e) : Fangjun Jiang le 8 Fév 2023
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.

Réponse acceptée

Fangjun Jiang
Fangjun Jiang le 8 Fév 2023
Modifié(e) : Fangjun Jiang le 8 Fév 2023
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.

Plus de réponses (0)

Catégories

En savoir plus sur Block and Blockset Authoring dans Help Center et File Exchange

Tags

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by