Main Content

Drive Cycle Source

Standard or specified longitudinal drive cycle

  • Drive Cycle Source block

Libraries:
Powertrain Blockset / Vehicle Scenario Builder
Vehicle Dynamics Blockset / Vehicle Scenarios / Drive Cycle and Maneuvers

Description

The Drive Cycle Source block generates a standard or user-specified longitudinal drive cycle. The block output is the specified vehicle longitudinal speed, which you can use to:

  • Predict the engine torque and fuel consumption that a vehicle requires to achieve desired speed and acceleration for a given gear shift reference.

  • Produce realistic velocity and shift references for closed loop acceleration and braking commands for vehicle control and plant models.

  • Study, tune, and optimize vehicle control, system performance, and system robustness over multiple drive cycles.

  • Identify the faults within tolerances specified by standardized tests, including:

    • EPA dynamometer driving schedules1

    • Worldwide Harmonised Light Vehicle Test Procedure (WLTP) laboratory tests2

For the drive cycles, you can use:

  • Drive cycles from predefined sources. By default, the block includes the FTP–75 drive cycle. To install additional drive cycles from a support package, see Install Drive Cycle Data. The support package has drive cycles that include the gear shift schedules, for example JC08 and CUEDC.

  • Workspace variables that define your own drive cycles.

  • .mat, .xls, .xlsx, or .txt files.

  • Wide open throttle (WOT) parameters, including initial and nominal reference speed, deceleration start time, and final reference speed.

To achieve the goals listed in the table, use the specified Drive Cycle Source block parameter options.

GoalAction

Repeat the drive cycle if the simulation run time exceeds the drive cycle length.

Select Repeat cyclically.

Output the acceleration, as calculated by Savitzky-Golay differentiation.

Select Output acceleration.

Specify a sample period for discrete applications.

Specify a Output sample period (0 for continuous), dt parameter.

Update the simulation run time so that it equals the length of the drive cycle.

Click Update simulation time. If a model configuration reference exists, the block does not enable this option.

Plot the drive cycle in a MATLAB® figure.

Click Plot drive cycle.

Specify the drive cycle using a workspace variable.

Click Specify variable. The block:

  • Sets the Drive cycle source parameter to Workspace variable.

  • Enables the From workspace parameter.

Specify the workspace variable so that it contains time, velocity, and, optionally, the gear shift schedule. For examples, see Create Drive Cycles Using Workspace Variables.

Specify the drive cycle using a file.

Click Select file. The block:

  • Sets the Drive cycle source parameter to .mat, .xls, .xlsx or .txt file.

  • Enables the Drive cycle source file parameter.

Specify a file that contains time, velocity, and, optionally, the gear shift schedule.

Output drive cycle gear.

Specify a drive cycle that contains a gear shift schedule. You can use:

  • A support package to install standard drive cycles that include the gear shift schedules, for example JC08 and CUEDC.

  • Workspace variables.

  • .mat, .xls, .xlsx, or .txt files.

Click Output gear shift data.

Install additional drive cycles from a support package.

Click Install additional drive cycles. The block enables the parameter if you can install additional drive cycles from a support package.

Identify drive cycle faults within tolerances specified by standardized tests.

On the Fault Tracking tab, use the parameters to specify the fault tolerances. If the vehicle speed is not within the allowable speed range, the block sets a fault condition.

Fault and Failure Tracking

On the Fault Tracking tab, use the parameters to specify the fault tolerances. If the vehicle speed or time is not within the allowable range, the block sets a fault condition.

ParameterDescriptionSetting

EPA Standard1

WLTP Tests2

Speed tolerance

Speed tolerance above the highest point and below the lowest point of the drive cycle speed trace within the time tolerance.

2.0 mph

2.0 km/h

Time tolerance

Time that the block uses to determine the speed tolerance.

1.0 s

1.0 s

Maximum number of faults

Maximum number of faults during the drive cycle.

Not specified10
Maximum single fault time

Maximum fault duration.

2.0 s1.0 s
Maximum total fault time

Maximum accumulated time spent under fault condition.

Not specifiedNot specified

These figures illustrate how the block uses the velocity and time tolerances to determine the allowable speed range.

Speed versus time plot indicating allowable speed range for increasing speed

