Development of Hardware-in-the-Loop
(HIL) and Fast Prototyping Tool (FPT)
using OPAL-RT
KARMA : A global car company born and
rooted in Southern California
Elements of karma brand that guide us
Introduction
Hardware-in-the-loop (HIL) unit using OPAL-RT
Limitation of dyno testing Advantages of HIL
Increasing the load on dyno setup Quick design and testing of new features in inverter SW (e.g., current
controllers and thermal management algorithms)
Working with high voltage setup even when not required Easier fault injection studies
Longer time required for testing Saving time and money
Fast prototyping tool (FPT) using OPAL-RT
Limitation of SW development with production inverter Advantages of SW development with FPT
Necessity of developing BSW No need to BSW
Difficulty in monitoring fast internal signals in the SW One-time effort (i.e., once SW is built, it is useful in future)
Difficulty of debugging application SW Output any signal with high rates ( up to 1000 times faster than CAN)
HIL project - concept
“Testing with actual HW” V.s. “Testing with HIL unit”
OPAL-RT
Dyno
PWMs Measurements
Inverter
Motor Gate Drive Board MC Control
board
Control Board
Resolver
Modeling all high voltage CAN
components + resolver in OPAL-RT
CAN
HIL project - input/output definition
Review of the setup configuration
. Reading excitation signals and voltage supplies using
Analog-In card of HIL
. Sending resolver outputs, motor currents, HVDC, and
temperatures using Analog-Out card of HIL
. Reading the switching commands of control board using
Digital-In card of HIL
. Reporting inverter faults or abnormal conditions using
Digital-Out card of HIL
Meeting the requirements
Providing resolver modeling YES
Providing the possibility of using flux look-up tables YES
Computational capability Time step of 0.3 us
Providing thermal modeling of inverter and motor YES
Possibility of online changing of system variables YES
HIL project - Model structure
HIL model in MATLAB-SIMULINK
Running several automated motor and inverter
testing to derive parameters on HIL model
. IPM motor model in FPGA
. Model of Inverter switches in FPGA
. Resolver model in FPGA
. Thermal modeling in CPU
. Fast transferring data with I/O cards
using FPGA
HIL project – CAN communication development
Approach 1: Using CANalyzer Approach 2: Can module of OPAL-RT Unit
- Facilitating automatic testing and saving time by
synchronizing torque, speed, and fault profiles
(all signals coming from the same source)
- Python scripting to automatically run the model,
read/change parameters and read/change signals
- Setting up CAN module of
OPAL-RT by importing DBC file
MC Control
To define required board CAN
profiles
CAN
To generate and apply CAN Control board MC
commands
HIL project - testing
System integration and testing
Validation of the developed HIL
CANalyzer (commanding and logging) setup (matching between
Three-phase sinusoidal currents
motor variables in the inverter
SW and HIL model)
RT-LAB
monitoring
Using HIL unit for SW
development and studying
OPAL-RT 5700 several steady-state, transient,
RT-LAB and fault cases for traction
CAN
motor and generator of
Power Supply Control Board different Karma Automotive
platforms
FPT project - concept
“Inverter with Control board” V.S. “Inverter with Fast Prototyping Tool”
• 5/25V
Resolver (Sin-Cos) Control Board • PWM Signals Gate Drive Board
CAN MC
• Current signals
• IGBT/Motor Temp.
• Gate Drive faults
• HVDC
RDC OPAL-RT Controller
Resolver (Sin-Cos) Gate Drive Board
CAN
FPT project - SW structure definition
SW platform SM_Controller (fast critical diagnostics and input/output signals)
All Inputs Digital Outputs
𝒇𝒇𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔. = 𝟏𝟏𝟏𝟏 𝝁𝝁𝝁𝝁 Debug/display
Filters if PWM
needed
PWM Enable
Critical
Scaling/ Diagnostics SC_Console (Monitoring and model setpoints)
mapping (OC, OV2, PCM)
CAN
Thermal PWM Enable
Diagnostics
𝒇𝒇𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔. = 𝟏𝟏𝟏𝟏𝟏𝟏 𝝁𝝁𝝁𝝁
Power Moding Motor Control Duty cycles
SS_Controller_100us (motor control algorithm)
FPT project - input/output definition
Input / Output signals
IGBT Temp.
Offset/Gain Filter Lookup Table
100 μs Diagnostic
100 μs
Motor Temp.
Lookup Table
AC Currents
Offset/Gain Filter Offset Learn
10 μs Diagnostic
10 μs
Other Ain
Offset/Gain
FPT project - SW structure definition
Software Overview
CAN Communication
Fault Status Torque Cmd
• Resolver Result
• Analog inputs (HVDC, AC currents)
Motor
Diagnostic
Digital inputs
Control
Analog inputs
Fault Status Duty Cycles
Power
Mode PWM signals
Power PWM
Enable Cmd
Shutdown Moding Generation
Cmd
12V wakeup
IGBT Reset
FPT project – SW development and validation
Troubleshooting of FPT SW using HIL HIL
FPT
• 5/25V
• PWM Signals
• Current
measurements
• IGBT/Motor
Position Temp.
• Gate Drive faults
Troubleshooting of FPT SW using the previously
• HVDC
CAN Communication developed HIL unit without needing to touch high
Resolver voltage in early stages
(Sin-Cos)
Utilization of RDC evaluation board to calculate rotor
angle based on the output of resolver model of HIL
Resolver to digital (next step: resolver decoder model from OPAL-RT)
converter
FPT project - testing
System integration and testing with stand-alone load and dyno
Dyno
Current sensors Validation of the capability of the FPT system to make
three-phase sinusoidal phase currents with specified
Motor amplitude and frequency on a stand-alone load
Validation of the capability of the FPT system to control
d-q currents on Karma Automotive's dynamometer
Three-phase sinusoidal test setup
currents
d-q Currents following
commands
RT-LAB interface
Conclusion
Hardware-in-the-loop (HIL) unit
Definition of analog/digital mapping of I/O cards
CAN Communication setup: 1) commanding over CANalyzer, 2) commanding over CAN unit
Testing and validating several diagnostics and motor control algorithms and controllers of TM and GEN SWs for both Karma Revero and Revero GT
Fast-Prototyping tool (FPT)
I/O mapping, SW structure, motor control algorithm development, and CAN Communication setup
Va l i d a t i o n o f F P T t o o l u s i n g d e v e l o p e d O PA L - RT H I L u n i t ( r u n n i n g t w o t a r g e t s o n t h e s a m e l a p t o p )
Va l i d a t i o n o f t h e d e v e l o p e d F P T t o o l o n s t a n d - a l o n e l o a d a n d d y n a m o m e t e r
THANK YOU
Questions?