Skip to content

Commit

Permalink
add emission dashboard and its configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow committed Oct 23, 2024
1 parent a3a9bcb commit 0a11469
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -30,6 +31,7 @@ public List<Dashboard> 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"))
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/org/matsim/run/OpenBerlinScenario.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0a11469

Please sign in to comment.