diff --git a/src/main/java/org/matsim/dashboard/BerlinDashboardProvider.java b/src/main/java/org/matsim/dashboard/BerlinDashboardProvider.java index dbc32e55..510a1b11 100644 --- a/src/main/java/org/matsim/dashboard/BerlinDashboardProvider.java +++ b/src/main/java/org/matsim/dashboard/BerlinDashboardProvider.java @@ -7,6 +7,7 @@ import org.matsim.simwrapper.Dashboard; import org.matsim.simwrapper.DashboardProvider; import org.matsim.simwrapper.SimWrapper; +import org.matsim.simwrapper.dashboard.EmissionsDashboard; import org.matsim.simwrapper.dashboard.TrafficCountsDashboard; import org.matsim.simwrapper.dashboard.TravelTimeComparisonDashboard; import org.matsim.simwrapper.dashboard.TripDashboard; @@ -30,6 +31,7 @@ public List getDashboards(Config config, SimWrapper simWrapper) { return List.of( trips, new TravelTimeComparisonDashboard(ApplicationUtils.resolve(config.getContext(), "berlin-v" + OpenBerlinScenario.VERSION + "-routes-ref.csv.gz")), + new EmissionsDashboard(config.global().getCoordinateSystem()), new TrafficCountsDashboard() .withModes(TransportMode.car, Set.of(TransportMode.car)) .withModes(TransportMode.truck, Set.of(TransportMode.truck, "freight")) diff --git a/src/main/java/org/matsim/run/OpenBerlinScenario.java b/src/main/java/org/matsim/run/OpenBerlinScenario.java index 32465c74..997864d8 100644 --- a/src/main/java/org/matsim/run/OpenBerlinScenario.java +++ b/src/main/java/org/matsim/run/OpenBerlinScenario.java @@ -8,6 +8,9 @@ import org.matsim.api.core.v01.TransportMode; import org.matsim.application.MATSimApplication; import org.matsim.application.options.SampleOptions; +import org.matsim.contrib.emissions.HbefaRoadTypeMapping; +import org.matsim.contrib.emissions.OsmHbefaMapping; +import org.matsim.contrib.emissions.utils.EmissionsConfigGroup; import org.matsim.contrib.vsp.scoring.RideScoringParamsFromCarParams; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; @@ -35,6 +38,13 @@ public class OpenBerlinScenario extends MATSimApplication { public static final String VERSION = "6.4"; public static final String CRS = "EPSG:25832"; + // To decrypt hbefa input files set MATSIM_DECRYPTION_PASSWORD as environment variable. ask VSP for access. + private static final String HBEFA_2020_PATH = "https://svn.vsp.tu-berlin.de/repos/public-svn/3507bb3997e5657ab9da76dbedbb13c9b5991d3e/0e73947443d68f95202b71a156b337f7f71604ae/"; + private static final String HBEFA_FILE_COLD_DETAILED = HBEFA_2020_PATH + "82t7b02rc0rji2kmsahfwp933u2rfjlkhfpi2u9r20.enc"; + private static final String HBEFA_FILE_WARM_DETAILED = HBEFA_2020_PATH + "944637571c833ddcf1d0dfcccb59838509f397e6.enc"; + private static final String HBEFA_FILE_COLD_AVERAGE = HBEFA_2020_PATH + "r9230ru2n209r30u2fn0c9rn20n2rujkhkjhoewt84202.enc" ; + private static final String HBEFA_FILE_WARM_AVERAGE = HBEFA_2020_PATH + "7eff8f308633df1b8ac4d06d05180dd0c5fdf577.enc"; + @CommandLine.Mixin private final SampleOptions sample = new SampleOptions(10, 25, 3, 1); @@ -101,11 +111,25 @@ protected Config prepareConfig(Config config) { .setSubpopulation("person") ); + // Add emissions configuration + EmissionsConfigGroup eConfig = ConfigUtils.addOrGetModule(config, EmissionsConfigGroup.class); + eConfig.setDetailedColdEmissionFactorsFile(HBEFA_FILE_COLD_DETAILED); + eConfig.setDetailedWarmEmissionFactorsFile(HBEFA_FILE_WARM_DETAILED); + eConfig.setAverageColdEmissionFactorsFile(HBEFA_FILE_COLD_AVERAGE); + eConfig.setAverageWarmEmissionFactorsFile(HBEFA_FILE_WARM_AVERAGE); + eConfig.setHbefaTableConsistencyCheckingLevel(EmissionsConfigGroup.HbefaTableConsistencyCheckingLevel.consistent); + eConfig.setDetailedVsAverageLookupBehavior(EmissionsConfigGroup.DetailedVsAverageLookupBehavior.tryDetailedThenTechnologyAverageThenAverageTable); + return config; } @Override protected void prepareScenario(Scenario scenario) { + + // add hbefa link attributes. + HbefaRoadTypeMapping roadTypeMapping = OsmHbefaMapping.build(); + roadTypeMapping.addHbefaMappings(scenario.getNetwork()); + } @Override