Skip to content

Commit

Permalink
update version and use java 21, create bast counts data
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow committed May 13, 2024
1 parent 0260984 commit 2908979
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 18 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 17
java-version: 21
architecture: x64
distribution: adopt
cache: maven
Expand All @@ -32,7 +32,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 17
java-version: 21
architecture: x64
distribution: adopt
cache: maven
Expand All @@ -51,7 +51,7 @@ jobs:
strategy:
fail-fast: false
matrix:
java: [17]
java: [21]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 17
java-version: 21
architecture: x64
distribution: adopt
cache: maven
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 17
java-version: 21
architecture: x64
distribution: adopt

Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
<parent>
<groupId>org.matsim</groupId>
<artifactId>matsim-all</artifactId>
<version>16.0-PR2895</version>
<version>2025.0-PR3257</version>
<!-- <version>16.0-SNAPSHOT</version>-->
</parent>

<modelVersion>4.0.0</modelVersion>
<groupId>com.github.matsim-scenarios</groupId>
<artifactId>matsim-metropole-ruhr</artifactId>
<version>1.4.1</version>
<version>2.0</version>

<name>MATSim Metropole Ruhr project</name>
<description>MATSim Metropole Ruhr project</description>
Expand Down Expand Up @@ -168,7 +168,7 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<release>17</release>
<release>21</release>
<showWarnings>false</showWarnings>
<showDeprecation>false</showDeprecation>
<encoding>UTF-8</encoding>
Expand Down
32 changes: 24 additions & 8 deletions src/main/java/org/matsim/prepare/CreateSupply.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.matsim.api.core.v01.network.Network;
import org.matsim.api.core.v01.network.NetworkWriter;
import org.matsim.api.core.v01.network.Node;
import org.matsim.application.prepare.counts.CreateCountsFromBAStData;
import org.matsim.application.prepare.pt.CreateTransitScheduleFromGtfs;
import org.matsim.contrib.bicycle.BicycleUtils;
import org.matsim.contrib.osm.networkReader.LinkProperties;
Expand Down Expand Up @@ -76,9 +77,11 @@ public enum NetworkResolution {Low, Medium, High}
// for now, we will focus on the 'Bestandsnetz'. Once, we are done with calibration, we will also generate the network for the 'Zielnetz' by replacing the previous line with the following.
// private static final Path inputShapeNetwork3 = Paths.get("shared-svn/projects/matsim-metropole-ruhr/metropole-ruhr-v1.0/original-data/2021-08-19_radwegeverbindungen_RRWN_Bestandsnetz_Zielnetz/2021-08-19_RRWN_Bestandsnetz_Zielnetz.shp");

private static final Path outputDirPublic = Paths.get("public-svn/matsim/scenarios/countries/de/metropole-ruhr/metropole-ruhr-v1.0/input/");
private static final Path outputDirPublic = Paths.get("public-svn/matsim/scenarios/countries/de/metropole-ruhr/metropole-ruhr-v2.0/input/");

private static final Path outputDirCounts = Paths.get("shared-svn/projects/matsim-metropole-ruhr/metropole-ruhr-v1.0/input/");
private static final Path outputDirCounts = Paths.get("shared-svn/projects/matsim-metropole-ruhr/metropole-ruhr-v2.0/input/");

