Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make fare customizable via cmd input #73

Merged
merged 2 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/main/java/org/matsim/drtFare/KelheimDrtFareModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,22 @@ public class KelheimDrtFareModule extends AbstractDvrpModeModule {
private final DrtConfigGroup drtCfg;
private final Network network;
private final double avFare;
private final double baseFare;
private final double surcharge;

public KelheimDrtFareModule(DrtConfigGroup drtCfg, Network network, double avFare) {
public KelheimDrtFareModule(DrtConfigGroup drtCfg, Network network, double avFare, double baseFare, double surcharge) {
super(drtCfg.getMode());
this.drtCfg = drtCfg;
this.network = network;
this.avFare = avFare;
this.baseFare = baseFare;
this.surcharge = surcharge;
}

@Override
public void install() {
// Default pricing scheme
KelheimDrtFareParams kelheimDrtFareParams = new KelheimDrtFareParams(2.0, 1.0, getMode());
KelheimDrtFareParams kelheimDrtFareParams = new KelheimDrtFareParams(baseFare, surcharge, getMode());
kelheimDrtFareParams.setShapeFile("https://svn.vsp.tu-berlin.de/repos/public-svn/matsim/scenarios/countries/de/kelheim/shp/KEXI-fare-shp/DrtFareZonalSystem2.shp");

// Special price for Autonomous vehicles
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/matsim/run/RunKelheimRealDrtDemands.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public Integer call() throws Exception {
controler.configureQSimComponents(DvrpQSimComponents.activateAllModes(MultiModeDrtConfigGroup.get(config)));
MultiModeDrtConfigGroup multiModeDrtConfig = ConfigUtils.addOrGetModule(config, MultiModeDrtConfigGroup.class);
for (DrtConfigGroup drtCfg : multiModeDrtConfig.getModalElements()) {
controler.addOverridingModule(new KelheimDrtFareModule(drtCfg, network, avFare));
controler.addOverridingModule(new KelheimDrtFareModule(drtCfg, network, avFare, 2.0, 1.0));
}
controler.run();
}
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/org/matsim/run/RunKelheimScenario.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ public class RunKelheimScenario extends MATSimApplication {
@CommandLine.Option(names = "--plans", defaultValue = "", description = "Use different input plans")
private String planOrigin;

@CommandLine.Option(names = "--base-fare", defaultValue = "2.0", description = "Base fare of KEXI trip")
private double baseFare;

@CommandLine.Option(names = "--surcharge", defaultValue = "1.0", description = "Surcharge of KEXI trip from / to train station")
private double surcharge;

public RunKelheimScenario(@Nullable Config config) {
super(config);
}
Expand Down Expand Up @@ -337,7 +343,7 @@ public void handleEvent(PersonDepartureEvent event) {
maxSpeed));

for (DrtConfigGroup drtCfg : multiModeDrtConfig.getModalElements()) {
controler.addOverridingModule(new KelheimDrtFareModule(drtCfg, network, avFare));
controler.addOverridingModule(new KelheimDrtFareModule(drtCfg, network, avFare, baseFare, surcharge));
}

//controler.addOverridingModule(new DrtEstimatorModule());
Expand Down
Loading