Skip to content

Commit

Permalink
fix #14823
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed May 5, 2024
1 parent a7ccca7 commit a34ed73
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/microsim/transportables/MSStage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ MSStage::getArrived() const {

SUMOTime
MSStage::getDuration() const {
return myArrived > 0 ? myArrived - myDeparted : SUMOTime_MAX;
return myArrived >= 0 ? myArrived - myDeparted : SUMOTime_MAX;
}


Expand Down
7 changes: 6 additions & 1 deletion src/microsim/transportables/MSStageWaiting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ MSStageWaiting::getPlannedDuration() const {
return myWaitingDuration;
}

SUMOTime
MSStageWaiting::getDuration() const {
return myType == MSStageType::WAITING_FOR_DEPART ? 0 : MSStage::getDuration();
}

Position
MSStageWaiting::getPosition(SUMOTime /* now */) const {
if (myStopWaitPos != Position::INVALID) {
Expand Down Expand Up @@ -108,7 +113,7 @@ void
MSStageWaiting::tripInfoOutput(OutputDevice& os, const MSTransportable* const) const {
if (myType != MSStageType::WAITING_FOR_DEPART) {
os.openTag(SUMO_TAG_STOP);
os.writeAttr("duration", time2string(myArrived - myDeparted));
os.writeAttr("duration", getDuration() != SUMOTime_MAX ? time2string(getDuration()) : "-1");
os.writeAttr("arrival", time2string(myArrived));
os.writeAttr("arrivalPos", toString(myArrivalPos));
os.writeAttr("actType", myActType == "" ? "waiting" : myActType);
Expand Down
3 changes: 3 additions & 0 deletions src/microsim/transportables/MSStageWaiting.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,12 @@ class MSStageWaiting : public MSStage {
SUMOTime getPlannedDuration() const;

SUMOTime getTravelTime() const {
// not a travelling stage
return 0;
}

SUMOTime getDuration() const;

SUMOTime getStopEnd() const {
return myStopEndTime;
}
Expand Down
8 changes: 4 additions & 4 deletions src/microsim/transportables/MSTransportable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,10 @@ MSTransportable::tripInfoOutput(OutputDevice& os) const {
travelTimeOK = false;
}
}
//os.writeAttr(SUMO_ATTR_DURATION, durationOK ? time2string(duration) : "-1");
//os.writeAttr(SUMO_ATTR_WAITINGTIME, waitingTimeOK ? time2string(waitingTime) : "-1");
//os.writeAttr(SUMO_ATTR_TIMELOSS, timeLossOK ? time2string(timeLoss) : "-1");
//os.writeAttr(SUMO_ATTR_TRAVELTIME, travelTimeOK ? time2string(travelTime) : "-1");
os.writeAttr(SUMO_ATTR_DURATION, durationOK ? time2string(duration) : "-1");
os.writeAttr(SUMO_ATTR_WAITINGTIME, waitingTimeOK ? time2string(waitingTime) : "-1");
os.writeAttr(SUMO_ATTR_TIMELOSS, timeLossOK ? time2string(timeLoss) : "-1");
os.writeAttr(SUMO_ATTR_TRAVELTIME, travelTimeOK ? time2string(travelTime) : "-1");
for (MSStage* const i : *myPlan) {
i->tripInfoOutput(os, this);
}
Expand Down

0 comments on commit a34ed73

Please sign in to comment.