Explore the Hybrid Electric Vehicle P2 Reference Application

The hybrid electric vehicle (HEV) P2 reference application represents a full HEV model with an internal combustion engine, transmission, battery, motor, and associated powertrain control algorithms. Use the reference application for hardware-in-the-loop (HIL) testing, tradeoff analysis, and control parameter optimization of a HEV P2 hybrid. To create and open a working copy of the reference application project, enter

By default, the HEV P2 reference application is configured with:

  • Lithium-ion battery pack

  • Mapped electric motor

  • Mapped spark-ignition (SI) engine

This diagram shows the powertrain configuration.

This table describes the blocks and subsystems in the reference application, indicating which subsystems contain variants. To implement the model variants, the reference application uses variant subsystems.

Reference Application ElementDescriptionVariants

Analyze Power and Energy

Double-click Analyze Power and Energy to open a live script. Run the script to evaluate and report power and energy consumption at the component- and system-level. For more information about the live script, see Analyze Power and Energy.

NA

Drive Cycle Source block — FTP75 (2474 seconds)

Generates a standard or user-specified drive cycle velocity versus time profile. Block output is the selected or specified vehicle longitudinal speed.

 
Environment subsystem

Creates environment variables, including road grade, wind velocity, and atmospheric temperature and pressure.

 
Longitudinal Driver subsystem

Uses the Longitudinal Driver or Open Loop variant to generate normalized acceleration and braking commands.

  • Longitudinal Driver variant implements a driver model that uses vehicle target and reference velocities.

  • Open Loop variant allows you to configure the acceleration, deceleration, gear, and clutch commands with constant or signal-based inputs.

Controllers subsystem

Implements a powertrain control module (PCM) containing a P2 hybrid control module (HCM), an engine control module (ECM), and a transmission control module (TCM).

Passenger Car subsystem

Implements a hybrid passenger car that contains drivetrain, electric plant, and engine subsystems.

Visualization subsystem

Displays vehicle-level performance, battery state of charge (SOC), fuel economy, and emission results that are useful for powertrain matching and component selection analysis.

 

Evaluate and Report Power and Energy

Double-click Analyze Power and Energy to open a live script. Run the script to evaluate and report power and energy consumption at the component- and system-level. For more information about the live script, see Analyze Power and Energy.

The script provides:

  • An overall energy summary that you can export to an Excel® spreadsheet.

  • Engine plant, electric plant, and drivetrain plant efficiencies, including an engine histogram of time spent at the different engine plant efficiencies.

  • Data logging so that you can use the Simulation Data Inspector to analyze the powertrain efficiency and energy transfer signals.

For more information about the live script, see Analyze Power and Energy.

Drive Cycle Source

The Drive Cycle Source block generates a target vehicle velocity for a selected or specified drive cycle. The reference application has these options.

TimingVariantDescription

Output sample time

Continuous (default)

Continuous operator commands

Discrete

Discrete operator commands

Longitudinal Driver

The Longitudinal Driver subsystem generates normalized acceleration and braking commands. The reference application has these variants.

Block Variants

Description

Longitudinal Driver (default)

Control

Mapped

PI control with tracking windup and feed-forward gains that are a function of vehicle velocity.

Predictive

Optimal single-point preview (look ahead) control.

Scalar

Proportional-integral (PI) control with tracking windup and feed-forward gains.

Low-pass filter (LPF)

LPF

Use an LPF on target velocity error for smoother driving.

pass

Do not use a filter on velocity error.

Shift

Basic

Stateflow® chart models reverse, neutral, and drive gear shift scheduling.

External

Input gear, vehicle state, and velocity feedback generates acceleration and braking commands to track forward and reverse vehicle motion.

None

No transmission.

Scheduled

Stateflow chart models reverse, neutral, park, and N-speed gear shift scheduling.

Open Loop

Open-loop control subsystem. In the subsystem, you can configure the acceleration, deceleration, gear, and clutch commands with constant or signal-based inputs.

