Sunday, August 7, 2011

Simulation ensures green buses can hit the road on time Electronics News

The six-strong engineering team at Dongfeng Electric Vehicle (DFEV) faced a tough challenge: design, test and verify the battery management control system for the EQ6110 hybrid electric city bus — lowering The six-strong engineering team at Dongfeng Electric Vehicle (DFEV) faced a tough challenge: design, test and verify the battery management control system for the EQ6110 hybrid electric city bus – lowering emissions and improving fuel efficiency by 30 percent - and then generate production C code for the controller, in record time.The control strategies for battery management and vehicle energy management are vital for meeting the performance and fuel economy specifications of HEVs.To make things even harder, the controllers have to be optimised to suit the dynamics of individual vehicles. The Engine Control Unit (ECU) for the EQ6110 is based on a Freescale S12 microcontroller (MCU). This 16-bit Controller Area Network (CAN) device is designed specifically to look after automotive and industrial applications. Dongfeng MathWorks simulationWhile DFEV's engineers were experienced in developing the C code controller software that the MCU would run, this challenge was far more complex than others they had faced."We had just 18 months to take the initial idea to proof-of-concept and then deliver a complete product," said Dr. Xiaokang Liu, principal engineer at DFEV."But with our limited human and material resources, hand-coding was not feasible in such a short time."DFEV decided to seek help from US-based The MathWorks.The company's MATLAB, Simulink and Stateflow software allowed the DFEV engineering team to use a model-based design approach to ultimately generate and verify over a hundred thousand lines of application code for the controller looking after the battery-management system.What is model-based design?Model-based design allows engineers to construct a graphical representation of their system. But this graphical representation is more than just a visual model; it's a dynamic environment that can be exercised with inputs so that engineers can simulate what will happen under real-life operating conditions.The MathWorks Simulink software uses functional blocks that accurately mimic the precise electrical or mechanical behaviour of the device they represent.In Donfeng's case, for example, the model comprised blocks such as the internal combustion engine, electric motor, batteries, gearbox and other elements that make up a hybrid electric bus.Engineers are able to specify operational parameters for the functional block. For example, for a block that represents a DC motor, the engineer can input the stall torque and zero load speed from the maker's spec sheet.While there are many standard functional blocks supplied by The MathWorks, it's also possible for the user to create their own custom functional block. Moreover, the engineer can add physical restraints, such as energy dissipation (for example, friction) or inertia that would affect the performance of the real machine.There are also models for linkages and joints that include the Newtonian or Lagrangian mechanical equations governing their movement. This means, for example, that if an engineer is designing a six-axis robot, he doesn't have to derive the formulae describing the machine's movements from first principles.Rather, they simply need to connect the functional blocks representing the linkages, joints, pulleys and motors and then add the physical restraints to end up with a dynamic ("plant") model that will react to stimulation in exactly the same way as the real thing.Using this plant model, the control engineer can develop algorithms to achieve a desired outcome. For example, for a simple pendulum driven by an electric motor, the control algorithm might instruct the controller to apply a voltage to the motor proportional to the position of the pendulum to move it one way, reversing that voltage at the top of the swing to move the pendulum back the opposite way.The MathWorks MATLAB software provides the control engineer with access to a library of algorithms to aid the control design process. The plant model is "linearised" in MATLAB (to provide a precise representation of the plant model about a specific operating point to allow the engineer) to invoke these control algorithms. The control design is then developed (using Simulink) by observing the effect on the plant model and making changes to the algorithms until the model's behaviour meets the specification.The final step is to translate the Simulink versions of the control algorithms into the C code that runs on the silicon (for example, an MCU or DSP) that will control for the actual machine. This is a function that can be done automatically using The MathWorks software, saving many hours of expensive C programming resource. Battery-management system algorithm frame using MathWorks Simulink."Being able to observe machine behaviour is one thing, but the whole motivation is not just to observe, but to enforce a design behaviour," Bradley Horton, principal applications engineer with The MathWorks Australia, told Electronics News. "The plant model allows design engineers to develop control laws for the machine and try them out via simulation. That's 'model-based design.' There is no need to build expensive prototype hardware in order to test the control strategy," says Horton. "By simulation, Simulink and MATLAB enable control system development and early design verification."Floating to fixedOne of the keys to DFEV's success was the ability of the engineers to convert their floating-point solution to a fixed-point design. Fixed-point computation is less demanding allowing the use of a simpler MCU, reducing cost and lowering power consumption."What Dongfeng's engineers had to do was specify some fixed-point characteristics for the control law they had originally developed for floating point computation," said Horton. "That control law then has to be translated into new C code so it could run on the fixed-point controller. Knowledge of these values allows the design engineer to make fundamental decisions about the fixed point design - such as word sizes and which fractional bits to retain. Unfortunately, determining those fixed-point characteristics manually can take a lot of time," explained Horton.DFEV overcame this challenge by using the company's Simulink Fixed Point software. The engineers exercised the plant model using floating-point computation to generate some reference "base line" characteristics. Rerunning the model using Simulink then generated "suggested" operational values for the fixed-point controller design."It's simple to rerun the plant model using these suggested values to see how close the fixed-point model approaches the base line floating-point design," continued Horton. "The closer the fixed-point regime operates to this base line, the better the design. With some fine tuning by repeatedly running the simulation with slightly revised values, it's possible to get the fixed-point model virtually perfect."DFEV's engineers used Simulink Fixed Point to do the conversion from floating point to fixed point and then ran a second round of desktop simulations to verify the conversion's quality. New C code was then generated to port to the fixed-point MCU.Running on time Finally, the DFEV team deployed the code to the target ECU. Using code generated from the plant model, they ran the ECU in hardware-in-the-loop simulation to verify the controller software on the real ECU hardware. The controller was then installed in prototype vehicles for reliability and durability testing."Because it was automatically generated, the code was consistent and easier to maintain. Equally important, the code was of high quality, meeting the MISRA C guidelines we need to follow," said DFEV's Liu. "Achieving this level of consistency and quality with hand-coding would have been very difficult. By using model-based design, automatically generating code and streamlining the conversion from floating point to fixed point, a small team of six engineers completed the project ahead of schedule," he concluded.The embedded battery control system is in place on the company's more than 400 EQ6110 buses. Now DFEV's engineers are reusing parts of the controller design for the their HEV car, which is in development.emissions and improving fuel efficiency by 30 percent - and then generate production C code for the controller, in record time.Electronics News. "The plant model allows design engineers to develop control laws for the machine and try them out via simulation. That's 'model-based design.' There is no need to build expensive prototype hardware in order to test the control strategy," says Horton. "By simulation, Simulink and MATLAB enable control system development and early design verification."
Simulation ensures green buses can hit the road on time Electronics News

No comments:

Post a Comment