Main Content

Explore the Hybrid Electric Vehicle P3 Reference Application

The hybrid electric vehicle (HEV) P3 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 P3 hybrid. To create and open a working copy of the reference application project, enter

By default, the HEV P3 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.


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 P3 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.


Output sample time

Continuous (default)

Continuous operator commands


Discrete operator commands

Longitudinal Driver

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

Block Variants


Longitudinal Driver (default)



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


Optimal single-point preview (look ahead) control.


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

Low-pass filter (LPF)


Use an LPF on target velocity error for smoother driving.


Do not use a filter on velocity error.



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


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


No transmission.


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.


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

ECMSiEngineController (default)

Implements the SI Controller


Implements the CI Controller



Implements the Equivalent Consumption Minimization Strategy



Implements the transmission controller

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 subsystem 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

Torque Converter Automatic Transmission

Ideal Fixed Gear Transmission

Configure locked and unlocked transmission efficiency with either a 1D or 4D (default) lookup table.

Torque Converter

Configure for external, internal (default), or no lockup.


Vehicle Body 1 DOF Longitudinal

Configured for 1 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

Simscape Drivetrain.  Another way to customize the drivetrain is to select a Simscape™ variant. This variant incorporates physical connections to provide a flexible way to assemble components.

Use the button in the top level of the reference application to toggle between Simscape and Powertrain Blockset variants of the drivetrain subsystem.

The reference application sets the appropriate solvers to optimize performance for each engine and drivetrain combination. Select the engine variant first, then select the drivetrain using the toggle button. If you select the drivetrain before changing the engine, you may encounter a solver error.

Electric Plant

Electric Plant SubsystemVariantDescription



Configured with Lithium Ion battery

Electric Machine


Mapped Motor with implicit controller


Engine SubsystemVariantDescription


Dynamic SI Core Engine with turbocharger

SiMappedEngine (default)

Mapped SI Engine with implicit turbocharger


Dynamic naturally aspirated SI Core Engine


MathWorks® used the SI Core Engine and SI Controller to calibrate the hybrid control module (HCM). If you use the CI Core Engine and CI Controller variants, the simulation may error because the HCM does not use calibrated results.


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®.


[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