Problem 1:

Caltrans Performance Measurement System (PeMS) is a web-based performance measurement system hosted by California Department of Transportation, login to PeMs website at http://pems.dot.ca.gov and answer the following questions.
1.1  Whatis PeMS?
1.2  List at least five possible PeMS applications.
1.3  List three levels of PeMS analysis.

1.1 PeMS is acting as the Data center that collect the data in the sensing network in California, it’s a successful traffic data management that collect,analyze and visualize traffic data from the different sources(sensors on infrastructure and sensors in motion), those sources communicate in different ways. PeMS can provide real-time traffic data and store it to be historical data to use it in researches that help us to better understand the parameters of the traffic capacity, also real-time data helps in thaffic operations that we discussed in the class, incident detection for instance.

1.2 PeMS is really useful in the applications we discussed in class(e.g. incident detection), but also I think it would be much help to check the consistency of the HCM methods in evaluating the performance of the highways and the capacity elements measurement, also in that we can visualize the lost capacity for a segment. however from the PeMS’s manual we can see we can do the following:

1.3 List three levels of PeMS analysis.

Problem 2

Performing a station-level analysis for Highway 280 at Alemany Blvd. in PeMS. You need to retrieve and download the data of flow, speed, and occupancy for this station (Mainline VDS 400322 – Alemany Blvd.) from Sep 14th to Sep 20th, 2018 (in .XLS format).

In the following screenshot (Figure 1) we can see that the Sensor Technology is Dual Loop, induction loops are used at this station.

Figure 1

Also in screenshot (Figure 2) we can see at this station(Highlighted in yellow) has 5 lanes, however the 5th lane exactly at on ramp that’s why it’s not always occupied (zero occupation).

Figure 2

Data has been downloaded in hourly bases (167 observation) from Sep 14th (time 00:00) to Sep 20th (time 22:00), 2018
Link to the data file: pems_output.xlsx

Problem 3

Use the retrieved PeMS data from the station VDS 400322 to plot three fundamental diagrams of traffic flow (Occupancy-Speed; Flow-Speed; and Occupancy-Flow) and estimate the critical traffic flow parameters for this road segment. Noted that in PeMS, Occupancy is provided instead of Density.

data<- read.csv("C:\\Users\\abdal\\OneDrive\\Desktop\\TTU\\Spring 2023\\Traffic1\\HW's\\HW2\\pems_output(csv).csv")

flow<- data$Flow..Veh.Hour.
occ<- data$Occupancy....
speed <- data$Speed..mph.
summary(flow)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     438    1582    3739    3210    4393    6208
summary(occ)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.900   2.350   5.300   5.747   6.300  25.900
summary(speed)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   28.10   61.30   64.40   61.45   66.60   67.40

Estimating the density, fundamental q=K*U is used :

K <- mapply(function(x, y) x/y , flow, speed)
summary(K)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   6.557  23.589  59.795  58.036  72.220 200.142
plot(K,speed)
title("speed(mph) vs. Density(veh/mile)")

From the plot above we can see that a linear regression can fit the data point really well.

model1<- lm(speed~K)
plot(K,speed)
title("speed(mph) vs. Density(veh/mile)")
abline(model1, col = "red")

From the Speed-Density model above the Kj and Uf is now know, also as the the relationship is linear we can find the optimum Capacity parameters and compare it with the existed condition of the road.

model1$coefficients
## (Intercept)           K 
##  72.6529886  -0.1930091
Uf<- 72.6529886
Kj <- (72.6529886/0.1930091)
plot(flow,speed,xlim = c(0,7000),ylim = c(0,80),xlab = "Flow(veh/hr)",ylab = "Speed(mph)",main = "Scatterplot of Flow-Speed")

In the above plot is the Scatter plot of Flow-Speed, in the following step what I call it the optimum Capacity will be estimated and plot it with the Scatter plot of Flow-Speed, from there we will be able to detect the Capacity lost in the road.

