Weichai Power adopted Model-Based Design with MATLAB® and Simulink® to design and implement the common-rail diesel engine ECU software. They built a production control and software team, and trained new engineers in the tools. The company also worked with MathWorks Consulting to establish on-target rapid prototyping capability that would enable Weichai group companies and customers to collaborate.
Working from system requirements, Weichai Power engineers developed an engine controller model in Simulink and Stateflow®. They used Stateflow to model state transition logic for engine operating mode control, rail pressure control, and diagnostics routines.
During model development, they used the Model Advisor in Simulink to check compliance with modeling standards adapted from MathWorks Automotive Advisory Board (MAAB) guidelines.
Using Simulink Requirements™ the team linked textual requirements to the model elements in Simulink that implemented the requirements to ensure traceability.
In Simulink, the team created a plant model of the vehicle, after-treatment systems, and engine, including fuel, torque, intake, and exhaust subsystems. To verify the control design, they ran closed-loop simulations of the control and plant models.
They created test vectors with Simulink Design Verifier™. Used with Simulink Coverage™ and Simulink Check™ these test vectors enabled the team to identify dead logic in their model and achieve complete model coverage.
Using Fixed-Point Designer™, the engineers converted the floating-point model to fixed point by recording minimum and maximum data values during simulation and applying Fixed-Point Designer recommendations for scaling fixed-point data types.
After comparing the floating-point and fixed-point model simulation results to verify the conversion, the team generated C code from the control model using Embedded Coder®.
Working in Simulink they performed software-in-the-loop tests on a PC and hardware-in-the-loop tests on an ETAS® PT-LABCAR simulator.
The team generated more than 340,000 effective lines of code for the production ECU with Embedded Coder. The generated code comprised 100% of the application software; 85% of the CAN application layer and diagnostic routines were also generated from models.
Working in MATLAB, the team developed vehicle drive cycle software, which they used for data analysis during testing of the initial production ECUs.
The common-rail diesel engine ECU is in production on heavy-duty trucks, construction machinery, and power generation equipment. Weichai Power plans to reuse the ECU design for light diesel engines.