diff --git a/input/v1.1/vvo_tarifzone20/vvo_tarifzone20_hoyerswerda_utm32n.dbf b/input/v1.1/vvo_tarifzone20/vvo_tarifzone20_hoyerswerda_utm32n.dbf new file mode 100644 index 0000000..2264ba1 Binary files /dev/null and b/input/v1.1/vvo_tarifzone20/vvo_tarifzone20_hoyerswerda_utm32n.dbf differ diff --git a/input/v1.1/vvo_tarifzone20/vvo_tarifzone20_hoyerswerda_utm32n.prj b/input/v1.1/vvo_tarifzone20/vvo_tarifzone20_hoyerswerda_utm32n.prj new file mode 100644 index 0000000..bd846ae --- /dev/null +++ b/input/v1.1/vvo_tarifzone20/vvo_tarifzone20_hoyerswerda_utm32n.prj @@ -0,0 +1 @@ +PROJCS["ETRS_1989_UTM_Zone_32N",GEOGCS["GCS_ETRS_1989",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",9.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]] \ No newline at end of file diff --git a/input/v1.1/vvo_tarifzone20/vvo_tarifzone20_hoyerswerda_utm32n.shp b/input/v1.1/vvo_tarifzone20/vvo_tarifzone20_hoyerswerda_utm32n.shp new file mode 100644 index 0000000..462f27b Binary files /dev/null and b/input/v1.1/vvo_tarifzone20/vvo_tarifzone20_hoyerswerda_utm32n.shp differ diff --git a/input/v1.1/vvo_tarifzone20/vvo_tarifzone20_hoyerswerda_utm32n.shx b/input/v1.1/vvo_tarifzone20/vvo_tarifzone20_hoyerswerda_utm32n.shx new file mode 100644 index 0000000..bb41c7e Binary files /dev/null and b/input/v1.1/vvo_tarifzone20/vvo_tarifzone20_hoyerswerda_utm32n.shx differ diff --git a/pom.xml b/pom.xml index 270e964..dc8653d 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ - 2025.0-PR3388 + 2025.0-PR3382 diff --git a/src/main/R/analysis/deutschlandtarifPricesAnalysis.R b/src/main/R/analysis/deutschlandtarifPricesAnalysis.R new file mode 100644 index 0000000..88cd168 --- /dev/null +++ b/src/main/R/analysis/deutschlandtarifPricesAnalysis.R @@ -0,0 +1,54 @@ +library(tidyverse) + +prices <- read.csv(file="../../shared-svn/projects/DiTriMo/data/deutschlandtarif_prices/deutschlandtarif_prices.csv") + +prices20 <- prices %>% + filter(km <= 20) + +prices100 <- prices %>% + filter(km <= 100) + +prices1000 <- prices %>% + filter(km <= 1000) + +pricesAbove100 <- prices %>% + filter(km >= 100) + +linear20 <- lm(price ~ km, data = prices20) +linear100 <- lm(price ~ km, data = prices100) +linear1000 <- lm(price ~ km, data = prices1000) +linear <- lm(price ~ km, data = prices) +linearAbove100 <- lm(price ~ km, data = pricesAbove100) + +# Create a dataframe for the lines +lines_df <- data.frame( + intercept = c(coef(linear)[1], coef(linear20)[1], coef(linear100)[1], coef(linear1000)[1], coef(linearAbove100)[1]), + slope = c(coef(linear)[2], coef(linear20)[2], coef(linear100)[2], coef(linear1000)[2], coef(linearAbove100)[2]), + label = c("1-2000km", "1-20km", "1-100km", "1-1000km", "100-2000km") +) + +ggplot(prices, aes(x = km, y = price)) + + geom_point() + # Scatter plot of the data points + geom_abline(data = lines_df, aes(intercept = intercept, slope = slope, color = label), linewidth=.75) + + scale_color_manual(values = c("red", "lightblue", "orange3", "purple4", "pink")) + # Manually setting colors + labs(title = "Deutschlandtarif linear functions", + x = "km", + y = "price [€]", + color = "Model") + # Legend title + theme_minimal() + +lines_df_relevant <- data.frame( + intercept = c(coef(linear100)[1], coef(linearAbove100)[1]), + slope = c(coef(linear100)[2], coef(linearAbove100)[2]), + label = c("1-100km", "100-2000km") +) + +ggplot(prices, aes(x = km, y = price)) + + geom_point() + # Scatter plot of the data points + geom_abline(data = lines_df_relevant, aes(intercept = intercept, slope = slope, color = label), linewidth=.75) + + scale_color_manual(values = c("red", "blue"), labels = c("1-100km y = 0.272x + 1.67", "100-2000km y = 0.11x + 26.89")) + # Manually setting colors + labs(title = "Deutschlandtarif linear functions", + x = "km", + y = "price [€]", + color = "Model") + # Legend title + theme_minimal() diff --git a/src/main/java/org/matsim/run/LausitzScenario.java b/src/main/java/org/matsim/run/LausitzScenario.java index 074c72c..e9ea075 100644 --- a/src/main/java/org/matsim/run/LausitzScenario.java +++ b/src/main/java/org/matsim/run/LausitzScenario.java @@ -28,6 +28,9 @@ import org.matsim.simwrapper.SimWrapperConfigGroup; import org.matsim.simwrapper.SimWrapperModule; 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; @@ -109,7 +112,14 @@ protected Config prepareConfig(Config config) { config.qsim().setUsePersonIdForMissingVehicleId(false); config.routing().setAccessEgressType(RoutingConfigGroup.AccessEgressType.accessEgressModeToLink); - // TODO: Config options +// 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 + PtFareConfigGroup ptFareConfigGroup = ConfigUtils.addOrGetModule(config, PtFareConfigGroup.class); + ptFareConfigGroup.setPtFareCalculationModel(PtFareConfigGroup.PtFareCalculationModels.fareZoneBased); + + DistanceBasedPtFareParams fareParams = ConfigUtils.addOrGetModule(config, DistanceBasedPtFareParams.class); + fareParams.setFareZoneShp("vvo_tarifzone20/vvo_tarifzone20_hoyerswerda_utm32n.shp"); // TODO: recreate counts format with car and trucks @@ -140,8 +150,7 @@ protected void prepareControler(Controler controler) { controler.addOverridingModule(new AbstractModule() { @Override public void install() { - install(new LausitzPtFareModule()); - + install(new PtFareModule()); bind(ScoringParametersForPerson.class).to(IncomeDependentUtilityOfMoneyPersonScoringParameters.class).asEagerSingleton(); addTravelTimeBinding(TransportMode.ride).to(networkTravelTime());