diff --git a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/dashboards/CreateDrtDashboard.java b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/dashboards/CreateDrtDashboard.java new file mode 100644 index 00000000000..382092147d0 --- /dev/null +++ b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/dashboards/CreateDrtDashboard.java @@ -0,0 +1,87 @@ +/* *********************************************************************** * + * project: org.matsim.* + * Controler.java + * * + * *********************************************************************** * + * * + * copyright : (C) 2007 by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** */ + +package org.matsim.contrib.drt.extension.dashboards; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.matsim.application.ApplicationUtils; +import org.matsim.application.MATSimAppCommand; +import org.matsim.core.config.Config; +import org.matsim.core.config.ConfigUtils; +import org.matsim.simwrapper.SimWrapper; +import org.matsim.simwrapper.SimWrapperConfigGroup; +import picocli.CommandLine; + +import java.io.IOException; +import java.nio.file.Path; +import java.util.List; + +@CommandLine.Command( + name = "drt", + description = "Run DRT analysis and create SimWrapper dashboard for existing run output." +) +final class CreateDrtDashboard implements MATSimAppCommand { + + private static final Logger log = LogManager.getLogger(CreateDrtDashboard.class); + + @CommandLine.Parameters(arity = "1..*", description = "Path to run output directories for which emission dashboards are to be generated.") + private List inputPaths; + + private CreateDrtDashboard(){ + } + + @Override + public Integer call() throws Exception { + + for (Path runDirectory : inputPaths) { + log.info("Running on {}", runDirectory); + + Path configPath = ApplicationUtils.matchInput("config.xml", runDirectory); + Config config = ConfigUtils.loadConfig(configPath.toString()); + SimWrapper sw = SimWrapper.create(config); + + SimWrapperConfigGroup simwrapperCfg = ConfigUtils.addOrGetModule(config, SimWrapperConfigGroup.class); + + //skip default dashboards + simwrapperCfg.defaultDashboards = SimWrapperConfigGroup.Mode.disabled; + + //add drt dashboards + new DrtDashboardProvider().getDashboards(config, sw).forEach(sw::addDashboard); + + try { + //append dashboard to existing ones + boolean append = true; + sw.generate(runDirectory, append); + sw.run(runDirectory); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + return 0; + } + + public static void main(String[] args) { + new CreateDrtDashboard().execute(args); + + } + +} diff --git a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/dashboards/DrtAnalysisPostProcessing.java b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/dashboards/DrtAnalysisPostProcessing.java index a8f9e8eabb0..991152dafe7 100644 --- a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/dashboards/DrtAnalysisPostProcessing.java +++ b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/dashboards/DrtAnalysisPostProcessing.java @@ -111,7 +111,7 @@ private static Table prepareSupplyKPITable(Table vehicleStats) { .round() .setName("Total pax distance [km]")); - tableSupplyKPI.column("d_p/d_t").setName("Pooling ratio"); + tableSupplyKPI.column("d_p/d_t").setName("Occupancy rate [pax-km/v-km]"); tableSupplyKPI.column("l_det").setName("Detour ratio"); tableSupplyKPI.column("emptyRatio").setName("Empty ratio"); diff --git a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/dashboards/DrtDashboard.java b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/dashboards/DrtDashboard.java index b7e1aeda0f9..a62f46a1ebc 100644 --- a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/dashboards/DrtDashboard.java +++ b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/dashboards/DrtDashboard.java @@ -386,7 +386,7 @@ public void configure(Header header, Layout layout) { .el(Line.class, (viz, data) -> { viz.title = "Relative Statistics per iteration"; viz.dataset = data.output("*vehicle_stats_" + drtConfigGroup.mode + ".csv"); - viz.description = "Pooling ratio (Pax distance / Vehicle mileage), Detour ratio, and Empty Ratio"; + viz.description = "Occupancy rate (Pax distance / Vehicle mileage), Detour ratio, and Empty Ratio"; viz.x = "iteration"; viz.columns = List.of("d_p/d_t", "l_det", "emptyRatio"); viz.legendName = List.of("Pooling ratio", "Detour ratio", "Empty Ratio");