Developing Battery Management Systems Using Simulink
Developing Battery Management Systems Using Simulink
Developing Battery Management Systems Using Simulink
2
What is BMS?
Supervisory tasks
SOC estimation
Contactor management
Isolation monitoring
Fault detection and recovery
Thermal Management
Current & Power Limits Block Voltage,
Temperature Measurement
Cell Diagnostic
Cell Balancing 3
Motivation
4
Where do we start?
5
Equivalent Circuit Model
Transient
Dynamics
Cn Terminal
C1
Im R0 Resistance
I1 R1 In Rn
Open-Circuit
Voltage Ip
+
V
Em Zp
+ Parasitic
Ep Losses
6
Battery Cell Blocks in Simscape
7
Parameter Estimation
R1 Goal:
Model should match real data as closely as possible
R0
Em C1
experiment out ☺
8
Parameter Estimation
Before
After
9
Look-up Tables
5°C
20°C
40°C
11
Start with Simulation
Battery Cell → Large Battery Pack
Pack System
Cell Dynamics
Thermal Model
Demo
12
Evaluate System Behavior
Demo
13
Discharge + Charge
14
Discharge Only
15
Charge Only
16
Evaluate SOC Estimation
true
17
Generate C/C++ Code From BMS Algorithm Models
Demo
18
Did we generate code too early?
Is this ready to ship?
20
Typical Development Workflow
Requirements Specification
C/C++/HDL
21
Challenge: Errors introduced early but found late
Requirements Specification
C/C++/HDL
22
Validate Design via Desktop Simulation
Design
Requirements C/C++/HDL
Model
23
Model-Based Design Workflow
Simulink Models
Model used for
Design
Requirements production code C/C++/HDL
Model
generation
Generated code
Code
Generation
24
Model-Based Design Verification Workflow
Review and
Component static analysis Equivalence
and system testing
testing
Equivalence
checking
Simulink Models
Model used for
Design
Requirements production code C/C++/HDL
Model
generation
Generated code
✓ Faster development ✓ Reduced cost
Is it functioning
correctly?
Simulink Models
Model used for
Design
Requirements production code C/C++/HDL
Model
generation
Generated code
26
Systematic Functional Testing with Simulink Test
Test Case Model Sim through SIL, PIL and HIL
Scale with PCT and CI
Inputs Assessments
27
Create Test Harnesses
28
Systematic Functional Testing with Simulink Test
29
Manage and Organize TestCases
30
How do we know we have enough test?
Simulink Models
Model used for
Design
Requirements production code C/C++/HDL
Model
generation
Generated code
31
How do we know we have enough test?
Simulink Models
Model used for
Design
Requirements production code C/C++/HDL
Model
generation
Generated code
32
Integrate with requirements tools and author requirements
External
Requirements Simulink Requirements • Import from:
• Word / Excel
External Requirements • IBM® Rational® DOORS®
Import • ReqIF™ standard
• Update synchronizes
Update
changes from source
33
Import External Requirements & Author New Requirements
34
SW Requirements - Implementation Status
35
Track Implementation and Verification
Implemented Passed
Failed
Justified
Unexecuted
Missing
Missing
36
Requirements Verification with Simulink
Requirements Simulink / Stateflow
Implemented
By
Verified
By
Test Case
Inputs Assessments
Test Harness
Signal Editor
MAT / Excel Test
MAT / Excel File (baseline) Assessments
file (input)
Simulink Test
Test Sequence
MATLAB Unit Test
37
Link Tests to Requirements
38
How do we know we have enough test?
Simulink Models
Model used for
Executable
Requirements production code C/C++/HDL
Specification
generation
Generated code
40
Coverage Analysis to Measure Testing
Simulink
• Identify testing gaps
• Missing requirements
Stateflow
• Unintended Functionality
Generated Code
• Design Errors
Coverage Reports
41
Measure Model Coverage
42
Addressing Missing Coverage
Partial Coverage
Test
Generator
43
Addressing Missing Coverage
Full Coverage
New Test Cases
Test Cases
44
Automatic Test Generation
45
Systematic Simulation Testing
Simulink Models
Model used for
Design
Requirements production code C/C++/HDL
Model
generation
Generated code
46
Real-Time Testing of Battery Management System
Measurement &
Battery Pack Main Controller47
Diagnostics
Hardware-In-Loop Testing of Battery Management System
Automatic
Code Generation
49
Execute Large Battery Models in Real-time
Prepare Model for Real-time Simulation (if using Webinar on “Real-Time Simulation of
Simscape) Physical Systems Using Simscape”
– Use Simscape Local Solver
– Configure fixed-cost simulations
– Try “Partitioning” option for non-linear systems*
5x
5x
– Reduce order of charge dynamics by
selecting fewer number of time-constants
2-3x
50
Sensor and Fault Emulation
Fault Insertion
– 1A to 40A current handling; Up to 4 fault buses
– Electromechanical or MOSFET switches
51
Conclusion
52
Learn More about Battery Management System
Download Link to
File Exchange
THANK YOU
53