Skip to content

Commit

Permalink
Merge pull request #3328 from matsim-org/noiseDashboard
Browse files Browse the repository at this point in the history
NoiseAnalysis
  • Loading branch information
tschlenther authored Jun 20, 2024
2 parents 6ee1b3b + 886ea24 commit b9ab343
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ public Integer call() throws Exception {
private Config prepareConfig() {
Config config = ConfigUtils.loadConfig(ApplicationUtils.matchInput("config.xml", input.getRunDirectory()).toAbsolutePath().toString(), new NoiseConfigGroup());

//it is important to match "output_vehicles" because otherwise dvrpVehicle files might be matched and the code crashes later
config.vehicles().setVehiclesFile(ApplicationUtils.matchInput("output_vehicles", input.getRunDirectory()).toAbsolutePath().toString());
//it is important to match "output_vehicles.xml.gz" specifically, because otherwise dvrpVehicle files might be matched and the code crashes later
config.vehicles().setVehiclesFile(ApplicationUtils.matchInput("output_vehicles.xml.gz", input.getRunDirectory()).toAbsolutePath().toString());
config.network().setInputFile(ApplicationUtils.matchInput("network", input.getRunDirectory()).toAbsolutePath().toString());
config.transit().setTransitScheduleFile(null);
config.transit().setVehiclesFile(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ 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.")
@CommandLine.Parameters(arity = "1..*", description = "Path to run output directories for which DRT dashboards are to be generated.")
private List<Path> inputPaths;

private CreateDrtDashboard(){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.matsim.simwrapper.dashboard;

import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.matsim.application.MATSimApplication;
Expand All @@ -15,6 +16,7 @@


import java.net.URL;
import java.nio.file.Path;

public class NoiseDashboardTests {

Expand All @@ -24,6 +26,8 @@ public class NoiseDashboardTests {

@Test
void generate() {
Path out = Path.of(utils.getOutputDirectory(), "analysis", "noise");

Config config = TestScenario.loadConfig(utils);

config.global().setCoordinateSystem("EPSG:25832");
Expand All @@ -34,11 +38,14 @@ void generate() {

simWrapperConfigGroup.defaultParams().shp = IOUtils.extendUrl(kelheim, "area/area.shp").toString();


SimWrapper sw = SimWrapper.create(config).addDashboard(new NoiseDashboard());
Controler controler = MATSimApplication.prepare(new TestScenario(sw), config);


controler.run();

Assertions.assertThat(out)
.isDirectoryContaining("glob:**emission_per_day.csv")
.isDirectoryContaining("glob:**immission_per_day.avro")
.isDirectoryContaining("glob:**immission_per_hour.avro");
}
}

0 comments on commit b9ab343

Please sign in to comment.