Skip to content

Commit

Permalink
adapting warnings about emission class parameters #21
Browse files Browse the repository at this point in the history
  • Loading branch information
behrisch committed Nov 29, 2024
1 parent 55d5f98 commit addc679
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
22 changes: 14 additions & 8 deletions src/utils/emissions/EnergyParams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,21 @@ EnergyParams::EnergyParams(const SUMOVTypeParameter* typeParams) {
if (typeParams->wasSet(VTYPEPARS_MASS_SET)) {
myMap[SUMO_ATTR_MASS] = typeParams->mass;
}
if (typeParams->wasSet(VTYPEPARS_WIDTH_SET)) {
myMap[SUMO_ATTR_WIDTH] = typeParams->width;
}
if (typeParams->wasSet(VTYPEPARS_HEIGHT_SET)) {
myMap[SUMO_ATTR_HEIGHT] = typeParams->height;
myMap[SUMO_ATTR_WIDTH] = typeParams->width;
myMap[SUMO_ATTR_HEIGHT] = typeParams->height;
const std::string& ecName = PollutantsInterface::getName(typeParams->emissionClass);
if ((typeParams->vehicleClass & (SVC_PASSENGER | SVC_HOV | SVC_TAXI | SVC_E_VEHICLE)) == 0 && myMap.count(SUMO_ATTR_FRONTSURFACEAREA) == 0) {
if (StringUtils::startsWith(ecName, "MMPEVEM") || StringUtils::startsWith(ecName, "Energy")) {
WRITE_WARNINGF(TL("Vehicle type '%' uses the emission class '%' which does not have proper defaults for its vehicle class. "
"Please use a different emission class or complete the vType definition with further parameters."), typeParams->id, ecName);
if (!typeParams->wasSet(VTYPEPARS_MASS_SET)) {
WRITE_WARNING(TL(" And also set a vehicle mass!"));
}
}
}
if (!StringUtils::startsWith(PollutantsInterface::getName(typeParams->emissionClass), "MMPEVEM")) {
if (typeParams->hasParameter(toString(SUMO_ATTR_INTERNALMOMENTOFINERTIA))) {
WRITE_WARNINGF(TL("Vehicle type '%' uses the Energy model with parameter 'internalMomentOfInertia' which is deprecated. Use 'rotatingMass' instead."), typeParams->id);
if (!StringUtils::startsWith(ecName, "MMPEVEM")) {
if (myMap.count(SUMO_ATTR_INTERNALMOMENTOFINERTIA) > 0) {
WRITE_WARNINGF(TL("Vehicle type '%' uses the Energy model parameter 'internalMomentOfInertia' which is deprecated. Use 'rotatingMass' instead."), typeParams->id);
if (!typeParams->hasParameter(toString(SUMO_ATTR_ROTATINGMASS))) {
myMap[SUMO_ATTR_ROTATINGMASS] = myMap[SUMO_ATTR_INTERNALMOMENTOFINERTIA];
}
Expand Down
4 changes: 2 additions & 2 deletions tests/complex/emissions/nefz_energy_vtype/errors.complex
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Warning: Vehicle type 'soulEV65' uses the Energy model with parameter 'internalMomentOfInertia' which is deprecated. Use 'rotatingMass' instead.
Warning: Vehicle type 'soulEV65' uses the Energy model with parameter 'internalMomentOfInertia' which is deprecated. Use 'rotatingMass' instead.
Warning: Vehicle type 'soulEV65' uses the Energy model parameter 'internalMomentOfInertia' which is deprecated. Use 'rotatingMass' instead.
Warning: Vehicle type 'soulEV65' uses the Energy model parameter 'internalMomentOfInertia' which is deprecated. Use 'rotatingMass' instead.

0 comments on commit addc679

Please sign in to comment.