UNITED STATES ENVIRONMENTAL PROTECTION AGENCY

NATIONAL VEHICLE AND FUEL EMISSIONS LABORATORY

2565 PLYMOUTH ROAD

ANN ARBOR, MI 48105-2498

 OFFICE OF

 AIR AND RADIATION

August 18, 2015

MEMORANDUM

SUBJECT: GEM new release (GEM P2v1.1) and known issues and workarounds for GEM P2v1.0)

FROM: Houshun Zhang, OTAQ/TATD

TO: Greenhouse Gas Emissions Standards and Fuel Efficiency Standards for Medium- and 

Heavy-Duty Engines and Vehicles - Phase 2 - EPA-HQ-OAR-2014-0827

The GEM being released under this memo is GEM P2v1.1, which includes all bugs and issues fixed and 

addressed found in GEM P2v1.0. For this release, two versions of GEM will be released to the public. 

The first one is the one that can be down loaded from the EPA website at 

http://www.epa.gov/otaq/climate/gem.htm, while the second version is the source code that is used to 

generate the executable code. Since nothing has been changed in Matlab/Simulink source code that 

affects stringency runs in this new release and users can make any changes they want with this type of 

source code, we will not continue to release the Matlab/Simulink version to users at this time, but users 

can still use the Matlab/Simulink version for their our purposes if they prefer.

This memo is also a collection of known issues that affect the released versions of GEM P2v1.0 

associated with the NPRM. “Errors” refer to GEM crashes, “Issues” are problems that cause incorrect 

simulation results but do not result in crashes.

In this memo, GEM_P2v1.0 is the version we released to public through the EPA website and 

GEM_P2v1.0s was released later to expert users on July 13, 2015.

It is highly recommended that users read readme.txt before running GEM, since some new features that 

are added into this version show how to make the GEM run more efficiently. 
2

GEM_P2v1.0s Error:

Undefined variable "enum_transmission_gear_select" or function 

"enum_transmission_gear_select.autoshift3".

Workaround:

1) in 'REVS_Common\datatypes\' 

 copy 'enum_transmission_control_type.m' to 'enum_transmission_gear_select.m'

2) edit 'enum_transmission_gear_select.m' and change

classdef enum_transmission_control_type < Simulink.IntEnumType

 to

classdef enum_transmission_gear_select < Simulink.IntEnumType

4) edit 'REVS_Common\calcs_transmission.m' and add

 transmission_control_type = transmission_gear_select;

 at line 3.

5) save the changed files.

Notes:

This error was the result of releasing a mix of old and new code. This error affects only

GEM_P2v1.0s (power user release).

Resolution: 

GEM_P2v1.1 contains updated source code that only uses transmission_gear_select and 

enum_transmission_gear_select, transmission_control_type and enum_transmission_control_type have 

been removed.
3

GEM_P2v1.0 and GEM_P2v1.0s Error:

Reference to non-existent field ‘calcs’.

Error in => GEM_main.m at line 251

Workaround:

In GEM_gen_tractor.m, at line 48 (after “calcs_transmission;”) add

if (transmission_type == enum_transmission_type.automatic)

transmission.torque_converter = calcs_torque_converter(transmission.torque_converter, 

config.verbose);

end

Notes:

Due to this bug, Tractor-trailers with automatic transmission cannot be simulated due to the lack 

of torque converter calculations. This bug affects GEM_P2v1.0 and GEM_P2v1.0s.

Resolution: 

GEM_P2v1.1 implements the workaround mentioned above.
4

GEM_P2v1.0 and GEM_P2v1.0s Issue:

Transmission input losses are incorrectly calculated for manual transmission Vocational 

vehicles.

Workaround:

Delete line 110 of GEM_gen_voc_transmission:

transmission.gear.input_torque_loss_Nm.table = [0 17 19 22 25 28];

Notes:

The losses from line 110 apply to HHD_R vehicles, other manual transmission vehicles should 

have those losses divided by 3.73, as intended on line 103. This bug affects GEM_P2v1.0 and 

GEM_P2v1.0s

Resolution: 

GEM_P2v1.1 implements the workaround mentioned above.
5

GEM_P2v1.0 and GEM_P2v1.0s Issue:

Incorrect handling of manual transmission gear efficiency for 1:1 ratios.

Workaround:

In GEM_gen_voc_transmission.m, correct line 118 from:

transmission.gear.efficiency_norm.table = (transmission.gear.number == 1.0) * 0.02 + 

0.96;

to

transmission.gear.efficiency_norm.table = (transmission.gear.ratio == 1.0) * 0.02 + 0.96;

In GEM_gen_trac_transmission.m, correct line 115 from:

transmission.gear.efficiency_norm.table = (transmission.gear.number == 1.0) * 0.02 + 

0.96;

to

transmission.gear.efficiency_norm.table = (transmission.gear.ratio == 1.0) * 0.02 + 0.96;

Notes:

This bug affects manual transmission vehicles in GEM_P2v1.0 and GEM_P2v1.0s.

