Conventional Vehicle Fuel Economy and Emissions

This example shows how to obtain the city and highway fuel economy and tailpipe emissions for a conventional vehicle with a 1.5–L spark-ignition (SI) engine. To run this example, install the city (FTP75) and highway (HWFET) drive cycles. To install, see Install Drive Cycle Data.

To open a script that executes these commands, in the MATLAB® command window, type:

  1. Open the conventional vehicle reference application project.


  2. Prepare the reference application for simulation.

    • Name the subsystems.

      model = 'SiCiPtReferenceApplication';
      dcs = [model, '/Drive Cycle Source'];
      vis_sys = [model, '/Visualization'];

    • Add signal loggers to the models using the function pt_set_logging.

      pt_set_logging([vis_sys,'/Performance Calculations'],'US MPG',...
      'Fuel Economy [mpg]','both')
      pt_set_logging([vis_sys,'/Emission Calculations'],'TP HC Mass (g/mi)',...
      'HC [g/mi]','both')
      pt_set_logging([vis_sys,'/Emission Calculations'],'TP CO Mass (g/mi)',...
      'CO [g/mi]','both')
      pt_set_logging([vis_sys,'/Emission Calculations'],...
      'TP NOx Mass (g/mi)','NOx [g/mi]','both')
      pt_set_logging([vis_sys,'/Emission Calculations'],...
      'TP CO2 Mass (g/km)','CO2 [g/km]','both')

  3. Run a conventional vehicle simulation using the city drive cycle FTP75.

    tfinal = get_param(dcs, 'tfinal');
    tf = tfinal(1:strfind(tfinal,' '));
    simout1 = sim(model,'ReturnWorkspaceOutputs','on', 'StopTime', tf);

  4. Run a conventional vehicle simulation using the highway drive cycle HWFET.

    tfinal = get_param(dcs, 'tfinal');
    tf = tfinal(1:strfind(tfinal,' '));
    simout2 = sim(model,'ReturnWorkspaceOutputs','on', 'StopTime', tf);

  5. Extract the city and highway fuel economy. Calculate a combined fuel economy.

    logsout1 = simout1.get('logsout');
    FE_urban = logsout1.get('Fuel Economy [mpg]').Values.Data(end);
    logsout2 = simout2.get('logsout');
    FE_hwy = logsout2.get('Fuel Economy [mpg]').Values.Data(end);
    FE_combined = 0.55*FE_urban + 0.45*FE_hwy;

  6. Extract the tailpipe emissions from the city drive cycle.

    HC = logsout1.get('HC [g/mi]').Values.Data(end);
    CO = logsout1.get('CO [g/mi]').Values.Data(end);
    NOx = logsout1.get('NOx [g/mi]').Values.Data(end);
    CO2 = logsout1.get('CO2 [g/km]').Values.Data(end);

  7. Display the fuel economy and tailpipe emissions results in the command window.

    fprintf('FUEL ECONOMY\n');
    fprintf('   City:     %4.2f mpg\n', FE_urban);
    fprintf('   Highway:  %4.2f mpg\n', FE_hwy);
    fprintf('   Combined: %4.2f mpg\n', FE_combined);
    fprintf('\nTAILPIPE EMISSIONS\n');
    fprintf('   HC:   %4.3f [g/mi]\n',HC);
    fprintf('   CO:   %4.3f [g/mi]\n',CO);
    fprintf('   NOx:  %4.3f [g/mi]\n',NOx);
    fprintf('   CO2:  %4.1f [g/km]\n',CO2);
    fprintf('   NMOG: %4.3f [g/mi]',HC+NOx);

  8. Remove the temporary variables.

    clear ans dcs model tf tfinal vis_sys


You cannot pause simulations started using the sim command.

Related Examples

More About