Skip to content

Commit

Permalink
prepare impact analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
frievoe97 committed Dec 18, 2024
1 parent 426d78c commit 52f6c33
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.matsim.application.analysis.impact;

import org.matsim.application.MATSimAppCommand;

public class ImpactAnalysis implements MATSimAppCommand {

@Override
public Integer call() throws Exception {
return 0;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,18 @@
final class CreateSingleSimWrapperDashboard implements MATSimAppCommand {

private static final Logger log = LogManager.getLogger(CreateSingleSimWrapperDashboard.class);

@CommandLine.Mixin
private final ShpOptions shp = new ShpOptions();
@CommandLine.Option(names = "--type", required = true, description = "Provide the dashboard type to be generated. See DashboardType enum within this class.")
private DashboardType dashboardType;

@CommandLine.Parameters(arity = "1..*", description = "Path to run output directories for which the dashboards is to be generated.")
private List<Path> inputPaths;

@CommandLine.Mixin
private final ShpOptions shp = new ShpOptions();

enum DashboardType{
noise,
emissions,
traffic,
overview,
stuckAgent,
populationAttribute,
ODTrip,
trip,
publicTransit
private CreateSingleSimWrapperDashboard() {
}

private CreateSingleSimWrapperDashboard(){
public static void main(String[] args) {
new CreateSingleSimWrapperDashboard().execute(args);
}

@Override
Expand All @@ -86,9 +75,9 @@ public Integer call() throws Exception {

SimWrapperConfigGroup simwrapperCfg = ConfigUtils.addOrGetModule(config, SimWrapperConfigGroup.class);

if (shp.isDefined()){
if (shp.isDefined()) {
//not sure if this is the best way to go, might be that the shape file would be automatically read by providing the --shp command line option
simwrapperCfg.defaultParams().shp = shp.getShapeFile().toString();
simwrapperCfg.defaultParams().shp = shp.getShapeFile();
}

//skip default dashboards
Expand Down Expand Up @@ -124,6 +113,9 @@ public Integer call() throws Exception {
case publicTransit -> {
sw.addDashboard(new PublicTransitDashboard());
}
case impactAnalysis -> {
sw.addDashboard(new ImpactAnalysisDashboard());
}
default -> throw new IllegalArgumentException("unkown dashboard type: " + dashboardType);
}

Expand All @@ -140,8 +132,17 @@ public Integer call() throws Exception {
return 0;
}

public static void main(String[] args) {
new CreateSingleSimWrapperDashboard().execute(args);
enum DashboardType {
noise,
emissions,
traffic,
overview,
stuckAgent,
populationAttribute,
ODTrip,
trip,
publicTransit,
impactAnalysis
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.matsim.simwrapper.dashboard;

import org.matsim.application.analysis.impact.ImpactAnalysis;
import org.matsim.simwrapper.Dashboard;
import org.matsim.simwrapper.Header;
import org.matsim.simwrapper.Layout;
import org.matsim.simwrapper.viz.Table;

/**
* Dashboard with general overview.
*/
public class ImpactAnalysisDashboard implements Dashboard {
@Override
public void configure(Header header, Layout layout) {

header.title = "Impact Analysis";
header.description = "Impact overview of the MATSim run.";

layout.row("links")
.el(Table.class, (viz, data) -> {
viz.title = "Kenngrößen";
viz.dataset = data.compute(ImpactAnalysis.class, "data.csv");
viz.enableFilter = false;
viz.showAllRows = true;
viz.width = 1d;

});
}

}

0 comments on commit 52f6c33

Please sign in to comment.