Skip to content

Commit

Permalink
update FareZoneBasedPtFare configs
Browse files Browse the repository at this point in the history
  • Loading branch information
simei94 committed Aug 28, 2024
1 parent 353a236 commit 6c1ae3e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 86 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<!--<version>14.0-PR1452</version>-->

<!-- snapshot == not recommended: rather use PR-labelled release!-->
<version>2025.0-PR3382</version>
<version>2025.0-PR3429</version>
</parent>


Expand Down
78 changes: 0 additions & 78 deletions src/main/java/org/matsim/run/LausitzPtFareModule.java

This file was deleted.

28 changes: 21 additions & 7 deletions src/main/java/org/matsim/run/LausitzScenario.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.google.common.collect.Sets;
import com.google.inject.Key;
import com.google.inject.name.Names;
import org.matsim.analysis.personMoney.PersonMoneyEventsAnalysisModule;
import org.matsim.api.core.v01.Scenario;
import org.matsim.api.core.v01.TransportMode;
import org.matsim.application.MATSimApplication;
Expand All @@ -18,6 +19,10 @@
import org.matsim.application.prepare.pt.CreateTransitScheduleFromGtfs;
import org.matsim.contrib.emissions.HbefaVehicleCategory;
import org.matsim.contrib.emissions.utils.EmissionsConfigGroup;
import org.matsim.contrib.vsp.pt.fare.DistanceBasedPtFareParams;
import org.matsim.contrib.vsp.pt.fare.FareZoneBasedPtFareParams;
import org.matsim.contrib.vsp.pt.fare.PtFareConfigGroup;
import org.matsim.contrib.vsp.pt.fare.PtFareModule;
import org.matsim.contrib.vsp.scenario.SnzActivities;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
Expand All @@ -39,9 +44,6 @@
import org.matsim.vehicles.VehicleType;
import org.matsim.vehicles.VehicleUtils;
import picocli.CommandLine;
import playground.vsp.pt.fare.DistanceBasedPtFareParams;
import playground.vsp.pt.fare.PtFareConfigGroup;
import playground.vsp.pt.fare.PtFareModule;
import playground.vsp.scoring.IncomeDependentUtilityOfMoneyPersonScoringParameters;

import javax.annotation.Nullable;
Expand Down Expand Up @@ -143,17 +145,26 @@ protected Config prepareConfig(Config config) {

// set pt fare calc model to fareZoneBased = fare of vvo tarifzone 20 is paid for trips within fare zone
// every other trip: Deutschlandtarif
// for more info see FareZoneBasedPtFareHandler class in vsp contrib
// for more info see PTFareModule / ChainedPtFareCalculator classes in vsp contrib
PtFareConfigGroup ptFareConfigGroup = ConfigUtils.addOrGetModule(config, PtFareConfigGroup.class);
ptFareConfigGroup.setPtFareCalculationModel(PtFareConfigGroup.PtFareCalculationModels.fareZoneBased);

DistanceBasedPtFareParams fareParams = ConfigUtils.addOrGetModule(config, DistanceBasedPtFareParams.class);
FareZoneBasedPtFareParams vvo20 = new FareZoneBasedPtFareParams();
vvo20.setTransactionPartner("VVO Tarifzone 20");
vvo20.setDescription("VVO Tarifzone 20");
vvo20.setOrder(1);
try {
fareParams.setFareZoneShp(Paths.get(config.getContext().toURI()).getParent().toString() + "/vvo_tarifzone20/vvo_tarifzone20_hoyerswerda_utm32n.shp");
vvo20.setFareZoneShp(Paths.get(config.getContext().toURI()).getParent().toString() + "/vvo_tarifzone20/vvo_tarifzone20_hoyerswerda_utm32n.shp");
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}

DistanceBasedPtFareParams germany = DistanceBasedPtFareParams.GERMAN_WIDE_FARE;
germany.setTransactionPartner("Deutschlandtarif");
germany.setDescription("Deutschlandtarif");
germany.setOrder(2);

ptFareConfigGroup.addParameterSet(vvo20);
ptFareConfigGroup.addParameterSet(germany);

if (emissions == EmissionAnalysisHandling.PERFORM_EMISSIONS_ANALYSIS) {
// set hbefa input files for emission analysis
Expand Down Expand Up @@ -185,6 +196,9 @@ protected void prepareScenario(Scenario scenario) {
@Override
protected void prepareControler(Controler controler) {

//analyse PersonMoneyEvents
controler.addOverridingModule(new PersonMoneyEventsAnalysisModule());

controler.addOverridingModule(new SimWrapperModule());

controler.addOverridingModule(new AbstractModule() {
Expand Down

0 comments on commit 6c1ae3e

Please sign in to comment.