if (FALSE) {
# Passenger Cars PC
# Emission factor function
V <- 0:150
ef1 <- ef_ldv_speed(v = "PC",t = "4S", cc = "<=1400", f = "G", eu = "PRE",
p = "CO")
efs <- EmissionFactors(ef1(1:150))
plot(Speed(1:150), efs, xlab = "speed[km/h]", type = "b", pch = 16, col = "blue")
# Quick view
pol <- c("CO", "NOx", "HC", "NMHC", "CH4", "FC", "PM", "CO2", "SO2",
"1-butyne", "propyne")
f <- sapply(1:length(pol), function(i){
ef_ldv_speed("PC", "4S", "<=1400", "G", "PRE", pol[i], x = 10)(30)
})
f
# PM Characteristics
pol <- c("AS_urban", "AS_rural", "AS_highway",
"N_urban", "N_rural", "N_highway",
"N_50nm_urban", "N_50_100nm_rural", "N_100_1000nm_highway")
f <- sapply(1:length(pol), function(i){
ef_ldv_speed("PC", "4S", "<=1400", "D", "PRE", pol[i], x = 10)(30)
})
f
# PAH POP
ef_ldv_speed(v = "PC",t = "4S", cc = "<=1400", f = "G", eu = "PRE",
p = "indeno(1,2,3-cd)pyrene")(10)
ef_ldv_speed(v = "PC",t = "4S", cc = "<=1400", f = "G", eu = "PRE",
p = "napthalene")(10)
# Dioxins and Furans
ef_ldv_speed(v = "PC",t = "4S", cc = "<=1400", f = "G", eu = "PRE",
p = "PCB")(10)
# NMHC
ef_ldv_speed(v = "PC",t = "4S", cc = "<=1400", f = "G", eu = "PRE",
p = "hexane")(10)
# List of Copert emission factors for 40 years fleet of Passenger Cars.
# Assuming a euro distribution of euro V, IV, III, II, and I of
# 5 years each and the rest 15 as PRE euro:
euro <- c(rep("V", 5), rep("IV", 5), rep("III", 5), rep("II", 5),
rep("I", 5), rep("PRE", 15))
speed <- 25
lef <- lapply(1:40, function(i) {
ef_ldv_speed(v = "PC", t = "4S", cc = "<=1400", f = "G",
eu = euro[i], p = "CO")
ef_ldv_speed(v = "PC", t = "4S", cc = "<=1400", f = "G",
eu = euro[i], p = "CO", show.equation = FALSE)(25) })
# to check the emission factor with a plot
efs <- EmissionFactors(unlist(lef)) #returns 'units'
plot(efs, xlab = "age")
lines(efs, type = "l")
euros <- c("VI", "V", "IV", "III", "II")
ef_ldv_speed(v = "PC", t = "4S", cc = "<=1400", f = "G",
eu = euros, p = "CO")
a <- ef_ldv_speed(v = "PC", t = "4S", cc = "<=1400", f = "G",
eu = euros, p = "CO", speed = Speed(0:120))
head(a)
filled.contour(as.matrix(a)[1:10, 1:length(euros)], col = cptcity::cpt(n = 18))
filled.contour(as.matrix(a)[110:120, 1:length(euros)], col = cptcity::cpt(n = 16))
filled.contour(as.matrix(a)[, 1:length(euros)], col = cptcity::cpt(n = 21))
filled.contour(as.matrix(a)[, 1:length(euros)],
col = cptcity::cpt("mpl_viridis", n = 21))
filled.contour(as.matrix(a)[, 1:length(euros)],
col = cptcity::cpt("mpl_magma", n = 21))
persp(as.matrix(a)[, 1:length(euros)], phi = 0, theta = 0)
persp(as.matrix(a)[, 1:length(euros)], phi = 25, theta = 45)
persp(as.matrix(a)[, 1:length(euros)], phi = 0, theta = 90)
persp(as.matrix(a)[, 1:length(euros)], phi = 25, theta = 90+45)
persp(as.matrix(a)[, 1:length(euros)], phi = 0, theta = 180)
new_euro <- c("VI", "VI", "V", "V", "V")
euro <- c("V", "V", "IV", "III", "II")
old_euro <- c("III", "II", "I", "PRE", "PRE")
meuros <- rbind(new_euro, euro, old_euro)
aa <- ef_ldv_speed(v = "PC", t = "4S", cc = "<=1400", f = "G",
eu = meuros, p = "CO", speed = Speed(10:11))
# Light Commercial Vehicles
V <- 0:150
ef1 <- ef_ldv_speed(v = "LCV",t = "4S", cc = "<3.5", f = "G", eu = "PRE",
p = "CO")
efs <- EmissionFactors(ef1(1:150))
plot(Speed(1:150), efs, xlab = "speed[km/h]")
lef <- lapply(1:5, function(i) {
ef_ldv_speed(v = "LCV", t = "4S", cc = "<3.5", f = "G",
eu = euro[i], p = "CO", show.equation = FALSE)(25) })
# to check the emission factor with a plot
efs <- EmissionFactors(unlist(lef)) #returns 'units'
plot(efs, xlab = "age")
lines(efs, type = "l")
# Motorcycles
V <- 0:150
ef1 <- ef_ldv_speed(v = "Motorcycle",t = "4S", cc = "<=250", f = "G",
eu = "PRE", p = "CO",show.equation = TRUE)
efs <- EmissionFactors(ef1(1:150))
plot(Speed(1:150), efs, xlab = "speed[km/h]")
# euro for motorcycles
eurom <- c(rep("III", 5), rep("II", 5), rep("I", 5), rep("PRE", 25))
lef <- lapply(1:30, function(i) {
ef_ldv_speed(v = "Motorcycle", t = "4S", cc = "<=250", f = "G",
eu = eurom[i], p = "CO",
show.equation = FALSE)(25) })
efs <- EmissionFactors(unlist(lef)) #returns 'units'
plot(efs, xlab = "age")
lines(efs, type = "l")
a <- ef_ldv_speed(v = "Motorcycle", t = "4S", cc = "<=250", f = "G",
eu = eurom, p = "CO", speed = Speed(0:125))
a$speed <- NULL
filled.contour(as.matrix(a), col = cptcity::lucky(),
xlab = "Speed", ylab = "Age")
persp(x = as.matrix(a), theta = 35, xlab = "Speed", ylab = "Euros",
zlab = "CO [g/km]", col = cptcity::lucky(), phi = 25)
}
Run the code above in your browser using DataLab