Ero sivun ”Helsingin seudun liikennemalli” versioiden välillä

Opasnet Suomista
Siirry navigaatioon Siirry hakuun
(→‎Määritelmä: uusi versio)
Rivi 6: Rivi 6:


== Määritelmä ==
== Määritelmä ==
=== Muuttujat ===
*[[:en:Distance matrix in the Helsinki metropolitan area]]
*[[:en:Trip rate on a workday in the Helsinki metropolitan area]]
*[[:en:Bus routes in the Helsinki metropolitan area]]


=== R malli ===
=== R malli ===
Rivi 17: Rivi 23:
temp <- bus.routes[bus.routes$Route_id == i, c("Route_id", "Time_id", "Route_order", "Result.Text")]
temp <- bus.routes[bus.routes$Route_id == i, c("Route_id", "Time_id", "Route_order", "Result.Text")]
temp <- temp[order(temp$Route_order),]
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)],  
for (j in 1:length(temp$Result.Text)) {
To = temp$Result.Text[2:length(temp$Result.Text)])
temp2 <- data.frame(Route_id = temp$Route_id[1], Time_id = temp$Time_id[1], From = temp$Result.Text[j],  
# delay between "stops" should be calculated, as well as the times when buses start; this is not needed when we assume that a bus can pick up  
To = temp$Result.Text[-j])
# anyone during an hour and deliver them anywhere on the route while running the route twice in both directions
# delay between "stops" should be calculated, as well as the times when buses start; this is not needed when we assume that a bus can pick up  
#temp <- merge(temp, distance[,c("From", "To", "Result")])
# anyone during an hour and deliver them anywhere on the route while running the route in both directions
#temp$Delay <- c(0, temp$Result[-nrow(temp)]) / 20 #speed
#temp <- merge(temp, distance[,c("From", "To", "Result")])
#temp$Time <- temp$Time + temp$Delay
#temp$Delay <- c(0, temp$Result[-nrow(temp)]) / 20 #speed
buses <- rbind(buses, temp)
#temp$Time <- temp$Time + temp$Delay
colnames(temp)[3:4] <- c("To", "From") # returning buses (if they do that, i dont know)
buses <- rbind(buses, temp2)
temp <- temp[,c(1,2,4,3)]
}
buses <- rbind(buses, temp)
}
}


Rivi 36: Rivi 41:
trips <- merge(trips, trips.time.sum.margins)
trips <- merge(trips, trips.time.sum.margins)
trips <- tapply(trips$Result, trips[,c("Mode", "Time.hour", "From", "To")], sum)
trips <- tapply(trips$Result, trips[,c("Mode", "Time.hour", "From", "To")], sum)
trips <- as.data.frame(as.table(trips))
trips <- as.data.frame(as.table(trips))
colnames(trips)[5] <- "Result"


trips.bus <- merge(trips[trips$Mode == "Public"], buses)
trips.bus <- merge(trips[trips$Mode == "Public"], buses)


buses.per.stop <- tapply(trips.bus$Result, trips.bus[,c("From", "To", "Time")], length)
buses.per.stop <- tapply(trips.bus$Result, trips.bus[,c("From", "To", "Time.hour")], length)
buses.per.stop <- as.data.frame(as.table(buses.per.stop))
colnames(buses.per.stop)[4] <- "Buses.per.stop"
 
trips.bus.2 <- merge(trips[trips$Mode == "Public"], buses.per.stop)
trips.bus.2$Result <- trips.bus.2$Result / trips.bus.2$Buses.per.stop
 
trips.bus.2 <- merge(trips.bus.2, buses)
 
trips.bus.3 <- tapply(trips.bus.2$Result, trips.bus.2[,c("Route_id", "Time.hour")]) # Passengers per hour per bus route assuming one bus goes in
# both directions and given passengers are divided evenly among buses going into same destinations
trips.bus.3 <- as.data.frame(as.table(trips.bus.3))
trips.bus.3$Active <- trips.bus.3$Freq > minlevel # test whether number of passengers is higher than minumum required to run
trips.bus <- merge(trips.bus, trips.bus.3)
 
trips.possible <- tapply(trips.bus$Active, trips.bus[,c("Time.hour", "From", "To")], sum)
trips.possible <- as.data.frame(as.table(trips.possible))
trips.possible$Possible <- trips.possible$Freq > 0 # test whether at least 1 bus route that includes the considered trip is active
 
trips.bus.2 <- merge(trips[trips$Mode == "Public"], trips.possible)


distance <- op_baseGetData("opasnet_base", "Op_en5322", include = 14299, exclude = 53098)
distance <- op_baseGetData("opasnet_base", "Op_en5322", include = 14299, exclude = 53098)
Rivi 92: Rivi 116:


# 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
# 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 22. elokuuta 2011 kello 12.47



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.

Määritelmä

Muuttujat

R malli

+ Näytä koodi

--#: Jostain eriskummallisesta syystä, koodi on äärettömän hidasta ajamaan serverillä. Arvaan syyksi keskusmuistin loppumisen, jonka jälkeen kiintolevy tulee käyttöön, joka luonnollisesti hidastaa operointia roimasti. gc funktion mukaan erään ajon maksimi muistin käyttö oli yli 3 Gb (http://fi.opasnet.org/fi/Special:R-tools?id=13136726070). --Teemu R 19. elokuuta 2011 kello 15.44 (EEST)

Katso myös