From 2e043eaf4606190f876ac32fb60af9ade03fead9 Mon Sep 17 00:00:00 2001 From: schumifabi <95040651+schumifabi@users.noreply.github.com> Date: Thu, 12 Sep 2024 13:40:00 +0200 Subject: [PATCH] bug-fix replanning --- .../matsim/contrib/urban_ev/routing/EvNetworkRoutingModule.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/de/tum/mw/ftm/matsim/contrib/urban_ev/routing/EvNetworkRoutingModule.java b/src/main/java/de/tum/mw/ftm/matsim/contrib/urban_ev/routing/EvNetworkRoutingModule.java index 4e31f90..f33cb3a 100644 --- a/src/main/java/de/tum/mw/ftm/matsim/contrib/urban_ev/routing/EvNetworkRoutingModule.java +++ b/src/main/java/de/tum/mw/ftm/matsim/contrib/urban_ev/routing/EvNetworkRoutingModule.java @@ -152,6 +152,8 @@ public List calcRoute(final Facility fromFacility, final //toDo: Fehler finden!!! List nearestChargers = straightLineKnnFinder.findNearest(stopLocation,chargingInfrastructureSpecification.getChargerSpecifications().values().stream().filter(charger -> charger.getChargerType().contains("dc"))); + if (nearestChargers.size() < 1) {return basicRoute;} + ChargerSpecification selectedCharger = nearestChargers.get(random.nextInt(nearestChargers.size())); Link selectedChargerLink =NetworkUtils.getNearestLink(network, selectedCharger.getCoord());