To idle the engine at the beginning of a drive cycle and simulate catalyst light-off before moving the vehicle with a pedal command, use the Longitudinal Driver variant. The Longitudinal Driver subsystem includes an ignition switch signal profile, IgSw. The engine controller uses the ignition switch signal to start both the engine and a catalyst light-off timer.

The catalyst light-off timer overrides the engine stop-start (ESS) stop function control while the catalyst light-off timer is counting up. During the simulation, after the IgSw down-edge time reaches the catalyst light-off time CatLightOffTime, normal ESS operation resumes. If there is no torque command before the simulation reaches the EngStopTime, the ESS shuts down the engine.

To control ESS and catalyst light-off:

  • In the Longitudinal Driver Model subsystem, set the ignition switch profile IgSw to 'on'.

  • In the engine controller model workspace, set these calibration parameters:

    • EngStopStartEnable — Enables ESS. To disable ESS, set the value to false.

    • CatLightOffTime — Engine idle time from engine start to catalyst light-off.

    • EngStopTime — ESS engine run time after driver model torque request cut-off.

Controllers

The Controller subsystem has a PCM containing an ECM, HCM, and TCM. The controller has these variants.

ControllerVariantDescription
ECMSiEngineController (default)

SI engine controller

CiEngineController

CI engine controller

HCM

Optimal Control (default)

Energy Management System

Implements an equivalent consumption minimization strategy (ECMS)2 that minimizes energy consumption while maintaining the battery state of charge (SOC).

Implements either adaptive or non-adaptive ECMS.

  • (default) Non-adaptive — ECMS uses a constant equivalence factor. Use this method to determine the best fuel economy over a drive cycle.

  • Adaptive — ECMS adjusts an equivalence factor with the output of a PI controller. Use this method to help sustain the charge over different drive cycles.

Rule-Based ControlP2 Supervisory Control

Implements a dynamic supervisory controller that determines the engine torque, motor torque, starter, clutch, and brake pressure commands.

Regen Braking Control

Implements a parallel or series regenerative braking controller during rule-based control.

ECMS Control

The HCM implements a dynamic supervisory controller that determines the engine torque, motor torque, starter, clutch, and brake pressure commands. Specifically, the HCM:

  • Converts the driver accelerator pedal signal to a wheel torque request. To calculate the total powertrain torque at the wheels, the algorithm uses the maximum engine torque and motor torque curves and the transmission and differential gear ratios.

  • Converts the driver brake pedal signal to a brake pressure request. The algorithm multiplies the brake pedal signal by a maximum brake pressure.

  • Implements a regenerative braking algorithm for the traction motor to recover the maximum amount of kinetic energy from the vehicle.

The HCM implements an ECMS algorithm2 that optimizes the torque split between the engine and motor to minimize energy consumption while maintaining the battery state of charge (SOC). Specifically, the ECMS:

  • Assigns a cost to electrical energy, so that using stored electrical energy is equal to consuming fuel energy.

    Battery ModeEquivalent Electrical EnergyDescription

    Discharging

    Positive

    Battery discharges stored electrical energy when the electric machine is in use.

    Charging

    Negative

    Battery stores electrical energy from either the:

    • Engine and electric machine acting as a generator.

    • Electric machine acting as a generator during regenerative braking.

  • Is an instantaneous minimization method that the software solves at every controller time step. It can provide near optimal control for a known drive cycle. To implement the strategy at every controller time step, ECMS:

    1. Creates a control torque vector of the driver torque command and full motor torque range.

      [TrqCmdMinMotTrq0+MaxMotTrq]

    2. Checks actuator and battery constraints. Determines if any elements in the control torque vector are infeasible.

      τactuatormin(ω)τactuator τactuatormax(ω)Pbattcharge(SOC)Pbatt Pbattdischarge(SOC)Ibattcharge(SOC)Ibatt Ibattdischarge(SOC)SOCminSOC SOCmax

    3. Calculates and minimizes the equivalent consumption using these equations.

      minP=Pfuel+spenaltyPelectrical+Pconstraint+Peng_power_changepenalty=1(SOC(t)SOCtarget[SOCmaxSOCmin2])a

  • Implements either adaptive or non-adaptive ECMS method. The HEV architectures are charge-sustaining, meaning the battery SOC must remain in a specified range because there is no plugin capability to recharge the battery. The battery is an energy buffer, and all energy comes from the fuel if the change in SOC is minimized over a drive cycle. To charge sustain over a specified drive cycle, the reference application implements either of these ECMS methods.

    ECMS MethodDescription

    Non-adaptive ECMS (default)

    Reference application uses a constant equivalence factor.

    • By default, the reference application uses a single constant. You can also use a vector of equivalence factors.

    • Use this method to determine the best fuel economy over a drive cycle.

      • Use an iterative method to find an equivalence factor which minimizes the delta SOC over a drive cycle. If the delta SOC is minimized, you can compare the fuel economy directly to a conventional powertrain. If there is difficulty with charge sustaining over a single drive cycle, simulate the drive cycle cyclically 2 or 3 times.

      • If you change the drive cycle or HEV architecture, retune the equivalence factor.

    Adaptive ECMS

    Reference application adjusts the equivalence factor with the output of PI controller.

    • PI controller minimizes the error between the target SOC and current SOC.

    • Use this method to maintain the SOC and minimize the delta SOC over many drive cycles.

      • Tune the PI controller gains.

      • Robustly sustains the SOC.

