Ero sivun ”Helsingin seudun liikennemalli” versioiden välillä
Siirry navigaatioon
Siirry hakuun
p (→R malli) |
(→R malli: alustavaa koodia) |
||
Rivi 11: | Rivi 11: | ||
library(OpasnetBaseUtils) | library(OpasnetBaseUtils) | ||
trips <- op_baseGetData("opasnet_base", "Op_en2625") | trips <- op_baseGetData("opasnet_base", "Op_en2625") | ||
bus.routes <- op_baseGetData("opasnet_base", "Op_en5336") | |||
distance <- op_baseGetData("opasnet_base", "Op_en5322", include = 14299, exclude = 53098) | distance <- op_baseGetData("opasnet_base", "Op_en5322", include = 14299, exclude = 53098) | ||
buses <- data.frame() | |||
for (i in levels(bus.routes$Route_id)) { | |||
temp <- bus.routes[bus.routes$Route_id == i, c("Route_id", "Time_id", "Route_order", "Result.Text")] | |||
temp <- temp[order(temp$Route_order),] | |||
temp <- data.frame(Route_id = temp$Route_id[1], Time_id = temp$Time_id[1], From = temp$Result.Text[1:(length(temp$Result.Text) - 1)], | |||
To = temp$Result.Text[2:length(temp$Result.Text)]) | |||
# delay between "stops" should be calculated, as well as the times when buses start | |||
#temp <- merge(temp, distance[,c("From", "To", "Result")]) | |||
#temp$Delay <- c(0, temp$Result[-nrow(temp)]) / 20 #speed | |||
#temp$Time <- temp$Time + temp$Delay | |||
buses <- rbind(buses, temp) | |||
colnames(temp)[3:4] <- c("To", "From") # returning buses (if they do that, i dont know) | |||
temp <- temp[,c(1,2,4,3)] | |||
buses <- rbind(buses, temp) | |||
} | |||
trips.bus <- merge(trips, buses) | |||
buses.per.stop <- tapply(trips.bus$Result, trips.bus[,c("From", "To", "Time")], length) | |||
gc() | gc() | ||
# Costs, need to be modified to fit the new scenario | |||
test3 <- as.data.frame(as.table(tapply(test2$vehicle.kilometers, test2$Type, sum))) | |||
colnames(test3) <- c("Type", "vehicle.kilometers") | |||
fuel.cons.emis.CO2 <- data.frame(Type = c("n.full.8.cars", "n.full.4.cars", "n.4.cars.3.pas", "n.4.cars.2.pas", "n.4.cars.1.pas"), | |||
Consumption = c(8.7, 5.7, 5.7, 5.7, 5.7) / 100, Emis.factor.CO2 = c(232, 153, 153, 153, 153)) | |||
emis.factor.PM <- 0.1 # gkm^-1 | |||
fuel.price <- 1.374 # 4.8. average cost of a liter of diesel fuel in Finland | |||
maint.price <- 0.0582 # €km^-1 | |||
driver.salary <- 2313 / 160 * 1.35 # €h^-1 | |||
test3 <- merge(test3, fuel.cons.emis.CO2) | |||
test3$Fuel.cost <- test3$vehicle.kilometers * test3$Consumption * fuel.price | |||
test3$Maint.cost <- test3$vehicle.kilometers * maint.price | |||
test3$Emis.CO2 <- test3$vehicle.kilometers * test3$Emis.factor.CO2 | |||
test3$Emis.PM <- test3$vehicle.kilometers * emis.factor.PM | |||
test3$Driver.cost <- test3$vehicle.kilometers / speed * driver.salary | |||
PM.lethality <- c(-7.223e-004, 5.640e-006, 4.228e-005, 5.987e-005, 8.013e-005, 1.150e-004, 2.037e-004, 2.939e-004, 3.598e-004, 4.132e-004, | |||
4.640e-004, 5.139e-004, 5.662e-004, 6.233e-004, 6.854e-004, 7.577e-004, 8.441e-004, 9.519e-004, 1.093e-003, 1.314e-003, 2.805e-003) | |||
PM.lethality <- median(PM.lethality) # deaths / kg | |||
value.of.life <- (2e6 + 0.98e6) / 2 # runif(n, 0.98e6, 2e6) # € / death | |||
emis.price.PM <- PM.lethality * value.of.life # 201.879 # €kg^-1 | |||
emis.price.CO2 <- 10e-3 # runif(n, 5e-3, 40e-3) # €kg^-1, the price of CO2 allowances fluctuates quite a bit, in 8.8.2011 they | |||
# were going for 10.74 € per ton of CO2 equivalent | |||
test3$CO2.cost <- test3$Emis.CO2 * emis.price.CO2 | |||
test3$PM.cost <- test3$Emis.PM * emis.price.PM | |||
# bus emis: 44 - 54 * 10^-2 lkm^-1; ref: N. Nylund, K. Erkkilä, T. Hartikka 2007 http://www.vtt.fi/inf/pdf/tiedotteet/2007/T2372.pdf p.31 | |||
</rcode> | </rcode> | ||
Versio 19. elokuuta 2011 kello 11.30
Moderaattori:Teemu R (katso kaikki)
Sivun edistymistä ei ole arvioitu. Arvostuksen määrää ei ole arvioitu (ks. peer review). |
Lisää dataa
|
Rajaus
Tarkastellaan julkisten kulkuvälineiden tuen suuruuden vaikutusta liikenteen (yksityisautoilun ja bussien osalta) kokonaiskustannuksia (otetaan huomioon pienhiukkas- ja kasvihuonekaasupäästöt, bussin kuljettajien palkka, polttoaineen hinta) pääkaupunkiseudulla.