“MathWorks tools enabled us to verify the quality of our design at multiple stages of development, and to produce a high-quality component within a short time frame.”Markus Schertler, ATB Technologies
When engineers at ATB Technologies were developing a high-performance compressor for a fuel cell vehicle, they had to deliver on stringent customer requirements. The compressor’s electric drive motor had to provide high torque, rapid acceleration, and a maximum speed of 20,000 rpm. To meet these requirements, they chose a brushless permanent magnet synchronous motor (PMSM) for the design.
To maximize the performance and efficiency of the PMSM, the engineers used MathWorks tools for Model-Based Design to develop sophisticated control algorithms that incorporated three-phase vector control, field-oriented control (FOC), and field-weakening techniques. The team has adopted Model-Based Design incrementally—on this project adding production code generation to a process that already employed modeling and simulation of designs for early verification.
“On past projects, we simulated and verified our Simulink designs before hand coding the implementation,” says Markus Schertler, development engineer at ATB Technologies. “After transitioning to automatic code generation, the quality and modularity are better and the iterations are faster, so we can move rapidly from the first prototype to the final series.”
ATB Technologies needed to deliver a complete compressor unit, including the motor control software, electronics, motor, and other mechanical components. To maximize the dynamics, energy density, and efficiency of the system, these components must work together perfectly.
The project was too complex to complete within the aggressive schedule using the team’s standard practice of hand coding control software. “Hand coding takes a lot of time, and there are always bugs. Hand coding also makes it difficult to prove to our customer that we are meeting their requirements, including compliance with certain MISRA C standards,” notes Georg Staffler, development engineer at ATB Technologies.
ATB Technologies needed a development environment that enabled early verification of control strategies, code generation for its chosen target processor family, and rapid design iterations throughout the project.
ATB Technologies used MathWorks tools for Model-Based Design to design, simulate, verify, and deploy the control system software on a TI C2000™ microcontroller unit (MCU).
Using Simulink®, the team developed a plant model of the drive and included physical parameters measured in the lab. Using Simulink and Stateflow®, they developed an initial model of the controller. They then ran closed-loop simulations of the controller and plant models in Simulink to assess the feasibility of the control strategy.
As they refined the controller model, the team designed noise reduction filters with Signal Processing Toolbox™, and they checked for questionable fixed-point operations using Fixed-Point Designer™.
After verifying the model via desktop simulations, ATB Technologies used Embedded Coder® to generate code from the model and deploy it to a TI C2000 MCU. They also generated device drivers for on-board peripherals and the scheduler with Embedded Coder.
Using an RTDX channel in Embedded Coder, the team verified the code as it ran on the MCU with a Simulink test harness. The team recorded signals using RTDX and then performed spectrum analysis in MATLAB® to tune filters and supplement the design documentation.
Because the controller was designed before the actual motor was available, initial tests were conducted using a comparable motor with similar electronics. Later tests incorporated production electronics, and the final tests were conducted on the production motor and electronics. On each iteration, the team refined the design in Simulink and re-generated the code using Embedded Coder.
ATB Technologies delivered the compressor motor to the customer on schedule, and the motor is currently produced and embedded in fuel cell cars on the road today.
Development time cut in half. “Taking into account the migration within the processor family, automatically generating code enabled us to complete the compressor project twice as fast as a similar project that applied Model-Based Design but used hand coding,” says Schertler. “Code generation resulted in fewer bugs, better quality, and faster iterations, and it enabled a modular approach that facilitated model reuse across projects.”
Design reviews simplified. “With our models in Simulink and Stateflow, we could prove to our automotive customers that our design met their requirements,” Schertler notes. “The models also made internal design reviews more efficient, because they are more intuitive to understand than code.”
Target verification and deployment accelerated. “Embedded Coder enables us to easily verify our real-time implementation. For example, we can see an individual filter working and check that we are using the right parameters,” says Schertler. “We also saved a lot of time by using Embedded Coder to generate device drivers and our scheduler and then download the code to our target.”
Join the Customer Reference Program