From 1fdb144ef26a0c25f3533c0103cc389c4c5a4369 Mon Sep 17 00:00:00 2001 From: schlenther Date: Mon, 23 Sep 2024 17:12:40 +0200 Subject: [PATCH] include AV speed limit --- src/main/java/org/matsim/run/DrtFleetSizing.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/org/matsim/run/DrtFleetSizing.java b/src/main/java/org/matsim/run/DrtFleetSizing.java index 6d17936..01e4524 100644 --- a/src/main/java/org/matsim/run/DrtFleetSizing.java +++ b/src/main/java/org/matsim/run/DrtFleetSizing.java @@ -19,6 +19,7 @@ import org.matsim.contrib.drt.run.MultiModeDrtConfigGroup; import org.matsim.contrib.dvrp.run.AbstractDvrpModeModule; import org.matsim.contrib.dvrp.run.DvrpConfigGroup; +import org.matsim.contrib.dvrp.trafficmonitoring.DvrpModeLimitedMaxSpeedTravelTimeModule; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.controler.Controler; @@ -29,6 +30,7 @@ import org.matsim.core.router.TripStructureUtils; import org.matsim.core.utils.io.IOUtils; import org.matsim.rebalancing.WaitingPointsBasedRebalancingModule; +import org.matsim.vehicles.VehicleType; import picocli.CommandLine; import java.nio.file.Files; @@ -147,6 +149,16 @@ public Integer call() throws Exception { MultiModeDrtConfigGroup multiModeDrtConfig = MultiModeDrtConfigGroup.get(config); Controler controler = DrtControlerCreator.createControler(config, false); + // Add speed limit to av vehicle + double maxSpeed = controler.getScenario() + .getVehicles() + .getVehicleTypes() + .get(Id.create("autonomous_vehicle", VehicleType.class)) + .getMaximumVelocity(); + controler.addOverridingModule( + new DvrpModeLimitedMaxSpeedTravelTimeModule("av", config.qsim().getTimeStepSize(), + maxSpeed)); + for (DrtConfigGroup drtCfg : multiModeDrtConfig.getModalElements()) { if (drtCfg.getMode().equals("av")) { drtCfg.transitStopFile = transitStopFilePath;