Speed versus time plot indicating allowable speed range for decreasing speed

Create Drive Cycles Using Workspace Variables

If you set Drive cycle source to Workspace variable, you can specify a workspace variable that defines the drive cycle.

This table provides examples for using workspace variables to create your own drive cycles.

Workspace VariableSource Velocity UnitOutput Velocity UnitDrive Cycle Plot

Structure without a gear shift schedule. From workspace set to myCycleS.

t = 0:1:100;
xdot = 5.*sin(t)+10;
myCycleS.time = t';
myCycleS.signals.values = xdot';

m/smph

Velocity versus time plot showing a sine wave

Structure with a gear shift schedule. From workspace set to myCycleS.

gears=[0, 1, 2, 3, 3, 4, 4, 4, 4, 4, 4];
t=0:1:10;
xdot=[0,5,10,15,20,25,30,30,30,30,30];
myCycleS.time=t';
myCycleS.signals.values=[xdot',gears'];

m/smph

Velocity versus time plot showing a linear increase from 0 mph at 0 seconds to 70 mph at 6 seconds. After 6 seconds, velocity remains constant at 70 mph.

2-D array without a gear shift schedule. From workspace set to myCycleA.

t = 0:1:100;
xdot = 5.*sin(t)+5;
myCycleA = [t',xdot'];

m/smph

Velocity versus time plot showing a sine wave

2-D array with a gear shift schedule. From workspace set to myCycleA.

