diff --git a/input/v1.3/drtServiceArea/leipzig_flexa_service_area_2021.dbf b/input/v1.3/drtServiceArea/leipzig_flexa_service_area_2021.dbf index 20e71302..10237348 100644 Binary files a/input/v1.3/drtServiceArea/leipzig_flexa_service_area_2021.dbf and b/input/v1.3/drtServiceArea/leipzig_flexa_service_area_2021.dbf differ diff --git a/src/test/java/org/matsim/run/RunLeipzigIntegrationTest.java b/src/test/java/org/matsim/run/RunLeipzigIntegrationTest.java index 08abc846..098485b5 100644 --- a/src/test/java/org/matsim/run/RunLeipzigIntegrationTest.java +++ b/src/test/java/org/matsim/run/RunLeipzigIntegrationTest.java @@ -1,12 +1,11 @@ package org.matsim.run; -import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; import org.matsim.analysis.ParkingLocation; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.network.Network; import org.matsim.application.MATSimApplication; +import org.matsim.contrib.drt.run.MultiModeDrtConfigGroup; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.controler.OutputDirectoryHierarchy; @@ -21,7 +20,9 @@ public class RunLeipzigIntegrationTest { private static final String URL = "https://svn.vsp.tu-berlin.de/repos/public-svn/matsim/scenarios/countries/de/leipzig/leipzig-v1.2/input/"; - private static final String exampleShp = "input/v1.3/drtServiceArea/Leipzig_stadt.shp"; + private static final String stadtShp = "input/v1.3/drtServiceArea/Leipzig_stadt.shp"; + private static final String flexaShp = "input/v1.3/drtServiceArea/leipzig_flexa_service_area_2021.shp"; + @Test public final void runPoint1pctIntegrationTest() { @@ -38,8 +39,8 @@ public final void runPoint1pctIntegrationTest() { ConfigUtils.addOrGetModule(config, SimWrapperConfigGroup.class).defaultDashboards = SimWrapperConfigGroup.Mode.disabled; - MATSimApplication.execute(RunLeipzigScenario.class, config, "run", "--1pct", "--slow-speed-area", exampleShp, - "--slow-speed-relative-change", "0.5","--drt-area", exampleShp, "--post-processing", "disabled" + MATSimApplication.execute(RunLeipzigScenario.class, config, "run", "--1pct", "--slow-speed-area", stadtShp, + "--slow-speed-relative-change", "0.5","--drt-area", stadtShp, "--post-processing", "disabled" ); assertThat(output) @@ -63,7 +64,7 @@ public final void runPoint1pctParkingIntegrationTest() { ConfigUtils.addOrGetModule(config, SimWrapperConfigGroup.class).defaultDashboards = SimWrapperConfigGroup.Mode.disabled; config.plans().setInputFile(URL + "leipzig-v1.2-0.1pct.plans-initial.xml.gz"); - MATSimApplication.execute(RunLeipzigScenario.class, config, "run", "--1pct", "--drt-area", exampleShp, "--post-processing", "disabled", + MATSimApplication.execute(RunLeipzigScenario.class, config, "run", "--1pct", "--drt-area", flexaShp, "--post-processing", "disabled", "--parking-cost-area", "input/v" + RunLeipzigScenario.VERSION + "/parkingCostArea/Bewohnerparken_2020.shp", "--parking", "--intermodality", "drtAsAccessEgressForPt"); @@ -73,29 +74,38 @@ public final void runPoint1pctParkingIntegrationTest() { new ParkingLocation().execute("--directory", output.toString()); } + //drt is included in the parking test, as well... @Test - @Ignore("Opt Drt is not used right now.") - public final void runOptDrtExamplePopulationTest() { - Config config = ConfigUtils.loadConfig("input/v1.2/leipzig-test.with-drt.config.xml"); + public final void runDrtTest() { + Config config = ConfigUtils.loadConfig("input/v1.3/leipzig-v1.3-10pct.config.xml"); + Path output = Path.of("output-drt-test/it-1pct"); + config.global().setNumberOfThreads(1); config.qsim().setNumberOfThreads(1); config.controler().setLastIteration(1); config.controler().setOverwriteFileSetting(OutputDirectoryHierarchy.OverwriteFileSetting.deleteDirectoryIfExists); - config.network().setInputFile(URL + "drt-base-case/leipzig-v1.1-network-with-pt-drt.xml.gz"); - config.plans().setInputFile(URL + "leipzig-v1.1-0.1pct.plans.xml.gz"); - config.transit().setTransitScheduleFile(URL + "leipzig-v1.1-transitSchedule.xml.gz"); - config.transit().setVehiclesFile(URL + "leipzig-v1.1-transitVehicles.xml.gz"); - config.vehicles().setVehiclesFile(URL + "drt-base-case/leipzig-v1.1-vehicle-types-with-drt-scaledFleet.xml"); + config.controler().setOutputDirectory(output.toString()); + +// config.network().setInputFile(URL + "drt-base-case/leipzig-v1.1-network-with-pt-drt.xml.gz"); + config.plans().setInputFile(URL + "leipzig-v1.2-0.1pct.plans-initial.xml.gz"); +// config.transit().setTransitScheduleFile(URL + "leipzig-v1.1-transitSchedule.xml.gz"); +// config.transit().setVehiclesFile(URL + "leipzig-v1.1-transitVehicles.xml.gz"); +// config.vehicles().setVehiclesFile(URL + "drt-base-case/leipzig-v1.1-vehicle-types-with-drt-scaledFleet.xml"); ConfigUtils.addOrGetModule(config, SimWrapperConfigGroup.class).defaultDashboards = SimWrapperConfigGroup.Mode.disabled; - //modes now have to be provided in the drt-area shape file, per 'mode' attribute with - //TODO: fix test by providing service area shape file - MATSimApplication.execute(RunLeipzigScenario.class, config, "run", "--1pct", "--drt-area", exampleShp, - "--drt-modes", "drtNorth,drtSoutheast", "--waiting-time-threshold-optDrt", "600", "--post-processing", "disabled"); + MATSimApplication.execute(RunLeipzigScenario.class, config, "run", "--1pct", "--drt-area", flexaShp + , "--post-processing", "disabled"); + + Network network = NetworkUtils.readNetwork(output + "/" + config.controler().getRunId() + ".output_network.xml.gz"); + assertTrue(! network.getLinks().get(Id.createLinkId("24232899")).getAllowedModes().contains("drtNorth")); + assertTrue(! network.getLinks().get(Id.createLinkId("24232899")).getAllowedModes().contains("drtSoutheast")); + assertTrue(network.getLinks().get(Id.createLinkId("307899688#1")).getAllowedModes().contains("drtNorth")); + assertTrue(network.getLinks().get(Id.createLinkId("26588307#0")).getAllowedModes().contains("drtSoutheast")); + + assertTrue(MultiModeDrtConfigGroup.get(config)!= null); - Assert.assertNotNull(config.getModules().get("multiModeOptDrt")); - Assert.assertNotNull(config.getModules().get("multiModeOptDrt").getParameterSets()); + //TODO add more tests, drt trips, etc. } }