diff --git a/src/main/java/org/matsim/run/RunLeipzigScenario.java b/src/main/java/org/matsim/run/RunLeipzigScenario.java index 6b7f908..ec77748 100644 --- a/src/main/java/org/matsim/run/RunLeipzigScenario.java +++ b/src/main/java/org/matsim/run/RunLeipzigScenario.java @@ -93,19 +93,12 @@ public class RunLeipzigScenario extends MATSimApplication { @CommandLine.Option(names = "--parking-cost-time-period-end", defaultValue = "0", description = "End of time period for which parking cost will be charged.") private Double parkingCostTimePeriodEnd; - @CommandLine.Option(names = "--drt-case", defaultValue = "oneServiceArea", description = "Defines how drt is modelled. For a more detailed description see class DrtCaseSetup.") - private DrtCaseSetup.DrtCase drtCase; - @CommandLine.Option(names = "--intermodality", defaultValue = "drtAndPtSeparateFromEachOther", description = "Define if drt should be used as access and egress mode for pt.") private DrtCaseSetup.PtDrtIntermodality ptDrtIntermodality; - public RunLeipzigScenario(@Nullable Config config) { - super(config); - } + public RunLeipzigScenario(@Nullable Config config) { super(config); } - public RunLeipzigScenario() { - super(String.format("input/v%s/leipzig-v%s-10pct.config.xml", VERSION, VERSION)); - } + public RunLeipzigScenario() { super(String.format("input/v%s/leipzig-v%s-10pct.config.xml", VERSION, VERSION)); } public static void main(String[] args) { MATSimApplication.run(RunLeipzigScenario.class, args); @@ -191,7 +184,7 @@ protected Config prepareConfig(Config config) { if (networkOpt.hasDrtArea()) { //drt try { - DrtCaseSetup.prepareConfig(config, drtCase, new ShpOptions(networkOpt.getDrtArea(), null, null)); + DrtCaseSetup.prepareConfig(config, /* drtCase, */ new ShpOptions(networkOpt.getDrtArea(), null, null)); } catch (URISyntaxException e) { log.fatal(e); } @@ -280,7 +273,7 @@ protected void prepareScenario(Scenario scenario) { // (passt das Netz an aus den mitgegebenen shape files, z.B. parking area, car-free area, ...) if (networkOpt.hasDrtArea()) { - DrtCaseSetup.prepareScenario(scenario, drtCase, new ShpOptions(networkOpt.getDrtArea(), null, null), VERSION); + DrtCaseSetup.prepareScenario(scenario, new ShpOptions(networkOpt.getDrtArea(), null, null), VERSION); } } @@ -328,7 +321,7 @@ public void install() { }); if (networkOpt.hasDrtArea()) { - DrtCaseSetup.prepareControler(controler, drtCase, new ShpOptions(networkOpt.getDrtArea(), null, null), ptDrtIntermodality); + DrtCaseSetup.prepareControler(controler, new ShpOptions(networkOpt.getDrtArea(), null, null), ptDrtIntermodality); } if (bike == BicycleHandling.onNetworkWithBicycleContrib) { diff --git a/src/main/java/org/matsim/run/prepare/DrtCaseSetup.java b/src/main/java/org/matsim/run/prepare/DrtCaseSetup.java index 6ecc0b1..5577019 100644 --- a/src/main/java/org/matsim/run/prepare/DrtCaseSetup.java +++ b/src/main/java/org/matsim/run/prepare/DrtCaseSetup.java @@ -3,17 +3,16 @@ import ch.sbb.matsim.config.SwissRailRaptorConfigGroup; import ch.sbb.matsim.routing.pt.raptor.RaptorIntermodalAccessEgress; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.locationtech.jts.geom.Geometry; import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.TransportMode; +import org.matsim.api.core.v01.network.Network; import org.matsim.application.options.ShpOptions; -import org.matsim.contrib.drt.analysis.zonal.DrtZonalSystemParams; import org.matsim.contrib.drt.fare.DrtFareParams; import org.matsim.contrib.drt.optimizer.insertion.extensive.ExtensiveInsertionSearchParams; -import org.matsim.contrib.drt.optimizer.rebalancing.RebalancingParams; -import org.matsim.contrib.drt.optimizer.rebalancing.mincostflow.MinCostFlowRebalancingStrategyParams; import org.matsim.contrib.drt.routing.DrtRoute; import org.matsim.contrib.drt.routing.DrtRouteFactory; import org.matsim.contrib.drt.run.*; @@ -32,6 +31,8 @@ import org.matsim.core.controler.OutputDirectoryHierarchy; import org.matsim.core.controler.events.StartupEvent; import org.matsim.core.controler.listener.StartupListener; +import org.matsim.core.network.NetworkUtils; +import org.matsim.core.network.algorithms.TransportModeNetworkFilter; import org.matsim.core.utils.io.IOUtils; import org.matsim.extensions.pt.fare.intermodalTripFareCompensator.IntermodalTripFareCompensatorConfigGroup; import org.matsim.extensions.pt.fare.intermodalTripFareCompensator.IntermodalTripFareCompensatorsConfigGroup; @@ -62,25 +63,20 @@ public final class DrtCaseSetup { private static final String errorMessage = "Unexpected value: "; + //this is not nice because the static set is only filled in prepareConfig static Set drtModes = new HashSet<>(); - /** - * Defines if drt is modelled at all (none), with 2 separate modes (twoSeparateServiceAreas) or with 1 single drt mode (oneServiceArea). - * As this class is only triggered if a shp of the drt service area was provided, none is inactive for now - */ - public enum DrtCase {/*none,*/ twoSeparateServiceAreas, oneServiceArea} - /** * Defines if intermodality between drt and pt is modelled or not. */ public enum PtDrtIntermodality {drtAndPtSeparateFromEachOther, drtAsAccessEgressForPt} - private DrtCaseSetup(){} + public DrtCaseSetup(){ } /** * prepare config for drt simulation. */ - public static void prepareConfig(Config config, DrtCase drtCase, ShpOptions drtArea) throws URISyntaxException { + public static void prepareConfig(Config config, ShpOptions drtAreas) throws URISyntaxException { MultiModeDrtConfigGroup multiModeDrtConfigGroup = ConfigUtils.addOrGetModule(config, MultiModeDrtConfigGroup.class); DvrpConfigGroup dvrpConfigGroup = ConfigUtils.addOrGetModule(config, DvrpConfigGroup.class); @@ -97,66 +93,44 @@ public static void prepareConfig(Config config, DrtCase drtCase, ShpOptions drtA drtFareParams.timeFare_h = 0.; drtFareParams.dailySubscriptionFee = 0.; - switch (drtCase) { - case twoSeparateServiceAreas -> { - //flexa case with 2 separate drt bubbles (north and southeast) -> 2 separate drt modes - if (multiModeDrtConfigGroup.getModalElements().isEmpty()) { - createDrtModeConfigGroup(multiModeDrtConfigGroup, TransportMode.drt + "North", drtArea.getShapeFile().toString()); - createDrtModeConfigGroup(multiModeDrtConfigGroup, TransportMode.drt + "Southeast", drtArea.getShapeFile().toString()); - } - - multiModeDrtConfigGroup.getModalElements().forEach(drtConfigGroup -> { - drtConfigGroup.addParameterSet(drtFareParams); - DrtConfigs.adjustDrtConfig(drtConfigGroup, config.planCalcScore(), config.plansCalcRoute()); - drtModes.add(drtConfigGroup.getMode()); - - - configureNecessaryConfigGroups(config, drtConfigGroup.getMode()); - DrtSpeedUpParams drtSpeedUpParams = new DrtSpeedUpParams(); - drtSpeedUpParams.fractionOfIterationsSwitchOn = 0.0; - drtSpeedUpParams.fractionOfIterationsSwitchOff = 1.0; - drtSpeedUpParams.firstSimulatedDrtIterationToReplaceInitialDrtPerformanceParams = 10000; - // update to real world data - drtSpeedUpParams.initialWaitingTime = 345.6; - // update to real world data - drtSpeedUpParams.initialInVehicleBeelineSpeed = 20/3.6; - drtSpeedUpParams.intervalDetailedIteration = 10000; - drtSpeedUpParams.waitingTimeUpdateDuringSpeedUp = DrtSpeedUpParams.WaitingTimeUpdateDuringSpeedUp.Disabled; - drtConfigGroup.addParameterSet(drtSpeedUpParams); - }); - + log.info("reading " + drtAreas.getShapeFile().toString()); + for (SimpleFeature feature : drtAreas.readFeatures()) { +// String name = (String) feature.getAttribute("Name"); + String drtMode = String.valueOf(feature.getAttribute("mode")); + if (drtMode.equals("null")) { + throw new IllegalArgumentException("could not find 'mode' attribute in the given shape file at " + drtAreas.getShapeFile().toString()); + } else { + drtModes.add(drtMode); } + } - case oneServiceArea -> { - //"normal" drt, modelled as one single drt mode - if (multiModeDrtConfigGroup.getModalElements().isEmpty()) { - createDrtModeConfigGroup(multiModeDrtConfigGroup, TransportMode.drt, drtArea.getShapeFile().toString()); - } - multiModeDrtConfigGroup.getModalElements().forEach(drtConfigGroup -> { - drtConfigGroup.addParameterSet(drtFareParams); - DrtConfigs.adjustDrtConfig(drtConfigGroup, config.planCalcScore(), config.plansCalcRoute()); - drtModes.add(drtConfigGroup.getMode()); - - configureNecessaryConfigGroups(config, drtConfigGroup.getMode()); - DrtSpeedUpParams drtSpeedUpParams = new DrtSpeedUpParams(); - drtSpeedUpParams.fractionOfIterationsSwitchOn = 0.0; - drtSpeedUpParams.fractionOfIterationsSwitchOff = 1.0; - drtSpeedUpParams.firstSimulatedDrtIterationToReplaceInitialDrtPerformanceParams = 10000; - // update to real world data - drtSpeedUpParams.initialWaitingTime = 345.6; - // update to real world data - drtSpeedUpParams.initialInVehicleBeelineSpeed = 20/3.6; - drtSpeedUpParams.intervalDetailedIteration = 10000; - drtSpeedUpParams.waitingTimeUpdateDuringSpeedUp = DrtSpeedUpParams.WaitingTimeUpdateDuringSpeedUp.Disabled; - drtConfigGroup.addParameterSet(drtSpeedUpParams); - }); + if (multiModeDrtConfigGroup.getModalElements().isEmpty()) { + for (String mode : drtModes){ + createDrtModeConfigGroup(multiModeDrtConfigGroup, mode); } - default -> throw new IllegalStateException(errorMessage + (drtCase)); } + multiModeDrtConfigGroup.getModalElements().forEach(drtConfigGroup -> { + drtConfigGroup.addParameterSet(drtFareParams); + DrtConfigs.adjustDrtConfig(drtConfigGroup, config.planCalcScore(), config.plansCalcRoute()); + + configureNecessaryConfigGroups(config, drtConfigGroup.getMode()); + DrtSpeedUpParams drtSpeedUpParams = new DrtSpeedUpParams(); + drtSpeedUpParams.fractionOfIterationsSwitchOn = 0.0; + drtSpeedUpParams.fractionOfIterationsSwitchOff = 1.0; + drtSpeedUpParams.firstSimulatedDrtIterationToReplaceInitialDrtPerformanceParams = 10000; + // update to real world data + drtSpeedUpParams.initialWaitingTime = 345.6; + // update to real world data + drtSpeedUpParams.initialInVehicleBeelineSpeed = 20/3.6; + drtSpeedUpParams.intervalDetailedIteration = 10000; + drtSpeedUpParams.waitingTimeUpdateDuringSpeedUp = DrtSpeedUpParams.WaitingTimeUpdateDuringSpeedUp.Disabled; + drtConfigGroup.addParameterSet(drtSpeedUpParams); + }); + //drt modes have to be set as network modes in dvrp CfgGroup dvrpConfigGroup.networkModes = drtModes; //after adding mode specific multiModeDrtParams -> adjust @@ -166,110 +140,69 @@ public static void prepareConfig(Config config, DrtCase drtCase, ShpOptions drtA * prepare scenario for drt simulation. more specifically, create input vehicles and stops files. * this method does not (!?) change the network. For this, please refer to NetworkOptions.prepareDRT */ - public static void prepareScenario(Scenario scenario, DrtCase drtCase, ShpOptions drtArea, String version) { + public static void prepareScenario(Scenario scenario, ShpOptions drtAreas, String version) { scenario.getPopulation().getFactory().getRouteFactories().setRouteFactory(DrtRoute.class, new DrtRouteFactory()); // (matsim core does not know about DRT routes. This makes it possible to read them before the controler is there.) - - CreateDrtStopsFromNetwork drtStopsCreator = new CreateDrtStopsFromNetwork(); MultiModeDrtConfigGroup multiModeDrtConfigGroup = ConfigUtils.addOrGetModule(scenario.getConfig(), MultiModeDrtConfigGroup.class); - String drtMode; - switch (drtCase) { - case twoSeparateServiceAreas -> { - //flexa case with 2 separate drt bubbles (north and southeast) -> 2 separate drt modes - - log.info("reading " + drtArea.getShapeFile().toString()); - for (SimpleFeature feature : drtArea.readFeatures()) { -// String name = (String) feature.getAttribute("Name"); - drtMode = String.valueOf(feature.getAttribute("mode")); + log.info("reading " + drtAreas.getShapeFile().toString()); + for (SimpleFeature feature : drtAreas.readFeatures()) { + String drtMode = String.valueOf(feature.getAttribute("mode")); if (drtMode.equals("null")) { - throw new IllegalArgumentException("could not find 'mode' attribute in the given shape file at " + drtArea.getShapeFile().toString()); + throw new IllegalArgumentException("could not find 'mode' attribute in the given shape file at " + drtAreas.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 " + drtAreas.getShapeFile().toString()); + } - log.info("attempting to create " + noVehicles + " drt vehicles for mode " + drtMode); + log.info("filtering network for mode " + drtMode + ". Before, the number of links equals " + scenario.getNetwork().getLinks().size()); + Network filteredNetwork = NetworkUtils.createNetwork(); + TransportModeNetworkFilter filter = new TransportModeNetworkFilter(scenario.getNetwork()); + filter.filter(filteredNetwork, Sets.newHashSet(drtMode)); + log.info("filtered network contains " + filteredNetwork.getLinks().size() + " links"); - new LeipzigDrtVehicleCreator().createDrtVehiclesForSingleArea(scenario.getVehicles(), scenario.getNetwork(), + log.info("attempting to create " + noVehicles + " drt vehicles for mode " + drtMode); + new LeipzigDrtVehicleCreator().createDrtVehiclesForSingleArea(scenario.getVehicles(), filteredNetwork, feature, noVehicles, drtMode); //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 - - String finalDrtMode = drtMode; DrtConfigGroup drtConfigGroup = multiModeDrtConfigGroup.getModalElements().stream(). - filter(cfg -> cfg.getMode().equals(finalDrtMode)) + filter(cfg -> cfg.getMode().equals(drtMode)) .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"); - File stopsFile = null; - try { - stopsFile = new File(path.toURI()); - } catch (URISyntaxException e) { - log.fatal(e); - } - - //create drt stops and save them next to config -> put it as input stops file. - //unfortunately there is no scenario.setDrtStops, so we have to do this workaround. -sme0723 - drtStopsCreator.processNetworkForStopCreation(scenario.getNetwork(), true, (Geometry) feature.getDefaultGeometry(), - drtArea.getShapeFile().toString() + "_" + drtConfigGroup.getMode() + "_stops.csv", drtConfigGroup.getMode(), - stopsFile.toString(), drtArea); + { + //path, tho which stops.xml is saved + URL path = IOUtils.extendUrl(scenario.getConfig().getContext(), "leipzig-v" + version + "-" + drtMode + "-stops.xml"); + File file = null; + try { + file = new File(path.toURI()); + } catch (URISyntaxException e) { + log.fatal(e); + } + + + //create drt stops and save them next to config -> put it as input stops file. + //unfortunately there is no scenario.setDrtStops, so we have to do this workaround. -sme0723 + drtStopsCreator.processNetworkForStopCreation(scenario.getNetwork(), true, (Geometry) feature.getDefaultGeometry(), + drtAreas.getShapeFile().toString() + "_" + drtConfigGroup.getMode() + "_stops.csv", drtConfigGroup.getMode(), + file.toString(), drtAreas); + + //naming pattern comes from @DrtStopsWriter line 81. Should be ok to hard code it here. -sme0523 + drtConfigGroup.transitStopFile = file.toString(); - //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()); -// }); + } } - } - - case oneServiceArea -> { - //"normal" drt, modelled as one single drt mode - drtMode = TransportMode.drt; - - //make the 400 configurable??? -sme0723 - new LeipzigDrtVehicleCreator().createDrtVehicles(scenario.getVehicles(), scenario.getNetwork(), - drtArea, 400, drtMode); - - //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 -> { - - //path, tho which stops.xml is saved - URL path = IOUtils.extendUrl(scenario.getConfig().getContext(), "leipzig-v" + version + "-" + drtConfigGroup.getMode() + "-stops.xml"); - File stopsFile = null; - try { - stopsFile = new File(path.toURI()); - } catch (URISyntaxException e) { - log.fatal(e); - } - - //create drt stops and save them next to config -> put it as input stops file. - //unfortunately there is no scenario.setDrtStops, so we have to do this workaround. -sme0723 - drtStopsCreator.processNetworkForStopCreation(scenario.getNetwork(), true, drtArea.getGeometry(), - drtArea.getShapeFile().toString() + "_" + drtConfigGroup.getMode() + "_stops.csv", drtConfigGroup.getMode(), - stopsFile.toString(), drtArea); - - //naming pattern comes from @DrtStopsWriter line 81. Should be ok to hard code it here. -sme0523 - drtConfigGroup.transitStopFile = stopsFile.toString(); - - }); - - } - default -> throw new IllegalStateException(errorMessage + (drtCase)); - } } /** * prepare controler for drt simulation. */ - public static void prepareControler(Controler controler, DrtCase drtCase, ShpOptions drtArea, PtDrtIntermodality ptDrtIntermodality) { + public static void prepareControler(Controler controler, ShpOptions drtAreas, PtDrtIntermodality ptDrtIntermodality) { MultiModeDrtConfigGroup multiModeDrtConfigGroup = ConfigUtils.addOrGetModule(controler.getConfig(), MultiModeDrtConfigGroup.class); controler.addOverridingModule(new DvrpModule()); @@ -292,31 +225,16 @@ public void install() { } } - switch (drtCase) { - case twoSeparateServiceAreas -> { - //flexa case with 2 separate drt bubbles (north and southeast) -> 2 separate drt modes - //if intermodality between pt and drt -> only railways are tagged as intermodal stations (this is how it is handled in reality) -sme0723 if (ptDrtIntermodality.equals(PtDrtIntermodality.drtAsAccessEgressForPt)) { - preparePtDrtIntermodality(controler, drtArea, true); - } - } - - case oneServiceArea -> { - //"normal" drt, modelled as one single drt mode - - if (ptDrtIntermodality.equals(PtDrtIntermodality.drtAsAccessEgressForPt)) { - preparePtDrtIntermodality(controler, drtArea, false); + preparePtDrtIntermodality(controler, drtAreas, true); } - } - default -> throw new IllegalStateException(errorMessage + (drtCase)); - } } /** * if no modal params existing, we have to create them. */ - private static void createDrtModeConfigGroup(MultiModeDrtConfigGroup multiModeDrtConfigGroup, String mode, String pathToShp) { + private static void createDrtModeConfigGroup(MultiModeDrtConfigGroup multiModeDrtConfigGroup, String mode/*, String pathToShp*/) { DrtConfigGroup drtConfigGroup = new DrtConfigGroup(); drtConfigGroup.mode = mode; drtConfigGroup.operationalScheme = DrtConfigGroup.OperationalScheme.stopbased; @@ -332,19 +250,23 @@ private static void createDrtModeConfigGroup(MultiModeDrtConfigGroup multiModeDr ExtensiveInsertionSearchParams insertionSearchParams = new ExtensiveInsertionSearchParams(); drtConfigGroup.addParameterSet(insertionSearchParams); - //add rebalancing params and configure standard values - RebalancingParams rebalancingParams = new RebalancingParams(); - - MinCostFlowRebalancingStrategyParams rebalancingStrategyParams = new MinCostFlowRebalancingStrategyParams(); - rebalancingStrategyParams.targetAlpha = 0.5; - rebalancingStrategyParams.targetBeta = 0.5; - rebalancingParams.addParameterSet(rebalancingStrategyParams); - drtConfigGroup.addParameterSet(rebalancingParams); - - DrtZonalSystemParams zonalSystemParams = new DrtZonalSystemParams(); - zonalSystemParams.zonesGeneration = DrtZonalSystemParams.ZoneGeneration.ShapeFile; - zonalSystemParams.zonesShapeFile = new File(pathToShp).getAbsolutePath(); - drtConfigGroup.addParameterSet(zonalSystemParams); + //we do not simulate drt explicitly anymore, so rebalancing is commented out. tschlenther feb' 24 + { +// //add rebalancing params and configure standard values +// RebalancingParams rebalancingParams = new RebalancingParams(); +// +// MinCostFlowRebalancingStrategyParams rebalancingStrategyParams = new MinCostFlowRebalancingStrategyParams(); +// rebalancingStrategyParams.targetAlpha = 0.5; +// rebalancingStrategyParams.targetBeta = 0.5; +// rebalancingParams.addParameterSet(rebalancingStrategyParams); +// drtConfigGroup.addParameterSet(rebalancingParams); +// +// DrtZonalSystemParams zonalSystemParams = new DrtZonalSystemParams(); +// zonalSystemParams.zonesGeneration = DrtZonalSystemParams.ZoneGeneration.ShapeFile; +// zonalSystemParams.zonesShapeFile = new File(pathToShp).getAbsolutePath(); //this needs to be adjusted: should only be the one corresponding feature and not the whole shape file!! +// drtConfigGroup.addParameterSet(zonalSystemParams); +// + } multiModeDrtConfigGroup.addParameterSet(drtConfigGroup); } @@ -389,7 +311,7 @@ private static void preparePtDrtIntermodality(Controler controler, ShpOptions sh ConfigUtils.addOrGetModule(controler.getConfig(), MultiModeDrtConfigGroup.class).getModalElements().stream().findFirst().ifPresent(drtConfigGroup -> drtConfigGroup.getDrtFareParams().ifPresent(drtFareParams -> - prepareDrtFareCompensation(controler, drtModes, drtFareParams.baseFare))); + prepareDrtFareCompensation(controler, drtModes, drtFareParams.baseFare))); //this only works if prepareConfig was called with the same ShpOptions } private static void prepareDrtFareCompensation(Controler controler, Set nonPtModes, Double ptBaseFare) { diff --git a/src/main/java/org/matsim/run/prepare/LeipzigDrtVehicleCreator.java b/src/main/java/org/matsim/run/prepare/LeipzigDrtVehicleCreator.java index 0798845..59a5196 100644 --- a/src/main/java/org/matsim/run/prepare/LeipzigDrtVehicleCreator.java +++ b/src/main/java/org/matsim/run/prepare/LeipzigDrtVehicleCreator.java @@ -58,11 +58,11 @@ public final class LeipzigDrtVehicleCreator implements MATSimAppCommand { @CommandLine.Option(names = "--no-vehicles", description = "no of vehicles per service area to create", required = true) private int noVehiclesPerArea; - @CommandLine.Option(names = "--service-start-time", description = "start of vehicle service time in seconds", defaultValue = "18000") - private double serviceStartTime; + @CommandLine.Option(names = "--service-start-time", description = "start of vehicle service time in seconds. default is 18000.") + private double serviceStartTime = 18000; - @CommandLine.Option(names = "--service-end-time", description = "end of vehicle service time in seconds", defaultValue = "86400") - private double serviceEndTime; + @CommandLine.Option(names = "--service-end-time", description = "end of vehicle service time in seconds. default is 864000.") + private double serviceEndTime = 86400; public static void main(String[] args) throws IOException { new LeipzigDrtVehicleCreator().execute(args); @@ -151,13 +151,7 @@ public void createDrtVehiclesForSingleArea(Vehicles vehicles, Network network, S } } - log.info("filtering network for mode " + drtMode + ". Before, the number of links equals " + network.getLinks().size()); - Network filteredNetwork = NetworkUtils.createNetwork(); - TransportModeNetworkFilter filter = new TransportModeNetworkFilter(network); - filter.filter(filteredNetwork, Sets.newHashSet(drtMode)); - log.info("filtered network contains " + filteredNetwork.getLinks().size() + " links"); - - createVehiclesByRandomPointInShape(feature, filteredNetwork, noVehiclesPerArea, serviceStartTime, + createVehiclesByRandomPointInShape(feature, network, noVehiclesPerArea, serviceStartTime, serviceEndTime, 1, drtType, drtMode, vehicles); } diff --git a/src/test/java/org/matsim/run/RunLeipzigIntegrationTest.java b/src/test/java/org/matsim/run/RunLeipzigIntegrationTest.java index 098485b..b943ee0 100644 --- a/src/test/java/org/matsim/run/RunLeipzigIntegrationTest.java +++ b/src/test/java/org/matsim/run/RunLeipzigIntegrationTest.java @@ -40,7 +40,7 @@ public final void runPoint1pctIntegrationTest() { ConfigUtils.addOrGetModule(config, SimWrapperConfigGroup.class).defaultDashboards = SimWrapperConfigGroup.Mode.disabled; MATSimApplication.execute(RunLeipzigScenario.class, config, "run", "--1pct", "--slow-speed-area", stadtShp, - "--slow-speed-relative-change", "0.5","--drt-area", stadtShp, "--post-processing", "disabled" + "--slow-speed-relative-change", "0.5","--drt-area", flexaShp, "--post-processing", "disabled" ); assertThat(output)