speedmod <- seq(from = 0, to = 73, by = 1) 
flowmod <- sapply(speedmod, function(x) 376.4226 * x - 5.181103 * x^2  )

par(mar = c(5, 4, 4, 2) + 0.1, cex = 0.8)  
plot(flow,speed,xlim = c(0,7000),ylim = c(0,80),xlab = "",ylab = "",main = "Flow-Speed Model") 
par(new = TRUE) 
plot(flowmod,speedmod,xlim = c(0,7000),ylim = c(0,80),type = "line",xlab = "Flow(veh/hr)",ylab="Speed(mph)")
## Warning in plot.xy(xy, type, ...): plot type 'line' will be truncated to first
## character

In the above plot:
capacity lost in flow:
In the plot for this road, as the maximum flow is 6208 veh/hr is the actual flow capacity, but from the model what I call it the optimum Capacity model we can see that flow capacity should be 6836.504 veh/hr.
Now this difference is the capacity lost in flow. many reasons could be there as the merging of the on ramps or the road conditions, I mean features we didn’t counter for.

capacity lost in Speed:
At the capacity limits the actual speed(~36) is somewhat equal to the speed in the optimum Capacity model(Ucap=Uf/2=36.327). no lost in the speed capacity.

plot(K,flow,xlim = c(0,377),ylim = c(0,7000),xlab = "Density(veh/mile)",ylab="Flow(veh/hr)")

In the above plot is the Scatter plot of Flow-Density, in the following step what I call it the optimum Capacity will be estimated and plot it with the Scatter plot of Flow-Density, from there we will be able to detect the Capacity lost in the road.

Kmod <- seq(from = 0, to = 377, by = 1) 
flowmod2 <- sapply(Kmod, function(x) 72.6529886 * x - 0.1930091 * x^2  )

par(mar = c(5, 4, 4, 2) + 0.1, cex = 0.8)
plot(Kmod,flowmod2,xlim = c(0,377),ylim = c(0,7000),type = "line",xlab = "",ylab = "",main ="Flow-Density Model" )
## Warning in plot.xy(xy, type, ...): plot type 'line' will be truncated to first
## character
par(new = TRUE) 
plot(K,flow,xlim = c(0,377),ylim = c(0,7000),xlab = "Density(veh/mile)",ylab="Flow(veh/hr)")

In the above plot:
capacity lost in flow:
In the plot for this road, as the maximum flow is 6208 veh/hr is the actual flow capacity, but from the model what I call it the optimum Capacity model we can see that flow capacity should be 6836.504 veh/hr.
Now this difference is the capacity lost in flow. many reasons could be there as the merging of the on ramps or the road conditions, I mean features we didn’t counter for.

capacity lost in Density:
At the capacity limits the actual Density(~160) is less than Density in the optimum Capacity model (Kcap=Kj/2= 188.2) . some lost in the Density capacity in this road.

Problem 4:

Choose another station of your own choice and re-do the same analysis, plot traffic flow fundamental diagrams for the station you selected.

Figure 3

In figure 3 show the new station VDS with the time and Dates of the data used to go through the capacity analysis.

The data file can be found in:pems_output_2ndcc.csv

data2<- read.csv("C:\\Users\\abdal\\OneDrive\\Desktop\\TTU\\Spring 2023\\Traffic1\\HW's\\HW2\\pems_output_2ndcc.csv")

flow2<- data2$Flow..Veh.Hour.
speed2 <- data2$Speed..mph.

summary(flow2)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     395    2016    4177    3564    4836    7007
summary(speed2)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   26.90   62.50   64.90   62.48   67.30   69.40

Estimating the density, fundamental q=K*U is used :

K2 <- mapply(function(x, y) x/y , flow2, speed2)
summary(K2)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   5.792  29.641  66.768  62.746  77.785 219.517
plot(K2,speed2)
title("speed(mph) vs. Density(veh/mile)")

