Lotus Engineering used Simulink and Stateflow to develop an engine management system to control diesel emissions and Embedded Coder® to generate production-intent code for the system.
To jumpstart the project, Tudor attended MathWorks Training and worked with MathWorks Consulting for onsite assistance. "The reference documents, the examples, and the training course format are all excellent. The expert consulting support was also very good and responsive," says Tudor.
Tudor used Simulink and Stateflow to develop algorithms and control strategies for the catalysts and an additional fuel injector. They used Stateflow to control the timing of events in the system. The Simulink model also incorporates safety features to control temperature and master switches in the aftertreatment system.
Using Simulink S-functions generated by the Legacy Code Tool on MATLAB Central, Tudor incorporated existing algorithms for interpolation tables. "I integrated legacy code into the model, so I knew I was simulating with the real algorithms. Those same algorithms were also called very neatly by the generated code," Tudor explains.
Tudor used MATLAB to import the interpolation tables before saving them to the calibration area of the target. He also used MATLAB to postprocess recordings of real data to feed back into the simulations.
Tudor then used Simulink to simulate and validate the system before automatically generating production-intent code with Embedded Coder. He then downloaded the production-intent code to a Motorola MPC563 microcontroller. Although the code was efficient, the floating-point performance on the target was not acceptable, so Tudor converted the model to fixed point using data types from Simulink Fixed Point.
Lotus Engineering is due to commence vehicle testing in extreme conditions shortly. “We are anticipating strategy refinement. MathWorks tools will help us make changes in the field rapidly, avoiding delays and potential misinterpretations," says Tudor.
Based on its early success with MathWorks tools, the team is modeling a complete engine control unit.