MATLAB Answers

0

Code generated by Simulink Embedded Coder runs slower as more coded added, why?

Asked by Canberk Suat Gurel on 6 May 2018
Latest activity Answered by Venkatesh Chilapur on 29 May 2018
Hi all,
I am using Simulink Embedded Coder to program my TI LAUNCHXL-F28379D C2000 microcontroller. My code consists of 3 main sections: sensing (echolocation), processing (filtering etc.), and action (motor control). I have tested all of these codes individually before I combined them all together. Once they are merged in the same model I realized that the code started running slower. More interestingly, the mode code I add, the slower it gets. I tried to open the code as a CCS (Code Composer Studio) project and programmed the robot using CCS but that didn't help anything. I am using MATLAB 2017b. The attached .txt file contains the output of the ver command.
Is this a known issue? How can I ameliorate this issue?
Thanks!

  0 Comments

Sign in to comment.

1 Answer

Answer by Venkatesh Chilapur on 29 May 2018

Hi,
If the execution time is larger than the sample time, we are in an overrun situation. We want to keep the execution time below the sample time to make sure that you are fully in control of the behavior of the program. In case of an overrun, our scheduler will skip the next instance of the task. For example if a task is scheduled at 50µs and constantly takes 65µs to execute, you will see this task scheduled at 100µs as we will always skip one execution every cycle. If the task takes 125µs to execute, it will run every 150µs as we will skip twice every cycle, and so on... Better to make sure that we are in control of the sample time and we don't have overruns.
Regards,
Venkatesh C

  0 Comments

Sign in to comment.