From e0dda3ac431e4b94a2cbafc615d1364fe604ca43 Mon Sep 17 00:00:00 2001 From: Kai Martins-Turner Date: Tue, 12 Nov 2024 15:44:18 +0100 Subject: [PATCH] add networkMode to vehicleType. --- .../ExampleTwoLspsGroceryDeliveryMultipleChains.java | 5 +++++ .../ExampleTwoLspsGroceryDeliveryMultipleChainsWithToll.java | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleTwoLspsGroceryDeliveryMultipleChains.java b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleTwoLspsGroceryDeliveryMultipleChains.java index fb877baf..1c52b2be 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleTwoLspsGroceryDeliveryMultipleChains.java +++ b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleTwoLspsGroceryDeliveryMultipleChains.java @@ -50,6 +50,7 @@ import org.jetbrains.annotations.NotNull; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; +import org.matsim.api.core.v01.TransportMode; import org.matsim.api.core.v01.network.Link; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; @@ -111,6 +112,10 @@ public static void main(String[] args) { CarrierVehicleTypes vehicleTypes = new CarrierVehicleTypes(); CarrierVehicleTypeReader vehicleTypeReader = new CarrierVehicleTypeReader(vehicleTypes); vehicleTypeReader.readFile(VEHICLE_TYPE_FILE); + //The following is needed, because sinde fall 2024 the vehicle types are not assigned to a network mode by default. + for (VehicleType vehicleType : vehicleTypes.getVehicleTypes().values()) { + vehicleType.setNetworkMode(TransportMode.car); + } Carriers carriers = new Carriers(); CarrierPlanXmlReader carrierReader = new CarrierPlanXmlReader(carriers, vehicleTypes); diff --git a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleTwoLspsGroceryDeliveryMultipleChainsWithToll.java b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleTwoLspsGroceryDeliveryMultipleChainsWithToll.java index 78bedf94..b3734fd5 100644 --- a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleTwoLspsGroceryDeliveryMultipleChainsWithToll.java +++ b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleTwoLspsGroceryDeliveryMultipleChainsWithToll.java @@ -30,6 +30,7 @@ import org.matsim.analysis.personMoney.PersonMoneyEventsAnalysisModule; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; +import org.matsim.api.core.v01.TransportMode; import org.matsim.api.core.v01.network.Link; import org.matsim.contrib.roadpricing.*; import org.matsim.core.config.Config; @@ -95,6 +96,10 @@ public static void main(String[] args) { CarrierVehicleTypes vehicleTypes = new CarrierVehicleTypes(); CarrierVehicleTypeReader vehicleTypeReader = new CarrierVehicleTypeReader(vehicleTypes); vehicleTypeReader.readFile(VEHICLE_TYPE_FILE); + //The following is needed, because sinde fall 2024 the vehicle types are not assigned to a network mode by default. + for (VehicleType vehicleType : vehicleTypes.getVehicleTypes().values()) { + vehicleType.setNetworkMode(TransportMode.car); + } Carriers carriers = new Carriers(); CarrierPlanXmlReader carrierReader = new CarrierPlanXmlReader(carriers, vehicleTypes);