Technical Articles and Newsletters

Building a Hybrid Electric Vehicle Prototype System for Processor-in-the-Loop Simulations

By Curt Hillier, NXP Semiconductors

As more automobile features become defined by computing power, engineers are designing increasingly complex algorithms for energy management, battery management, and powertrain control. This has led to increased demand for automotive processors capable of running computationally intensive algorithms in real time.

To showcase the capabilities of NXP® processors, my team has developed a prototype system for processor-in-the-loop (PIL) simulation of advanced automotive control algorithms. We used Model-Based Design with Simulink® to model and evaluate the control algorithms, which are then deployed to an NXP® S32S GreenBox II hybrid and electric vehicle development platform (Figure 1). 

An N X P S 3 2 S Green Box 2 platform used in the development of hybrid electric vehicle and internal combustion engine microcontrollers.

Figure 1. The S32S GreenBox II hybrid and electric vehicle development platform.

We started with a reference application that included a plant model of a hybrid electric vehicle (HEV) and an optimized supervisory controller. This helped us reduce development time for the NXP demonstration system by more than nine months.

HEV and Controller Modeling

Our engineers have considerable expertise in semiconductors but little direct experience with modeling vehicles and advanced energy management control strategies. To save time building a full, system-level model of an HEV similar to the models our customers use, we used the HEV P4 reference application in Powertrain Blockset™. The P4 reference application includes a complete, prebuilt HEV model with a spark ignition engine, transmission, lithium-ion battery, and electric motor (Figure 2).

Model of a prebuilt H E V P 4 powertrain with a spark ignition engine, transmission, lithium-ion battery, and electric motor.

Figure 2. A model of the HEV P4 powertrain built with Powertrain Blockset components.

In addition to the HEV model, the reference application includes engine, transmission, and P4 hybrid control modules as well as other components that enabled us to run comprehensive closed-loop simulations (Figure 3). The Drive Cycle Source and Longitudinal Driver blocks, for example, let us generate a standard longitudinal drive cycle and convert the velocities into normalized acceleration and braking commands. Subsystem plots of vehicle speed, engine speed, battery state of charge, and fuel economy (in MPGe) enabled us to visualize vehicle-level performance and energy use over the simulated drive cycle.

Model of a closed-loop H E V P 4, including controller, vehicle, drive cycle, and visualization subsystems.

Figure 3. Closed-loop HEV P4 model including controller, vehicle, drive cycle, and visualization subsystems.

Running PIL Simulations on GreenBox II

Before running PIL simulations, we ran model-in-the-loop simulations to familiarize ourselves with the HEV model and the Equivalent Consumption Minimization Strategy (ECMS) algorithm included with the reference application. This supervisory energy management algorithm, developed by Dr. Simona Onori of Stanford, finds the optimal balance for powering the vehicle from its engine and electric motors.

To run the ECMS algorithm on the GreenBox II, we generated code from the control model using Embedded Coder® and deployed it using the NXP® Model-Based Design Toolbox (MBDT) hardware support package. MBDT includes initialization routines and device drivers that make it easy to deploy and run complex algorithms on NXP processors (Figure 4). 

A diagram of the code generation workflow for processor-in-the-loop simulation using N X P processors.

Figure 4. Code generation workflow for PIL simulation.

Using this setup, we ran PIL simulations in which acceleration and braking commands from Simulink were sent to the controller running the ECMS algorithm on the GreenBox II. The controller generated engine and electric-motor torque command signals, which were relayed to the HEV plant model. Signals from the plant such as engine speed and motor speed were fed back to the controller. During the PIL simulations, we monitored these signals and other key metrics as they were updated in Simulink (Figure 5).

Plots of velocity, engine and motor speed, battery state of charge, and fuel economy during H E V processor-in-the-loop simulation.

Figure 5. Plots of velocity, engine and motor speed, battery state of charge, and fuel economy as a function of time.

Extending and Enhancing the Setup

Since running our first PIL simulations of the ECMS algorithm on the GreenBox II platform, we have completed several design iterations. For example, steering and suspension systems from Vehicle Dynamics Blockset™ were incorporated into the original model so that we could replace the predefined drive cycle with live controls for accelerating, braking, and steering. We added miniature wheels and electric motors that were actuated during acceleration and braking. We also incorporated a 3D simulation environment based on Unreal Engine® with Vehicle Dynamics Blockset (Figure 6).

Curt Hillier of N X P Semiconductors controls an H E V processor-in-the-loop simulation while watching a 3 D simulation of the vehicle.

Figure 6. The author controlling a PIL simulation while watching a 3D visualization of the vehicle.

More recent versions of the setup included integration with Amazon® Web Services (AWS®) via the NXP® GoldBox service-oriented gateway, which manages the flow of vehicle data to AWS cloud data stores for analysis and reporting. Additionally, we demonstrated a new workflow, “Automotive DevOps for Model-Based Design with AWS, NXP, and MathWorks,” at MATLAB Automotive and MATLAB Expo in 2022.

Future applications will utilize the S32Z and S32E real-time processors. The NXP® GreenBox 3 Real-Time Development Platform incorporates the S32E, which contains higher performing math computation capabilities supporting more advanced and compute intensive applications.

Published 2022