gears=[0, 1, 2, 3, 4, 4, 4, 5, 5, 5, 5];
t=0:1:10;
xdot=[0,5,10,15,20,25,30,40,50,60,60];
myCycleA=[t',xdot',gears'];

mphmph

Velocity versus time plot showing linear increases from 0 mph at 0 seconds to 30 mph at 6 seconds to 60 mph at 9 sec. After 9 seconds, velocity remains constant at 60 mph.

Time series object without a gear shift schedule. From workspace set to myCycleT.

myCycleT = timeseries;
t = 0:1:100;
xdot = 5.*sin(t)+20;
myCycleT.Data = xdot';
myCycleT.Time = t;

m/smph

Velocity versus time plot showing a sine wave

Time series object without a gear shift schedule. From workspace set to myCycleT.

myCycleT = timeseries;
gears=[0, 1, 2, 3, 4, 4, 4, 5, 5, 5, 5];
t=0:1:10;
xdot=[0,10,20,30,32,33,34,40,50,60,60];
myCycleT.Data = [xdot',gears'];
myCycleT.Time = t';

mphmph

Velocity versus time plot showing linear increases in mph. After 9 seconds, velocity remains constant at 60 mph.

Ports

Input

expand all

Longitudinal vehicle speed.

Dependencies

To enable this port, on the Fault Tracking tab, select Enable fault tracking. Set the Velocity feedback units, inUnit parameter to the VelFdbk input port signal units.

Output

expand all

Bus signal containing these block calculations.

SignalDescription
Reference Speed

Vehicle reference speed

Reference Accel

Vehicle reference acceleration

Gear

Vehicle gear

FaultUpprBnd

Upper bound of allowable vehicle speed range.

LowerBnd

Lower bound of allowable vehicle speed range.

Fault

Boolean value indicating fault condition:

  • 1 — Fault

  • 0 — No fault

If the vehicle speed is not within the allowable speed range, the block sets a fault condition.

FaultCnt

Number of faults.

CumFaultTime

Cumulative time spent in fault condition.

SnglFaultTime

Tim spent in a single fault.

Fail

Boolean value indicating fault failure:

  • 1 — Failure

  • 0 — No failure

If the fault conditions exceed the maximum number of faults, maximum single fault time, or maximum total fault time, the block sets a fault failure.

Dependencies

To enable this port, on the Fault Tracking tab, select Enable fault tracking.

Vehicle reference speed, in units that you specify. To specify the units, use the Output velocity units parameter.

To calculate the acceleration, the block implements Savitzky-Golay differentiation using a second-order polynomial with a three-sample point filter.

Dependencies

To create the output acceleration port, select Output acceleration. Selecting Output acceleration enables the Output acceleration units parameter.

Dependencies

To enable this port:

  1. Specify a drive cycle that contains a gear shift schedule. You can use:

    • A support package to install standard drive cycles that include the gear shift schedules, for example JC08 and CUEDC.

    • Workspace variables.

    • .mat, .xls, .xlsx, or .txt files.

  2. Select Output gear shift data.

Parameters

expand all

Cycle Setup

Setup
  • FTP75 — Load the FTP75 drive cycle from a .mat file into a 1-D Lookup Table block. The FTP75 represents a city drive cycle that you can use to determine tailpipe emissions and fuel economy of passenger cars. To install additional drive cycles from a support package, see Install Drive Cycle Data.

  • Wide Open Throttle (WOT) — Use WOT parameters to specify a drive cycle for performance testing.

  • Workspace variable — Specify time, speed, and, optionally, gear data as a structure, 2-D array, or time series object.

  • .mat, .xls, .xlsx or .txt file — Specify a file that contains time, speed and, optionally, gear data in column format.

Once you have installed additional cycles, you can use set_param to set the drive cycle. For example, to use drive cycle US06:

set_param([gcs '/Drive Cycle Source'],'cycleVar','US06')

Dependencies

The table summarizes the parameter dependencies.

Drive Cycle SourceEnables Parameter
Wide Open Throttle (WOT)

Start time, t_wot1

Initial reference speed, xdot_woto

Nominal reference speed, xdot_wot1

Time to start deceleration, wot2

Final reference speed, xdot_wot2

WOT simulation time, t_wotend

Source velocity units

Workspace variable

From workspace

Source velocity units

Output gear shift data, if drive cycle includes gear shift schedule

.mat, .xls, .xlsx or .txt file

Drive cycle source file
Source velocity units

Output gear shift data, if drive cycle includes gear shift schedule

Monotonically increasing time, velocity, and, optionally, gear data, specified by a structure, 2-D array, or time series object. Enter units for velocity in the Source velocity units parameter field.

A valid point must exist for each corresponding time value. You cannot specify inf, empty, or NaN.

This table provides examples for using workspace variables to create your own drive cycles.

Workspace VariableSource Velocity UnitOutput Velocity UnitDrive Cycle Plot

Structure without a gear shift schedule. From workspace set to myCycleS.

t = 0:1:100;
xdot = 5.*sin(t)+10;
myCycleS.time = t';
myCycleS.signals.values = xdot';

m/smph

Velocity versus time plot showing a sine wave

Structure with a gear shift schedule. From workspace set to myCycleS.

gears=[0, 1, 2, 3, 3, 4, 4, 4, 4, 4, 4];
t=0:1:10;
xdot=[0,5,10,15,20,25,30,30,30,30,30];
myCycleS.time=t';
myCycleS.signals.values=[xdot',gears'];

m/smph

Velocity versus time plot showing a linear increase from 0 mph at 0 seconds to 70 mph at 6 seconds. After 6 seconds, velocity remains constant at 70 mph.

2-D array without a gear shift schedule. From workspace set to myCycleA.

t = 0:1:100;
xdot = 5.*sin(t)+5;
myCycleA = [t',xdot'];

m/smph

Velocity versus time plot showing a sine wave

2-D array with a gear shift schedule. From workspace set to myCycleA.

gears=[0, 1, 2, 3, 4, 4, 4, 5, 5, 5, 5];
t=0:1:10;
xdot=[0,5,10,15,20,25,30,40,50,60,60];
myCycleA=[t',xdot',gears'];

mphmph

Velocity versus time plot showing linear increases from 0 mph at 0 seconds to 30 mph at 6 seconds to 60 mph at 9 sec. After 9 seconds, velocity remains constant at 60 mph.

Time series object without a gear shift schedule. From workspace set to myCycleT.

myCycleT = timeseries;
t = 0:1:100;
xdot = 5.*sin(t)+20;
myCycleT.Data = xdot';
myCycleT.Time = t;

m/smph

Velocity versus time plot showing a sine wave

Time series object without a gear shift schedule. From workspace set to myCycleT.

myCycleT = timeseries;
gears=[0, 1, 2, 3, 4, 4, 4, 5, 5, 5, 5];
t=0:1:10;
xdot=[0,10,20,30,32,33,34,40,50,60,60];
myCycleT.Data = [xdot',gears'];
myCycleT.Time = t';

mphmph

Velocity versus time plot showing linear increases in mph. After 9 seconds, velocity remains constant at 60 mph.

Dependencies

To enable this parameter, select Workspace variable from Drive cycle source.

File containing monotonically increasing time, velocity, and, optionally, gear in column or comma-separated format. The block ignores units in the file. Enter units for velocity in the Source velocity units parameter field.

FileSource Velocity UnitOutput Velocity UnitDrive Cycle Plot

An .xls or .xlsx file with time in column A and velocity in column B.

11 rows with time in column A and velocity in column B

mphmph

Velocity versus time plot

An .xls or .xlsx file with time in column A, velocity in column B, and gear in column C. The block:

  • Ignores the units in the file.

  • Converts the gear information to integers:

    • N to 0

    • D to 2

12 rows with time in sec in column A, velocity in mph in column B, and gear in column C

mphmph

Velocity versus time plot

A .txt with time in column 1 and velocity in column 2. The block ignores the header and units information.

20 rows with time in sec in column A and velocity in mph in column B

mphmph

Velocity versus time plot

If you provide the gear schedule using P, R, N, D, L, OD, the block maps the gears to integers.

Gear

Integer

P

80

R

-1

N

0

L

1

D

2

OD

Next integer after highest specified gear.

For example, the block converts the gear schedule P P N L D 3 4 5 6 5 4 5 6 7 OD 7 to 80 80 0 1 2 3 4 5 6 5 4 5 6 7 8 7.

Dependencies

To enable this parameter, select .mat, .xls, .xlsx or .txt file from Drive cycle source.

Repeat the drive cycle if the simulation run time exceeds the length of the drive cycle.

To calculate the acceleration, the block implements Savitzky-Golay differentiation using a second-order polynomial with a three-sample point filter.

Dependencies

To create the output acceleration port, select Output acceleration. Selecting Output acceleration enables the Output acceleration units parameter.

Dependencies

  • Specify a drive cycle that contains a gear shift schedule. You can use:

    • A support package to install standard drive cycles that include the gear shift schedules, for example JC08 and CUEDC.

    • Workspace variables.

    • .mat, .xls, .xlsx, or .txt files.

  • Clicking this parameter creates input port Gear.

WOT

Drive cycle start time, in s. For example, this plot shows a drive cycle with a start time of 10 s.

Velocity versus time plot

Dependencies

To enable this parameter, select the Drive cycle source parameter Wide Open Throttle (WOT).

Initial reference speed, in units that you specify with the Source velocity units parameter. For example, this plot shows a drive cycle with an initial reference speed of 4 m/s.

Velocity versus time plot

Dependencies

To enable this parameter, select the Drive cycle source parameter Wide Open Throttle (WOT).

Nominal reference speed, in units that you specify with the Source velocity units parameter. For example, this plot shows a drive cycle with a nominal reference speed of 30 m/s.

Velocity versus time plot

Dependencies

To enable this parameter, select the Drive cycle source parameter Wide Open Throttle (WOT).

Time to start vehicle deceleration, in s. For example, this plot shows a drive cycle with vehicle deceleration starting at 25 s.

Velocity versus time plot

Dependencies

To enable this parameter, select the Drive cycle source parameter Wide Open Throttle (WOT).

Final reference speed, in units that you specify with the Source velocity units parameter. For example, this plot shows a drive cycle with a final reference speed of 2 m/s.

Velocity versus time plot

Dependencies

To enable this parameter, select the Drive cycle source parameter Wide Open Throttle (WOT).

Drive cycle WOT simulation time, in s. For example, this plot shows a drive cycle with a simulation time of 50 s.

Velocity versus time plot

Dependencies

To enable this parameter, select the Drive cycle source parameter Wide Open Throttle (WOT).

Units and Sample Period

Input velocity units.

Dependencies

To enable this parameter, select the Drive cycle source parameter Wide Open Throttle (WOT), Workspace variable, or .mat, .xls, .xlsx or .txt file.

Output velocity units.

Specify the output acceleration units.

Dependencies

To enable this parameter, select Output acceleration.

Sample rate. Set to 0 for continuous sample period. For a discrete period, specify a non-zero rate.

Fault Tracking

Fault Settings

Select this parameter to enable drive cycle fault tracking. Use the parameters to specify the fault tolerances. If the vehicle speed is not within the allowable speed range, the block sets a fault condition.

Dependencies

Selecting this parameter enables these parameters:

  • Speed tolerance, velBnd

  • Speed tolerance units, velBndUnit

  • Velocity feedback units, inUnit

  • Time tolerance, timeBnd

The speed tolerance above the highest point and below the lowest point of the drive cycle speed trace within the time tolerance. If the vehicle speed is not within the allowable speed range, the block sets a fault condition. For the tolerances specified by the standardized tests, use these settings:

  • EPA dynamometer driving schedules — 2.0

  • WLTP tests — 2.0

These figures illustrate how the block uses the velocity and time tolerances to determine the allowable speed range.

Speed versus time plot indicating allowable speed range for increasing speed

Speed versus time plot indicating allowable speed range for decreasing speed

Dependencies

To enable this parameter, on the Fault Tracking tab, select Enable fault tracking.

Speed tolerance units. For the units specified by the standardized tests, use these units:

  • EPA dynamometer driving schedules — m/s

  • WLTP tests — km/h

Dependencies

To enable this parameter, on the Fault Tracking tab, select Enable fault tracking.

Velocity feedback units. Set the value to the VelFdbk input port signal units.

Dependencies

To enable this parameter, on the Fault Tracking tab, select Enable fault tracking.

Time that the block uses to determine the speed tolerance. If the vehicle speed is not within the allowable speed range, the block sets a fault condition. For the time tolerances specified by the standardized tests, use these settings:

  • EPA dynamometer driving schedules — 1.0

  • WLTP tests — 1.0

These figures illustrate how the block uses the velocity and time tolerances to determine the allowable speed range.

Speed versus time plot indicating allowable speed range for increasing speed

Speed versus time plot indicating allowable speed range for decreasing speed

Dependencies

To enable this parameter, on the Fault Tracking tab, select Enable fault tracking.

Failure Settings

Select this parameter to enable drive cycle failure tracking.

Dependencies

To enable this parameter, select Enable fault tracking. Selecting Enable failure tracking parameter enables these parameters:

  • Stop simulation when trace fails, stopSim

  • Maximum number of faults, maxFaultCnt

  • Maximum single fault time, maxFaultTime

  • Maximum total fault time, maxTotFaultTime

Maximum number of faults during the drive cycle. For the number specified by the standardized tests, use these settings:

  • EPA dynamometer driving schedules — Not specified

  • WLTP tests — 10

If the number of faults exceeds the maximum number of faults, the block sets a fault failure.

Dependencies

To enable this parameter, on the Fault Tracking tab, select Enable failure tracking.

Maximum duration of single fault, in s. For the time specified by the standardized tests, use these settings:

  • EPA dynamometer driving schedules — 2.0

  • WLTP tests — 1.0

If the fault duration exceeds the maximum single fault time, the block sets a fault failure.

Dependencies

To enable this parameter, on the Fault Tracking tab, select Enable failure tracking.

Maximum accumulated time spent under fault condition, in s.

If the accumulated time spent under fault condition exceeds the maximum total fault time, the block sets a fault failure.

Dependencies

To enable this parameter, on the Fault Tracking tab, select Enable failure tracking.

Simulation Trace

Select this parameter to display a velocity trace window. Selecting this parameter can slow the simulation time.

Dependencies

Selecting this parameter enables these parameters:

  • Simulation trace update rate, dtTrace

  • Simulation trace display window, traceWindow

Simulation trace update rate, in s. Set to 0 for continuous sample period. For a discrete period, specify a non-zero rate.

Dependencies

To enable this parameter, on the Fault Tracking tab, select Display simulation trace.

Simulation trace window update rate, in s.

Dependencies

To enable this parameter, on the Fault Tracking tab, select Display simulation trace.

References

[1] Environmental Protection Agency (EPA). EPA urban dynamometer driving schedule. 40 CFR 86.115-78, July 1, 2001.

[2] European Union Commission. "Speed trace tolerances". European Union Commission Regulation. 32017R1151, Sec 1.2.6.6, June 1, 2017.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2017a