From b1be372bb5ade564600a8df943741971587854bc Mon Sep 17 00:00:00 2001 From: rakow Date: Tue, 12 Dec 2023 13:40:28 +0100 Subject: [PATCH] update version numbers and new count format --- Makefile | 51 ++++++------------- .../commercial_VehicleTypes_CV.xml | 6 +-- .../counts/CreateCountsFromVMZOld.java | 31 +++++------ .../org/matsim/run/RunOpenBerlinScenario.java | 2 +- 4 files changed, 35 insertions(+), 55 deletions(-) diff --git a/Makefile b/Makefile index 0b4f4608..ce6e3d2d 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ JAR := matsim-berlin-*.jar -V := v6.0 +V := v6.1 CRS := EPSG:25832 p := input/$V @@ -91,7 +91,7 @@ input/sumo.net.xml: input/network.osm --osm-files $< -o=$@ -$p/berlin-v6.0-network.xml.gz: +$p/berlin-v6.1-network.xml.gz: # Use 5.x network $(sc) prepare reproject-network\ --input $(berlin)/../berlin-v5.5-10pct/input/berlin-v5.5-network.xml.gz\ @@ -102,14 +102,19 @@ $p/berlin-v6.0-network.xml.gz: --target-crs $(CRS) -$p/berlin-v6.0-network-with-pt.xml.gz: $p/berlin-v6.0-network.xml.gz +$p/berlin-v6.1-network-with-pt.xml.gz: $p/berlin-v6.1-network.xml.gz # Copy 5.x network stuff cp $< $@ cp $(berlin)/../berlin-v5.5-10pct/input/berlin-v5.5-transit-vehicles.xml.gz $p/berlin-v6.0-transitVehicles.xml.gz +$p/berlin-v6.1-counts-vmz.xml.gz: + $(sc) prepare counts-from-vmz-old\ + --csv ../shared-svn/projects/matsim-berlin/berlin-v5.5/original_data/vmz_counts_2018/CountsId_to_linkId.csv\ + --excel ../shared-svn/projects/matsim-berlin/berlin-v5.5/original_data/vmz_counts_2018/Datenexport_2018_TU_Berlin.xlsx\ + --output $@ # TODO: Not part of 6.0 release, but planned for future versions -$p/berlin-v6.1-network.xml.gz: input/sumo.net.xml +$p/berlin-v6.2-network.xml.gz: input/sumo.net.xml $(sc) prepare network-from-sumo $< --target-crs $(CRS) --output $@ $(sc) prepare clean-network $@ --output $@ --modes car @@ -121,29 +126,23 @@ $p/berlin-v6.1-network.xml.gz: input/sumo.net.xml $(sc) prepare network-freespeed --network $@ --params input/network-params.json --output $@ -$p/berlin-v6.1-network-with-pt.xml.gz: $p/berlin-v6.1-network.xml.gz +$p/berlin-v6.2-network-with-pt.xml.gz: $p/berlin-v6.2-network.xml.gz $(sc) prepare transit-from-gtfs --network $< --output=$p\ --name berlin-$V --date "2023-06-07" --target-crs $(CRS) \ $(germany)/gtfs/complete-pt-2023-06-06.zip\ --shp $p/pt-area/pt-area.shp -$p/berlin-v6.1-counts-car-vmz.xml.gz: $p/berlin-v6.1-network.xml.gz +$p/berlin-v6.2-counts-vmz.xml.gz: $p/berlin-v6.1-network.xml.gz $(sc) prepare counts-from-vmz\ --excel ../shared-svn/projects/matsim-berlin/berlin-v5.5/original_data/vmz_counts_2018/Datenexport_2018_TU_Berlin.xlsx\ --network $<\ - --network-geometries $p/berlin-v6.0-network-linkGeometries.csv\ + --network-geometries $p/berlin-v6.2-network-linkGeometries.csv\ --output $p/\ --version berlin-$(V)\ --input-crs EPSG:31468\ --target-crs $(CRS)\ --ignored-counts input/ignored_counts.csv -input/v6.0/berlin-v6.0-counts-car-vmz.xml.gz: - $(sc) prepare counts-from-vmz-old\ - --csv ../shared-svn/projects/matsim-berlin/berlin-v5.5/original_data/vmz_counts_2018/CountsId_to_linkId.csv\ - --excel ../shared-svn/projects/matsim-berlin/berlin-v5.5/original_data/vmz_counts_2018/Datenexport_2018_TU_Berlin.xlsx\ - --output $@ - $p/berlin-$V-facilities.xml.gz: $p/berlin-$V-network.xml.gz input/facilities.shp $(sc) prepare facilities --network $< --shp $(word 2,$^)\ --output $@ @@ -199,16 +198,15 @@ $p/berlin-longHaulFreight-$V-25pct.plans.xml.gz: $p/berlin-$V-network.xml.gz --output $@ # TODO: commercial traffic needs to be updated, and network mode correctly mapped -# TODO: both types can be in one file in future -$p/berlin-commercialPersonTraffic-$V-25pct.plans.xml.gz: +$p/berlin-small-scale-commercialTraffic-$V-25pct.plans.xml.gz: $(sc) prepare generate-small-scale-commercial-traffic\ input/commercialTraffic\ --sample 0.25\ --jspritIterations 1\ --creationOption createNewCarrierFile\ --landuseConfiguration useOSMBuildingsAndLanduse\ - --smallScaleCommercialTrafficType commercialPersonTraffic\ + --smallScaleCommercialTrafficType completeSmallScaleCommercialTraffic\ --zoneShapeFileName $(berlin)/input/shp/berlinBrandenburg_Zones_VKZ_4326.shp\ --buildingsShapeFileName $(berlin)/input/shp/buildings_BerlinBrandenburg_4326.shp\ --landuseShapeFileName $(berlin)/input/shp/berlinBrandenburg_landuse_4326.shp\ @@ -220,28 +218,9 @@ $p/berlin-commercialPersonTraffic-$V-25pct.plans.xml.gz: mv output/commercialPersonTraffic/$(notdir $@) $@ -$p/berlin-goodsTraffic-$V-25pct.plans.xml.gz: - $(sc) prepare generate-small-scale-commercial-traffic\ - input/commercialTraffic\ - --sample 0.25\ - --jspritIterations 1\ - --creationOption createNewCarrierFile\ - --landuseConfiguration useOSMBuildingsAndLanduse\ - --smallScaleCommercialTrafficType goodsTraffic\ - --zoneShapeFileName $(berlin)/input/shp/berlinBrandenburg_Zones_VKZ_4326.shp\ - --buildingsShapeFileName $(berlin)/input/shp/buildings_BerlinBrandenburg_4326.shp\ - --landuseShapeFileName $(berlin)/input/shp/berlinBrandenburg_landuse_4326.shp\ - --shapeCRS "EPSG:4326"\ - --resistanceFactor "0.005"\ - --numberOfPlanVariantsPerAgent 5\ - --nameOutputPopulation $(notdir $@)\ - --pathOutput output/goodsTraffic - - mv output/goodsTraffic/$(notdir $@) $@ - -$p/berlin-cadyts-input-$V-25pct.plans.xml.gz: $p/berlin-initial-$V-25pct.plans.xml.gz $p/berlin-commercialPersonTraffic-$V-25pct.plans.xml.gz +$p/berlin-cadyts-input-$V-25pct.plans.xml.gz: $p/berlin-initial-$V-25pct.plans.xml.gz $p/berlin-small-scale-commercialTraffic-$V-25pct.plans.xml.gz $(sc) prepare merge-populations $^\ --output $@ diff --git a/input/commercialTraffic/commercial_VehicleTypes_CV.xml b/input/commercialTraffic/commercial_VehicleTypes_CV.xml index 7ba5102b..9039bca9 100644 --- a/input/commercialTraffic/commercial_VehicleTypes_CV.xml +++ b/input/commercialTraffic/commercial_VehicleTypes_CV.xml @@ -29,7 +29,7 @@ - + VW Caddy 2.0 Maxi TDI @@ -165,7 +165,7 @@ - + - \ No newline at end of file + diff --git a/src/main/java/org/matsim/prepare/counts/CreateCountsFromVMZOld.java b/src/main/java/org/matsim/prepare/counts/CreateCountsFromVMZOld.java index 8dad0789..3362ffcf 100644 --- a/src/main/java/org/matsim/prepare/counts/CreateCountsFromVMZOld.java +++ b/src/main/java/org/matsim/prepare/counts/CreateCountsFromVMZOld.java @@ -9,6 +9,8 @@ import org.matsim.application.MATSimAppCommand; import org.matsim.counts.Counts; import org.matsim.counts.CountsWriter; +import org.matsim.counts.Measurable; +import org.matsim.counts.MeasurementLocation; import picocli.CommandLine; import java.io.*; @@ -77,36 +79,35 @@ private void readExcelFile(String excel) { * @param outputFile */ private void createCountsFile(String outputFile) { - Counts countsPkw = new Counts(); - countsPkw.setYear(2018); - countsPkw.setDescription("data from the berliner senate to matsim counts"); - Counts countsLkw = new Counts(); - countsLkw.setYear(2018); - countsLkw.setDescription("data from the berliner senate to matsim counts"); + Counts counts = new Counts<>(); + counts.setYear(2018); + counts.setDescription("data from the berliner senate to matsim counts"); for (BerlinCounts berlinCounts : berlinCountsMap.values()) { if (!berlinCounts.isUsing()) { continue; } - countsPkw.createAndAddCount(Id.createLinkId(berlinCounts.getLinkid()), berlinCounts.getMQ_ID() + "_" + berlinCounts.getPosition() + "_" + berlinCounts.getOrientation()); + + MeasurementLocation station = counts.createAndAddMeasureLocation(Id.createLinkId(berlinCounts.getLinkid()), berlinCounts.getMQ_ID() + "_" + berlinCounts.getPosition() + "_" + berlinCounts.getOrientation()); + Measurable carVolume = station.createVolume(); + double[] PERC_Q_PKW_TYPE = berlinCounts.getPERC_Q_KFZ_TYPE(); for (int i = 1; i < 25; i++) { - countsPkw.getCount(Id.createLinkId(berlinCounts.getLinkid())).createVolume(i, ( (berlinCounts.getDTVW_KFZ() - berlinCounts.getDTVW_LKW()) * PERC_Q_PKW_TYPE[i - 1])); + carVolume.setAtHour(i -1, ( (berlinCounts.getDTVW_KFZ() - berlinCounts.getDTVW_LKW()) * PERC_Q_PKW_TYPE[i - 1])); } + if (berlinCounts.isLKW_Anteil()) { - countsLkw.createAndAddCount(Id.createLinkId(berlinCounts.getLinkid()), berlinCounts.getMQ_ID() + "_" + berlinCounts.getPosition() + "_" + berlinCounts.getOrientation()); + + Measurable truckVolume = station.createVolume("freight"); + double[] PERC_Q_LKW_TYPE = berlinCounts.getPERC_Q_LKW_TYPE(); for (int i = 1; i < 25; i++) { - countsLkw.getCount(Id.createLinkId(berlinCounts.getLinkid())).createVolume(i, (berlinCounts.getDTVW_LKW() * PERC_Q_LKW_TYPE[i - 1])); + truckVolume.setAtHour(i-1, (berlinCounts.getDTVW_LKW() * PERC_Q_LKW_TYPE[i - 1])); } } } - CountsWriter writerPkw = new CountsWriter(countsPkw); - CountsWriter writerLkw = new CountsWriter(countsLkw); - writerPkw.write(outputFile); - if (outputFile.contains("-car")) - writerLkw.write(outputFile.replace("-car", "-hgv")); + new CountsWriter(counts).write(outputFile); } /** diff --git a/src/main/java/org/matsim/run/RunOpenBerlinScenario.java b/src/main/java/org/matsim/run/RunOpenBerlinScenario.java index 6762c0bd..dcc01474 100644 --- a/src/main/java/org/matsim/run/RunOpenBerlinScenario.java +++ b/src/main/java/org/matsim/run/RunOpenBerlinScenario.java @@ -23,7 +23,7 @@ public class RunOpenBerlinScenario extends MATSimApplication { private static final Logger log = LogManager.getLogger(RunOpenBerlinCalibration.class); - public static final String VERSION = "6.0"; + public static final String VERSION = "6.1"; public static final String CRS = "EPSG:25832"; @CommandLine.Mixin private final SampleOptions sample = new SampleOptions(25, 10, 1);