|“MathWorks tools for modeling and code generation enabled us to quickly and seamlessly perform design and test iterations, and release our product within a hard deadline of only 18 months.”
– Mario Wünsche, Daimler
Cruise control (CC) is the system that automates the speed control of a vehicle. The system is responsible for a number of complex, interrelated control functions and requires a significant amount of analysis and design to understand and compensate for coupling and integration issues. CC for trucks is much more complicated than speed control for cars because it offers more functionality and has increased coupling between functions.
Engineers at Daimler reengineered a cruise control system for Mercedes-Benz commercial vehicles, including heavy-duty trucks, delivery trucks, and coaches. Using MathWorks tools for Model-Based Design, they designed, tested, and implemented the software on an ECU in just 18 months.
“MathWorks products were crucial to the success of this project,” says Mario Wünsche, project manager for Truck Product Creation at Daimler. “They allowed us to rapidly prototype, simulate, and test our designs throughout the entire development project in a common environment without resorting to manual implementation or learning new tools.”
The Daimler project team, which consisted of systems and software engineers, had already developed a C-code module for this application, but would need to redesign this module for implementation on a new target ECU. The deadline for the project was within 18 months from start. Based on past experience, the team knew that they would not be able to meet the deadline using a traditional development approach.
Their goal was to create a modular application with an open architecture that could be reused for future applications. Since several teams would be working simultaneously on the project, they would need to share results.
The complex CC software would control drive and brake torque, regulate distance, and limit speed. Inputs for the governor and the road speed limiter included the CC lever, accelerator, pedal, CAN signals, and vehicle speed, distance, and acceleration. The design of a system with so many inputs and outputs would be challenging enough. Daimler would also need to ensure that the system executed on a fixed-point production microcontroller with limited memory and throughput resources.
Daimler used Model-Based Design with MATLAB®, Simulink®, and Embedded Coder®. MathWorks consultants helped them develop modeling guidelines and architecture so that the algorithms would produce optimized C code.
Daimler began by modeling the system in Simulink and Stateflow®. This complex design model consisted of 3900 blocks with 140 input signals, 40 output signals, and 340 parameters. They used version control in Concurrent Versions System (CVS) to enable teams to design subsystems simultaneously.
Engineers conducted tests throughout the development phase using an interactive, automated test tool based on a test database with predefined tests and a control interface. They performed processor-in-the-loop testing by using a closed-loop simulation of a Simulink model communicating over CAN bus with the production code generated by Embedded Coder executing on the target microcontroller. This enabled Daimler to quickly verify the results computed on the target hardware with those calculated in Simulink.
After testing, they automatically generated code for the CC using Fixed-Point Designer™, Simulink Coder™, and Embedded Coder. Fixed-Point Designer helped them define scaling and data types in most of the Simulink blocks. Embedded Coder enabled them to generate code that would satisfy their in-house quality and style standards. Custom storage classes enabled them to define and control the data types for a production release.
After testing the code in the target ECU, they tested the ECU on a hardware-in-the-loop simulator that consisted of a vehicle model working on VME Systems and all vehicle ECUs, including hardware sensors. The vehicle model ran in real time, enabling the team to calculate all physical values as if they were working with the actual vehicle.
Compact, efficient code. The code automatically generated with Embedded Coder and Simulink Coder required about 16% less RAM than the handwritten code used on a previous version of the CC; the code met all project requirements for efficiency and structure.
High test efficiency. Debugging the control software on the desktop instead of in the vehicle enabled the Daimler team to reduce the time and cost associated with resolving software problems.
Fast development. The entire project, including analysis, restructuring, modeling, and testing, took just 18 months. It would have been nearly impossible to achieve this project deadline without the use of simulation, production code generation, and processor-in-the-loop capabilities offered by MathWorks.