From the plot above we can see that a linear regression can fit the data point really well.

model2<- lm(speed2~K2)
plot(K2,speed2)
title("speed(mph) vs. Density(veh/mile)")
abline(model2, col = "red")

From the Speed-Density model above the Kj and Uf is now know, also as the the relationship is linear we can find the optimum Capacity parameters and compare it with the existed condition of the road.

model2$coefficients
## (Intercept)          K2 
##  73.3794666  -0.1737315

The Uf is the intercept which is 73.3794666 mph. slope is -0.1737315

Uf2<- 73.3794666
Kj2 <- (73.3794666/0.1737315)
plot(flow2,speed2,xlim = c(0,7010),ylim = c(0,80),xlab = "Flow(veh/hr)",ylab = "Speed(mph)",main = "Scatterplot of Flow-Speed")

In the above plot is the Scatter plot of Flow-Speed, in the following step what I call it the optimum Capacity will be estimated and plot it with the Scatter plot of Flow-Speed, from there we will be able to detect the Capacity lost in the road.

speedmod2 <- seq(from = 0, to = 74, by = 1) 
flowmod2 <- sapply(speedmod2, function(x) 422.3728 * x - 5.756009 * x^2  )
par(mar = c(5, 4, 4, 2) + 0.1, cex = 0.8)  
plot(flow2,speed2,xlim = c(0,7500),ylim = c(0,80),xlab = "",ylab = "",main = "Flow-Speed Model") 
par(new = TRUE) 
plot(flowmod2,speedmod2,xlim = c(0,7500),ylim = c(0,80),type = "line",xlab = "Flow(veh/hr)",ylab="Speed(mph)")
## Warning in plot.xy(xy, type, ...): plot type 'line' will be truncated to first
## character

In the above plot:
capacity lost in flow:
In the plot for this road, as the maximum flow is 7007 veh/hr is the actual flow capacity, but from the model what I call it the optimum Capacity model we can see that flow capacity should be 7747.817 veh/hr.
Now this difference is the capacity lost in flow. many reasons could be there as the merging of the on ramps or the road conditions, I mean features we didn’t counter for.

capacity lost in Speed:
At the capacity limits the actual speed(~37) is somewhat equal to the speed in the optimum Capacity model(Ucap=Uf/2=36.68973). no lost in the speed capacity.

plot(K2,flow2,xlim = c(0,220),ylim = c(0,7010),xlab = "Density(veh/mile)",ylab="Flow(veh/hr)")

In the above plot is the Scatter plot of Flow-Density, in the following step what I call it the optimum Capacity will be estimated and plot it with the Scatter plot of Flow-Density, from there we will be able to detect the Capacity lost in the road.

Kmod2 <- seq(from = 0, to = 423, by = 1) 
flowmod3 <- sapply(Kmod2, function(x) 73.37947 * x - 0.1737315 * x^2  )
par(mar = c(5, 4, 4, 2) + 0.1, cex = 0.8)
plot(Kmod2,flowmod3,xlim = c(0,423),ylim = c(0,10000),type = "line",xlab = "",ylab = "",main ="Flow-Density Model" )
## Warning in plot.xy(xy, type, ...): plot type 'line' will be truncated to first
## character
par(new = TRUE) 
plot(K2,flow2,xlim = c(0,423),ylim = c(0,10000),xlab = "Density(veh/mile)",ylab="Flow(veh/hr)")

In the above plot:
capacity lost in flow:
In the plot for this road, as the maximum flow is 7007 veh/hr is the actual flow capacity, but from the model what I call it the optimum Capacity model we can see that flow capacity should be 7748.368 veh/hr.
Now this difference is the capacity lost in flow. many reasons could be there as the merging at the on ramps or the road conditions; I mean features we didn’t counter for.

capacity lost in Density:
At the capacity limits the actual Density(~160) is less than Density in the optimum Capacity model (Kcap=Kj/2= 211.1864) . lost in the Density capacity in this road.