Skip to content

Commit

Permalink
fix: drt stops creation for every mode
Browse files Browse the repository at this point in the history
  • Loading branch information
tschlenther committed Feb 2, 2024
1 parent a916ea6 commit 4fb3e6e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/main/java/org/matsim/run/prepare/DrtCaseSetup.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,6 @@ public static void prepareScenario(Scenario scenario, DrtCase drtCase, ShpOption
throw new IllegalArgumentException("could not find 'mode' attribute in the given shape file at " + drtArea.getShapeFile().toString());
}
Integer noVehicles = (Integer) feature.getAttribute("noVehicles");
if (noVehicles.equals(null)){
throw new IllegalArgumentException("could not find 'noVehicles' attribute in the given shape file at " + drtArea.getShapeFile().toString());
}

log.info("attempting to create " + noVehicles + " drt vehicles for mode " + drtMode);

Expand All @@ -201,7 +198,12 @@ public static void prepareScenario(Scenario scenario, DrtCase drtCase, ShpOption
//normally the following code would be set in prepareConfig, but..
//.. the stops creator relies on a network with drt modes. Drt modes are added in RunLeipzigScenario.prepareScenario()..
//.. so stops are created after that step -sme0823
multiModeDrtConfigGroup.getModalElements().forEach(drtConfigGroup -> {

String finalDrtMode = drtMode;
DrtConfigGroup drtConfigGroup = multiModeDrtConfigGroup.getModalElements().stream().
filter(cfg -> cfg.getMode().equals(finalDrtMode))
.findFirst().orElseThrow();
// multiModeDrtConfigGroup.getModalElements().forEach(drtConfigGroup -> {

//path, tho which stops.xml is saved
URL path = IOUtils.extendUrl(scenario.getConfig().getContext(), "leipzig-v" + version + "-" + drtConfigGroup.getMode() + "-stops.xml");
Expand All @@ -221,8 +223,8 @@ public static void prepareScenario(Scenario scenario, DrtCase drtCase, ShpOption
//naming pattern comes from @DrtStopsWriter line 81. Should be ok to hard code it here. -sme0523
drtConfigGroup.transitStopFile = stopsFile.toString();

configureNecessaryConfigGroups(scenario.getConfig(), drtConfigGroup.getMode());
});
// configureNecessaryConfigGroups(scenario.getConfig(), drtConfigGroup.getMode());
// });
}
}

Expand Down

0 comments on commit 4fb3e6e

Please sign in to comment.