private static final Path bastCountsRoot = Paths.get("shared-svn/projects/rvr-metropole-ruhr/data/BASt");
private static final Path longTermCountsRoot = Paths.get("shared-svn/projects/matsim-ruhrgebiet/original_data/counts/long_term_counts");
private static final Path longTermCountsIdMapping = Paths.get("shared-svn/projects/matsim-ruhrgebiet/original_data/counts/mapmatching/countId-to-nodeId-long-term-counts.csv");
private static final Path shortTermCountsRoot = Paths.get("shared-svn/projects/matsim-ruhrgebiet/original_data/counts/short_term_counts");
Expand Down Expand Up @@ -166,15 +169,15 @@ private void run(Path rootDirectory) {
// ----------------------------- Add bicycles and write network ------------------------------------------------

Network network1 = new ShpToNetwork().run(rootDirectory.resolve(inputShapeNetwork1));
new NetworkWriter(network1).write(outputDir.resolve("metropole-ruhr-v1.4.network-onlyBikeNetwork1.xml.gz").toString());
new NetworkWriter(network1).write(outputDir.resolve("metropole-ruhr-v2.0.network-onlyBikeNetwork1.xml.gz").toString());
new BikeNetworkMerger(network).mergeBikeHighways(network1);

Network network2 = new ShpToNetwork().run(rootDirectory.resolve(inputShapeNetwork2));
new NetworkWriter(network2).write(outputDir.resolve("metropole-ruhr-v1.4.network-onlyBikeNetwork2.xml.gz").toString());
new NetworkWriter(network2).write(outputDir.resolve("metropole-ruhr-v2.0.network-onlyBikeNetwork2.xml.gz").toString());
new BikeNetworkMerger(network).mergeBikeHighways(network2);

Network network3 = new ShpToNetwork().run(rootDirectory.resolve(inputShapeNetwork3));
new NetworkWriter(network3).write(outputDir.resolve("metropole-ruhr-v1.4.network-onlyBikeNetwork3.xml.gz").toString());
new NetworkWriter(network3).write(outputDir.resolve("metropole-ruhr-v2.0.network-onlyBikeNetwork3.xml.gz").toString());
new BikeNetworkMerger(network).mergeBikeHighways(network3);

var cleaner = new MultimodalNetworkCleaner(network);
Expand Down Expand Up @@ -273,7 +276,7 @@ private void run(Path rootDirectory) {
}
}

String networkOut = outputDir.resolve("metropole-ruhr-v1.4.network_resolution" + networkResolution + ".xml.gz").toString();
String networkOut = outputDir.resolve("metropole-ruhr-v2.0.network_resolution" + networkResolution + ".xml.gz").toString();
new NetworkWriter(network).write(networkOut);

// --------------------------------------- Create Pt -----------------------------------------------------------
Expand All @@ -285,7 +288,7 @@ private void run(Path rootDirectory) {
"--target-crs", "EPSG:25832",
"--network", networkOut,
"--output", outputDir.toString(),
"--name", "metropole-ruhr-v1.4"
"--name", "metropole-ruhr-v2.0"
);

// --------------------------------------- Create Counts -------------------------------------------------------
Expand All @@ -310,7 +313,20 @@ private void run(Path rootDirectory) {
.build()
.run();

CombinedCountsWriter.writeCounts(outputDirForCounts.resolve("metropole-ruhr-v1.4.counts.xml.gz"),

new CreateCountsFromBAStData().execute(
"--network", networkOut,
"--year", "2022",
"--counts-mapping", rootDirectory.resolve(bastCountsRoot).resolve("bast-mapping.csv").toString(),
"--motorway-data", rootDirectory.resolve(bastCountsRoot).resolve("2022_A_S.zip").toString(),
"--primary-data", rootDirectory.resolve(bastCountsRoot).resolve("2022_B_S.zip").toString(),
"--station-data", rootDirectory.resolve(bastCountsRoot).resolve("Jawe2022.csv").toString(),
"--output", rootDirectory.resolve(outputDirPublic).resolve("metropole-ruhr-v2.0.counts.xml.gz").toString()
);


// Based on 2015 count data, won't be used in the new model
CombinedCountsWriter.writeCounts(outputDirForCounts.resolve("metropole-ruhr-v2.0.counts-old.xml.gz"),
longTermCounts.get(RawDataVehicleTypes.Pkw.toString()), shortTermCounts.get(RawDataVehicleTypes.Pkw.toString()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
import java.util.ArrayList;
import java.util.List;

import org.matsim.api.core.v01.Identifiable;
import org.matsim.api.core.v01.network.Link;
import org.matsim.counts.Counts;
import org.matsim.counts.CountsWriter;

public class CombinedCountsWriter<T> {
public class CombinedCountsWriter<T extends Identifiable<T>> {

private List<Counts<T>> countsList = new ArrayList<>();

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/matsim/run/RunMetropoleRuhrScenario.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ protected Config prepareConfig(Config config) {
config.qsim().setFlowCapFactor(sample.getSample());
config.qsim().setStorageCapFactor(sample.getSample());

simWrapperConfigGroup.defaultParams().sampleSize = sample.getSample();
simWrapperConfigGroup.sampleSize = sample.getSample();
}

// snz activity types that are always the same, Differentiated by typical duration
Expand Down

0 comments on commit 2908979

Please sign in to comment.