The equations use these variables.

P

Equivalent consumption

Pfuel

Engine power based on fuel flow

s

ECMS equivalence factor

penalty

Multiplicative penalty to assist with sustaining charge

a

Multiplicative penalty shape function

Pelectrical

Electrical power from battery voltage and current

Pconstraint

Constraint penalty cost

Peng_power_change

Engine power rate change cost

SOCtarget, SOCmax, SOCmin

Target SOC, maximum SOC, and minimum SOC, respectively

TrqCmd

Torque command

MinMotTrq, MaxMotTrq

Minimum motor torque and maximum motor torque, respectively

τactuator, τactuatormin, τactuatormax

Actuator constraint, minimum actuator constraint, and maximum actuator constraint, respectively

Pbatt, Pbattcharge, Pbattdischarge

Battery power constraint, battery power discharge constraint, and battery power charge constraint, respectively

Ibatt, Ibattcharge, Ibattdischarge

Battery current constraint, battery current discharge constraint, and battery current charge constraint, respectively

Rule-Based Control

The HCM implements a dynamic supervisory controller that determines the engine torque, motor torque, starter, clutch, and brake pressure commands. Specifically, the HCM:

  • Converts the driver accelerator pedal signal to a torque request. The algorithm uses the optimal engine torque and maximum motor torque curves to calculate the total powertrain torque.

  • Converts the driver brake pedal signal to a brake pressure request. The algorithm multiplies the brake pedal signal by a maximum brake pressure.

  • Implements a regenerative braking algorithm for the traction motor to recover the maximum amount of kinetic energy from the vehicle.

  • Implements a virtual battery management system. The algorithm outputs the dynamic discharge and charge power limits as functions of battery SOC.

The HCM determines the vehicle operating mode through a set of rules and decision logic implemented in Stateflow. The operating modes are functions of motor speed and requested torque. The algorithm uses the calculated power request, accelerator pedal, battery SOC, and vehicle speed rules to transition between electric vehicle (EV) and parallel HEV modes.

ModeDescription

EV

Traction motor provides the torque request.

Parallel HEV

The engine and the motor split the power request. Based on the target battery SOC and available kinetic energy, the HEV mode determines a charge sustain power level. The parallel HEV mode adds the charge sustain power to the engine power command. To provide the desired charge sustain power, the traction motor acts as a generator if charging is needed, and as a motor if discharging is needed. If the power request is greater than the engine power, the traction motor provides the remainder of the power request.

Stationary

While the vehicle is at rest, the engine and generator can provide optional charging if battery SOC is below a minimum SOC value.

The HCM controls the motor, and engine through a set of rules and decision logic implemented in Stateflow.

ControlDescription