Resolution: 

GEM_P2v1.1 implements the workaround mentioned above.
6

GEM_P2v1.0 Error:

Invalid file identifier. Use fopen to generate a valid file identifier.

Error in => GEM_main.m at line 80

Workaround:

Make sure the input .csvs are in a folder where the user has read/write privileges, or run GEM 

with administrator rights.

Notes:

Mostly seems to affect GEM_P2v1.0 depending on how it was installed and where the sample 

files are located.

Resolution:

Added troubleshooting hints to GEM error messages.
7

GEM_P2v1.0 Error:

Unable to read file ‘XXXX\YYYY\run_TRL1_output.mat’: so such file or directory.

Error in => GEM_main.m at line 251

Workaround:

Reboot computer.

Notes:

There has only been one reported case of this error, the simulation ran and tried to open the 

ouptut .mat file but there was a file system error of some kind. Rebooting the laptop seemed to fix it. 

The error was present for all regulatory categories.
8

GEM_P2v1.0 Error:

Attempted to access result.phase_NV_ratio(2); index out of bounds because 

numel(result.phase_NV_ratio)=1.

Error in => GEM_main.m at line 251

Workaround:

Make sure the engine motoring torque curve is non-zero and negative. Engine drag is required to 

downspeed the engine during upshifts. Without engine drag the shift will not complete.

Notes:

Affects GEM_P2v1.0 and GEM_P2v1.0s. Shouldn’t be a problem for certification if proper test 

procedures are followed and real data is provided. Should probably run some kind of error check on the 

motoring torque, though.

Resolution: 

Changed upper limit of motoring torque curve values from 0 to -0.1 in GEM_P2v1.1, but may

need upper limit that varies with engine speed.
9

GEM_P2v1.0 and GEM_P2v1.0s Issue:

Late downshift after losing speed on cruise cycles with high grade and vehicles with low torque 

to weight ratios.

Workaround:

None, needs to be addressed as a calibration change to the shift schedule.

Notes:

Several solutions are available, we just need to pick one and implement it for the FRM.
10

GEM_P2v1.0 and GEM_P2v1.0s Error:

Processing “..\XXXXX\yyyy.csv”

Unable to Create Output File

--- Simulation Aborted! ---

Workaround:

If you are re-running a previous file, make sure the old ‘yyyy_results.csv’ file is not open in 

another program like Excel or WordPad, for example.

Notes:

Affects GEM_P2v1.0 and GEM_P2v1.0s. Possibly we should include troubleshooting hints in 

the GEM dialog for common errors like this one.

Resolution:

Added troubleshooting hints for this error.
11

GEM_P2v1.0 Issue:

When launching GEM.exe, a dialog box with the following error appears:

There is no disk in the drive. Please insert a disk into drive \Device\Harddisk3\DR3.

Workaround:

Choose “Cancel”,”Try Again” or “Continue” or close the dialog box. GEM should continue 

without further errors.

Notes:

My installation of GEM was done remotely by a network connection in order to have admin 

rights, so maybe something about that install process created this strange issue.
12

GEM_P2v1.0 and GEM_P2v1.0s Error: 

GEM will issue an error when Crr is lower than 4.2 and higher than 8.5

Workaround: 

None because this upper and lower bound is pre-specified by the agency

Notes: 

The lower and upper bounds will be further extended to 3.5 and 10.7 in the final GEM 

Resolution:

Lower and upper bounds for Crr are now in the range between 3.5 and 10.7 in GEM_P2v1.1
13

GEM_P2v1.0 Error:

Inner matrix dimensions must agree.

Error in => GEM_main.m at line 245

Workaround:

Check the Engine Full Load Torque Curve and make sure the last point is zero torque at 

maximum speed or add such a point if it does not exist.

Notes:

Need to check whether the code enforces zero torque endpoints or whether they are specified by

the regs or test procedure.

Resolution:

Added code to enforce zero torque end point on the full load torque curve.
14

GEM_P2v1.0 and GEM_P2v1.0s Error: 

GEM will issue an error when aero bin input is lower than 4.1

Workaround: 

None because this upper and lower bound is pre-specified by the agency

Notes: 

The lower bound will be further extended to 3.8 in the final GEM 

Resolution:

Lower bound for CdA reduced to 3.8 in GEM_P2v1.1
15

GEM_P2v1.0 and GEM_P2v1.0s Error: 

GEM will issue an error when gear ratio is higher than 25

Workaround: 

None because this upper and lower bound is pre-specified by the agency

Notes: 

The higher bound will be further extended to 27 in the final GEM 

Resolution:

Higher bound for gear ratio increased to 27 in GEM_P2v1.1
16

GEM_P2v1.0 and GEM_P2v1.0s Issue:

Torque converter unlock at highway speeds.

Workaround:

None, needs to be addressed as a calibration change.

Notes:

Original unlock schedule was based on production data obtained from an OEM.

Resolution:

Unlock schedule has been modified in GEM_P2v1.1.
17