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).
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.
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).
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.
Figure 3. Closed-loop HEV P4 model including controller, vehicle, drive cycle, and visualization subsystems.
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).
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).
Figure 5. Plots of velocity, engine and motor speed, battery state of charge, and fuel economy as a function of time.
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).
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.