Skip to content

Commit

Permalink
capture more search states ref #9663
Browse files Browse the repository at this point in the history
Signed-off-by: m-kro <m.barthauer@t-online.de>
  • Loading branch information
m-kro committed May 13, 2024
1 parent c48836d commit 9fb330c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/microsim/devices/MSDevice_StationFinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ MSDevice_StationFinder::notifyMove(SUMOTrafficObject& veh, double /*oldPos*/, do
myChargingStation = nullptr;
mySearchState = SEARCHSTATE_CHARGING;
return true;
} else if (mySearchState == SEARCHSTATE_CHARGING) {
if (myBattery->getChargingStationID() == "") {
mySearchState = SEARCHSTATE_NONE;
} else {
return true;
}
}
// check if the vehicle travels at most an edge length to the charging station after jump/teleport
if (mySearchState == SEARCHSTATE_BROKEN_DOWN && myVeh.hasStops() && myVeh.getStop(0).chargingStation != nullptr && myVeh.getStop(0).chargingStation->getLane().getEdge().getID() == myVeh.getLane()->getEdge().getID()) {
return true;
}
const SUMOTime now = SIMSTEP;
if (myChargingStation != nullptr) {
Expand All @@ -157,6 +167,7 @@ MSDevice_StationFinder::notifyMove(SUMOTrafficObject& veh, double /*oldPos*/, do
if (now - myLastChargeCheck < 1000) {
return true;
} else if (myRescueAction != RESCUEACTION_NONE && (currentSoC < myEmptySoC || currentSoC < NUMERICAL_EPS)) {

// vehicle has to stop at the end of the because battery SoC is too low
double brakeGap = myVeh.getCarFollowModel().brakeGap(myVeh.getSpeed());
std::pair<const MSLane*, double> stopPos = myVeh.getLanePosAfterDist(brakeGap);
Expand Down

0 comments on commit 9fb330c

Please sign in to comment.