Skip to content

Commit

Permalink
fix #14447
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed Mar 1, 2024
1 parent c5ca904 commit 651456d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/microsim/devices/MSDevice_FCD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ MSDevice_FCD::getDefaultMask() {
mask.reset(SUMO_ATTR_ODOMETER);
mask.reset(SUMO_ATTR_SPEED_LAT);
mask.reset(SUMO_ATTR_POSITION_LAT);
mask.reset(SUMO_ATTR_ARRIVALDELAY);
return mask;
}

Expand Down Expand Up @@ -167,19 +168,18 @@ MSDevice_FCD::initOnce() {
}
}
if (oc.isSet("fcd-output.attributes")) {
myWrittenAttributes = 0;
myWrittenAttributes.reset();
for (std::string attrName : oc.getStringVector("fcd-output.attributes")) {
if (!SUMOXMLDefinitions::Attrs.hasString(attrName)) {
if (attrName == "all") {
myWrittenAttributes = ~0;
myWrittenAttributes.set();
} else {
WRITE_ERRORF(TL("Unknown attribute '%' to write in fcd output."), attrName);
}
continue;
}
int attr = SUMOXMLDefinitions::Attrs.get(attrName);
assert(attr <= 63);
myWrittenAttributes |= ((long long int)1 << attr);
myWrittenAttributes.set(attr);
}
}

Expand Down
8 changes: 8 additions & 0 deletions src/microsim/output/MSFCDExport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,14 @@ MSFCDExport::write(OutputDevice& of, SUMOTime timestep, bool elevation) {
of.writeAttr(StringUtils::escapeXML(key), StringUtils::escapeXML(value));
}
}
if (of.useAttribute(SUMO_ATTR_ARRIVALDELAY, mask)) {
double arrivalDelay = baseVeh->getStopArrivalDelay();
if (arrivalDelay == INVALID_DOUBLE) {
// no upcoming stop also means that there is no delay
arrivalDelay = 0;
}
of.writeOptionalAttr(SUMO_ATTR_ARRIVALDELAY, arrivalDelay, mask);
}
of.closeTag();
}
// write persons and containers
Expand Down
2 changes: 1 addition & 1 deletion src/microsim/output/MSStopOut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ MSStopOut::stopEnded(const SUMOVehicle* veh, const SUMOVehicleParameter::Stop& s
myDevice.writeAttr("delay", delay);
}
if (stop.arrival >= 0) {
myDevice.writeAttr("arrivalDelay", arrivalDelay);
myDevice.writeAttr(SUMO_ATTR_ARRIVALDELAY, arrivalDelay);
}
myDevice.writeAttr("initialPersons", si.initialNumPersons);
myDevice.writeAttr("loadedPersons", si.loadedPersons);
Expand Down
1 change: 1 addition & 0 deletions src/utils/xml/SUMOXMLDefinitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ StringBijection<int>::Entry SUMOXMLDefinitions::attrs[] = {
{ "odometer", SUMO_ATTR_ODOMETER },
{ "posLat", SUMO_ATTR_POSITION_LAT },
{ "speedLat", SUMO_ATTR_SPEED_LAT },
{ "arrivalDelay", SUMO_ATTR_ARRIVALDELAY },

// Edge
{ "id", SUMO_ATTR_ID },
Expand Down
4 changes: 4 additions & 0 deletions src/utils/xml/SUMOXMLDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,10 @@ enum SumoXMLAttr {
SUMO_ATTR_ODOMETER = 61,
SUMO_ATTR_POSITION_LAT = 62,
SUMO_ATTR_SPEED_LAT = 63,

// only usable with SumoXMLAttrMask
SUMO_ATTR_ARRIVALDELAY = 64,

/// @}

/// @name common attributes
Expand Down

0 comments on commit 651456d

Please sign in to comment.