Skip to content

Commit

Permalink
add to run class
Browse files Browse the repository at this point in the history
  • Loading branch information
GregorRyb committed Aug 27, 2024
1 parent f6e61b1 commit 5bb1212
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
8 changes: 7 additions & 1 deletion src/main/java/org/matsim/run/LeipzigScenario.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ protected Config prepareConfig(Config config) {
// walk probably is teleported.
// but we do not know where the facilities are. (Facilities are not written to file.)



if (networkOpt.hasDrtArea()) {
//drt
DrtCaseSetup.prepareConfig(config, /* drtCase, */ new ShpOptions(networkOpt.getDrtArea(), null, null), ptDrtIntermodality);
Expand Down Expand Up @@ -277,7 +279,6 @@ protected void prepareScenario(Scenario scenario) {
if (networkOpt.hasCarFreeArea()){
PreparePopulation.deleteCarAndRideRoutesThatHaveForbiddenLinks(scenario.getPopulation(), networkOpt.getNonPtLinksInCarFreeArea(scenario.getNetwork()));
}

}

@Override
Expand Down Expand Up @@ -333,6 +334,11 @@ public void install() {
if (bike == BicycleHandling.onNetworkWithBicycleContrib) {
controler.addOverridingModule(new BicycleModule());
}

if (networkOpt.hasEBikeCity()) {
controler.getScenario().getVehicles().getVehicleTypes().get(TransportMode.bike).setMaximumVelocity(8.32);

}
}

/**
Expand Down
18 changes: 13 additions & 5 deletions src/main/java/org/matsim/run/prepare/NetworkOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ public class NetworkOptions {
private Double slowSpeedRelativeChange;
@CommandLine.Option(names = "--slow-speed-relative-change", description = "provide a value that is bigger than 0.0 and smaller than 1.0")
private Path eBikeCity;
@CommandLine.Option(names = "--eBikeCity", description = "provide a value that is bigger than 0.0 and smaller than 1.0")
@CommandLine.Option(names = "--eBikeCity", description = "simplified e-bike city")



public boolean hasEBikeCity() {
return isDefined(eBikeCity);
}


/**
Expand Down Expand Up @@ -112,14 +118,16 @@ public void prepare(Network network) {
}
}

if (isDefined(eBikeCity)) {


if (hasEBikeCity()) {
if (!Files.exists(eBikeCity)) {
throw new IllegalArgumentException("Path to e-bike city not found: " + eBikeCity);
} else {
PrepareNetwork.prepareEBikeCity(network, ShpGeometryUtils.loadPreparedGeometries(IOUtils.resolveFileOrResource(new ShpOptions(eBikeCity, null, null).getShapeFile().toString())));
}
}
}



/**
* Return path to drt area.
*/
Expand Down

0 comments on commit 5bb1212

Please sign in to comment.