Impact-Site-Verification: dbe48ff9-4514-40fe-8cc0-70131430799e

Search This Blog

Basics of Code Generation - MATLAB and Simulink Racing Lounge

Spend more time on algorithm development and less time manually producing code.  With the click of a button, you can bring algorithms to C/C++ code and hardware with code generation. Christoph Hahn and Application Engineer Andreas Uschold, both of MathWorks, walk through the basics of code generation and the tools available to simplify and speed up the process.
Code generation tools are a great alternative to manual coding, which is time consuming and error prone. There is a benefit to having the entire process in one tool chain where, for example, an electrical Formula Student team developing vehicle dynamics controllers, such as torque vectoring, can bring it to its CPU as quickly as possible.
Andreas depicts a typical industry workflow for code generation using the Design V, which is a design workflow used by many automotive companies. Looking at this in Simulink®, the example shown is a typical, closed-loop control system with a controller and a piece of hardware you want to control. To generate code out of the system, you simply press a button in MATLAB® and Simulink and get C/C++ code. The generated code complies with the ANSI ISO C standard and is as readable as good manual generated C code.

Having the code does not mean it is running on the hardware so Andreas then gives an overview of hardware support packages and their benefits. Hardware support packages are available for different hardware platforms and enable you to embed and deploy your code.
Ultimately, Model-Based Design helps detect bugs early and speeds up the development process. This is a great overview of code generation and we will go into the individual steps in more detail in future episodes.

No comments

Popular Posts

Followers