From the series: Improving Your Racecar Development
Christoph Hahn, Andreas Uschold, MathWorks
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.
Below are links to software and hardware products and services mentioned in the episode:
Two episodes of the MATLAB and Simulink Racing Lounge are closely connected to that topic. In the first video processor-in-the-loop (PIL) testing is explained more in detail and in the second video a top of the world electric Formula Student team explains their approach to code generation and testing.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .Select web site
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.