Engine

  • Decision logic determines the engine operation modes (off, start, on).

  • To start the engine in engine start (stationary) mode, the motor closes clutch 1 and puts the transmission in neutral. If the high-voltage battery SOC is low, the mode uses the low-voltage starter motor.

  • To start the engine in engine start (driving) mode, the mode uses the low-voltage starter motor with clutch 1 open. To connect the driveline, the engine controller matches the engine and motor speeds and closes clutch 1.

  • In engine on (stationary) mode, lookup tables determine the engine torque and engine speed that optimizes the brake-specific fuel consumption (BSFC) for a given engine power request. The ECM uses the optimal engine torque command. The motor control uses the optimal engine speed command.

  • In engine on (parallel HEV) mode, a lookup table determines the engine torque for a given engine power. However, because the drivetrain couples the engine and wheel speeds, engine on mode might not operate at speeds that minimize BSFC.

Motor

A rule-based power management algorithm calculates a motor torque that does not exceed the dynamic power limits.

Passenger Car

To implement a passenger car, the Passenger Car subsystem contains drivetrain, electric plant, and engine subsystems. To create your own engine variants for the reference application, use the CI and SI engine project templates. The reference application has these variants.

Drivetrain SubsystemVariantDescription

Differential and Compliance

All Wheel Drive

Configure drivetrain for all wheel, front wheel, or rear wheel drive. For the all wheel drive variant, you can configure the type of coupling torque.

Front Wheel Drive (default)
Rear Wheel Drive

Vehicle

Vehicle Body 3 DOF Longitudinal

Configured for 3 degrees of freedom

Wheels and Brakes

Longitudinal Wheel - Front 1

For the wheels, you can configure the type of:

  • Brake

  • Force calculation

  • Resistance calculation

  • Vertical motion

For performance and clarity, to determine the longitudinal force of each wheel, the variants implement the Longitudinal Wheel block. To determine the total longitudinal force of all wheels acting on the axle, the variants use a scale factor to multiply the force of one wheel by the number of wheels on the axle. By using this approach to calculate the total force, the variants assume equal tire slip and loading at the front and rear axles, which is common for longitudinal powertrain studies. If this is not the case, for example when friction or loads differ on the left and right sides of the axles, use unique Longitudinal Wheel blocks to calculate independent forces. However, using unique blocks to model each wheel increases model complexity and computational cost.

Longitudinal Wheel - Rear 1

Electric Plant SubsystemVariantDescription

Battery

BattHevP2

Configured with Lithium Ion battery and DC-DC converter

Low Voltage Starting System

StarterSystemP2

Configured with a low voltage starting system

Motor

MotMapped (default)

Mapped motor with implicit controller

MotDynamic

Interior permanent magnet synchronous motor (PMSM) with controller

Engine SubsystemVariantDescription
Engine

SiEngine

Dynamic SI engine with turbocharger

SiMappedEngine (default)

Mapped SI engine with implicit turbocharger

SiDLEngine

Deep learning SI engine

CiEngine

Dynamic CI engine with turbocharger

CiMappedEngine

Mapped CI engine with implicit turbocharger

Acknowledgement

MathWorks® would like to acknowledge the contribution of Dr. Simona Onori to the ECMS optimal control algorithm implemented in this reference application. Dr. Onori is a Professor of Energy Resources Engineering at Stanford University. Her research interests include electrochemical modeling, estimation and optimization of energy storage devices for automotive and grid-level applications, hybrid and electric vehicles modeling and control, PDE modeling, and model-order reduction and estimation of emission mitigation systems. She is a senior member of IEEE®.

References

[1] Balazs, A., Morra, E., and Pischinger, S., Optimization of Electrified Powertrains for City Cars. SAE Technical Paper 2011-01-2451. Warrendale, PA: SAE International Journal of Alternative Powertrains, 2012.

[2] Onori, S., Serrao, L., and Rizzoni, G., Hybrid Electric Vehicles Energy Management Systems. New York: Springer, 2016.

See Also

| | | | | | |

Related Examples

More About