Skip to content

Commit

Permalink
update version numbers and new count format
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow committed Dec 12, 2023
1 parent a7b01f7 commit b1be372
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 55 deletions.
51 changes: 15 additions & 36 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


JAR := matsim-berlin-*.jar
V := v6.0
V := v6.1
CRS := EPSG:25832

p := input/$V
Expand Down Expand Up @@ -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\
Expand All @@ -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
Expand All @@ -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 $@
Expand Down Expand Up @@ -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\
Expand All @@ -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 $@

Expand Down
6 changes: 3 additions & 3 deletions input/commercialTraffic/commercial_VehicleTypes_CV.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<networkMode networkMode="car"/>
<flowEfficiencyFactor factor="1.0"/>
</vehicleType>

<vehicleType id="vwCaddy">

<description>VW Caddy 2.0 Maxi TDI</description>
Expand Down Expand Up @@ -165,7 +165,7 @@
</costInformation>
<passengerCarEquivalents pce="4.0"/>
<maximumVelocity meterPerSecond="22.22"/>
<networkMode networkMode="car"/>
<networkMode networkMode="freight"/>
<flowEfficiencyFactor factor="1.0"/>
</vehicleType>
</vehicleDefinitions>
</vehicleDefinitions>
31 changes: 16 additions & 15 deletions src/main/java/org/matsim/prepare/counts/CreateCountsFromVMZOld.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down Expand Up @@ -77,36 +79,35 @@ private void readExcelFile(String excel) {
* @param outputFile
*/
private void createCountsFile(String outputFile) {
Counts<Link> countsPkw = new Counts();
countsPkw.setYear(2018);
countsPkw.setDescription("data from the berliner senate to matsim counts");
Counts<Link> countsLkw = new Counts();
countsLkw.setYear(2018);
countsLkw.setDescription("data from the berliner senate to matsim counts");
Counts<Link> 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<Link> 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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/matsim/run/RunOpenBerlinScenario.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b1be372

Please sign in to comment.