With the increase in software content in today’s electric vehicles, companies are turning toward virtual vehicles to test their software as soon as possible. Adopting Model-Based Design can be a game-changer for developing battery management systems, writes R Vijayalayan from MathWorks India.
Importance of BMS
The importance of Battery Management Systems in a Lithium-ion battery pack is much underscored by the dependence on batteries across industries. A good Battery Management System (BMS) is necessary to ensure maximum performance, optimal life, and safe operations under diverse charge-discharge and environmental conditions.
When designing a BMS, engineers develop feedback and supervisory control that:
– Monitors cell voltage and temperature
– Estimates state-of-charge and state-of-health
– Limits power input and output for thermal and overcharge protection
– Controls the charging profile
– Balances the state-of-charge of individual cells
– Isolates the battery pack from the load when necessary
This article looks at how engineers could develop BMS algorithm by performing system-level simulation. With Model Based Design, engineers can develop closed-loop battery models which can serve as a basis for all design and development activities through desktop simulation of the design’s functional aspects, formal verification and validation to industry standards, and automatic code generation for real-time simulation and hardware implementation.
1. Using desktop simulation to verify functional aspects of BMS
Desktop simulations enable you to verify functional aspects of the BMS design, such as charge-discharge behaviour (using single-cell equivalent circuit formulation), electronic circuit design, and feedback and supervisory control algorithms. On the desktop, the battery system, environment, and algorithms are simulated using behavioural models. For example, you can explore active vs. passive cell balancing configurations and algorithms to evaluate the suitability of each balancing approach for a given application. You can use desktop simulation to explore new design ideas and test multiple system architectures before committing to a hardware prototype. You can also perform requirements testing in desktop simulations, for example by verifying that contactor are prevented from opening or closing when an isolation fault is detected.
2. Using real-time simulation for rapid prototyping
Once validated via simulation, these models can be used to generate C and HDL code for rapid prototyping (RP) or hardware-in-the-loop (HIL) testing to further validate the BMS algorithms in real time. With RP, instead of handwriting control software code for real-time testing, you generate code from your controller model and deploy it to a real-time computer that performs the functions of the production microcontroller. With automatic code generation, algorithm changes made in the model can be tested on real-time hardware in hours rather than days. Further, you can interact with real-time control hardware to change algorithm parameters and log test data.
As with rapid prototyping, HIL testing involves generating code and deploying it to a real-time computer. In the case of HIL testing, code is generated from the battery system models rather than the control algorithm models, providing a virtual real-time environment that represents battery pack, active and passive circuit elements, loads, charger, and other system components. This virtual environment lets you validate the functionality of the BMS controller in real time before developing a hardware prototype and in an environment where hardware will not be damaged. Tests developed during desktop simulation can be carried over to HIL testing, to ensure that requirements are met as the BMS design progresses.
3. Hardware implementation
Desktop simulation, RP, HIL, and PIL simulations all enable you to verify and validate the control algorithms for the BMS. Model-Based Design enables you to use those same algorithm models as the basis for generating production-ready code—either optimized and stable C/C++ code for implementation on microcontrollers or synthesizable HDL code for FPGA programming or ASIC implementation. If necessary, production code generation can be incorporated into workflows compliant with formal certification standards used in the automotive, aerospace, and other industries.
Automatic code generation eliminates manual algorithm translation errors and produces C/C++ and HDL code with numerical equivalence. By simulating your control algorithms over all possible operating and fault conditions, you increase confidence that the generated code will handle those same conditions in the real system, even if you are unable to test for all of them. If hardware tests later indicate that algorithm changes are needed, you can simply modify the algorithms in your model, rerun simulation test cases to verify the correctness of the changes, and generate new, updated code. All generated C/C++ and HDL code is fully portable, optimizable with a range of options, and bidirectionally traceable to the model
Model-Based Design enables engineers to gain insight into the dynamic behavior of the battery pack, explore more software architectures, test more operational cases, and begin hardware testing earlier with fewer design errors. Overall, Model-Based Design addresses the challenges caused due to growing software and system complexity in developing Battery Management System.
About the author:
R Vijayalayan manages the automotive industry and control design vertical application engineering teams at MathWorks India. He specializes in the field of Industrial Automation, Robotics and Model-Based Design. He can be reached at firstname.lastname@example.org.
Subscribe & Stay Informed
Subscribe today for free and stay on top of latest developments in EV domain.