Composite traffic model: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
(→R model: delay from distance added) |
||
Line 38: | Line 38: | ||
library(OpasnetBaseUtils) | library(OpasnetBaseUtils) | ||
roads <- op_baseGetData("opasnet_base", "Op_en2634", apply.utf8 = FALSE) | roads <- op_baseGetData("opasnet_base", "Op_en2634", series_id = 2575, apply.utf8 = FALSE) | ||
colnames(roads)[6] <- "Through" | colnames(roads)[6] <- "Through" | ||
# | distance <- op_baseGetData("opasnet_base", "Op_en5322", include = 14299, exclude = c(53097, 53098)) | ||
speed <- 40 # kmh^-1 | |||
tdelay <- distance[distance$Mode == "Car" & distance$Time == "1", c("From", "To", "Result")] | |||
tdelay$Result <- ceiling((tdelay$Result / speed) * n.intervals.per.h) / n.intervals.per.h | |||
colnames(tdelay)[colnames(tdelay) %in% "Result"] <- "Delay" | |||
trips <- op_baseGetData("opasnet_base", "Op_en2625") | trips <- op_baseGetData("opasnet_base", "Op_en2625") | ||
system.time( | |||
for (i in 1:(length(times) - 1)) { | for (i in 1:(length(times) - 1)) { | ||
if(i == 1) { | if(i == 1) { | ||
trips.sample.1 <- trips[trips$Time == times[1],] | trips.sample.1 <- trips[trips$Time == times[1],] | ||
trips.sample.1$Secondary <- 0 | trips.sample.1$Secondary <- 0 | ||
} else { | } else { | ||
Line 58: | Line 64: | ||
trips.sample.2 <- trips[trips$Time == times[i + 1],] | trips.sample.2 <- trips[trips$Time == times[i + 1],] | ||
# Optimizer main code | # Optimizer main code | ||
Line 133: | Line 137: | ||
# Add transferred passengers to the next time slot as secondary passengers | # Add transferred passengers to the next time slot as secondary passengers | ||
trips.left.trans <- merge(trips.left.trans, tdelay) | |||
colnames(trips.left.trans)[5] <- "Secondary" | colnames(trips.left.trans)[5] <- "Secondary" | ||
Line 140: | Line 143: | ||
colnames(trips.left.trans)[2] <- "From" | colnames(trips.left.trans)[2] <- "From" | ||
colnames(trips.left.trans)[3] <- "To" | colnames(trips.left.trans)[3] <- "To" | ||
trips.left.trans$Time <- as.character(as.numeric(as.character(trips.left.trans$Time)) + | trips.left.trans$Time <- as.character(as.numeric(as.character(trips.left.trans$Time)) + trips.left.trans$Delay) | ||
trips.left.trans <- as.data.frame(as.table(tapply(trips.left.trans$Secondary, trips.left.trans[, | trips.left.trans <- as.data.frame(as.table(tapply(trips.left.trans$Secondary, trips.left.trans[, | ||
Line 151: | Line 154: | ||
trips.out <- rbind(trips.out, data.frame(trips.sample.1[, c("From", "To", "Time")], d8, d4, d3, d2, d1, c8, c4, c3, c2, c1)) | trips.out <- rbind(trips.out, data.frame(trips.sample.1[, c("From", "To", "Time")], d8, d4, d3, d2, d1, c8, c4, c3, c2, c1)) | ||
} | } | ||
) | |||
# Summary | # Summary | ||
Line 176: | Line 180: | ||
{{todo|Ruvetaan keräämään tälle sivulle matskua mallin uudesta versiosta.|Smxb}} | {{todo|Ruvetaan keräämään tälle sivulle matskua mallin uudesta versiosta.|Smxb}} | ||
{{comment|# |Takes below 10 minutes to run. Neat!|--[[User:Teemu R|Teemu R]] 14:08, 2 August 2011 (EEST)}} |
Revision as of 11:08, 2 August 2011
Moderator:Smxb (see all) |
This page is a stub. You may improve it into a full page. |
Upload data
|
This page is about a composite traffic model that is an updated version of File:Composite traffic.ANA. The new version is coded with R.
Definition
Variables
- Trip rate on a workday in the Helsinki metropolitan area
- Route matrix in the Helsinki metropolitan area
- Distance matrix in the Helsinki metropolitan area
R model
- Trip aggregator
- Optimization rules:
- No second transfer -> prioritize "secondary" passengers
- Fill as many 8-person-vehicles as possible
- Fill as many 4-person-vehicles as possible
- Special rule: for trips with no possible transfer-point -> direct trip
- Transfer the rest (will always be 4-person-vehicles)
- Re-check vehicle configurations, when exact numbers of primary and secondary passengers as well as transferees are known
TODO: {{#todo:Ruvetaan keräämään tälle sivulle matskua mallin uudesta versiosta.|Smxb|}}
----#: . Takes below 10 minutes to run. Neat! --Teemu R 14:08, 2 August 2011 (EEST) (type: truth; paradigms: science: comment)