# \donttest{
if (requireNamespace("gtfstools", quietly=TRUE)) {
# read GTFS
gtfs_file <- system.file("extdata/bra_cur_gtfs.zip", package = "gtfs2emis")
gtfs <- gtfstools::read_gtfs(gtfs_file)
# keep a single trip_id to speed up this example
gtfs_small <- gtfstools::filter_by_trip_id(gtfs, trip_id ="4451136")
# run transport model
tp_model <- transport_model(gtfs_data = gtfs_small,
min_speed = 2,
max_speed = 80,
new_speed = 20,
spatial_resolution = 100,
parallel = FALSE)
# Example using Brazilian emission model and fleet
fleet_data_ef_cetesb <- data.frame(veh_type = "BUS_URBAN_D",
model_year = 2010:2019,
fuel = "D",
fleet_composition = rep(0.1,10)
)
emi_cetesb <- progressr::with_progress(emission_model(
tp_model = tp_model,
ef_model = "ef_brazil_cetesb",
fleet_data = fleet_data_ef_cetesb,
pollutant = c("CO","PM10","CO2","CH4","NOx")
))
# Example using European emission model and fleet
fleet_data_ef_europe <- data.frame( veh_type = c("Ubus Midi <=15 t",
"Ubus Std 15 - 18 t",
"Ubus Artic >18 t")
, euro = c("III","IV","V")
, fuel = rep("D",3)
, tech = c("-","SCR","SCR")
, fleet_composition = c(0.4,0.5,0.1))
emi_emep <- progressr::with_progress(emission_model(tp_model = tp_model
, ef_model = "ef_europe_emep"
, fleet_data = fleet_data_ef_europe
, pollutant = c("PM10","NOx")))
emi_emep_wear <- progressr::with_progress(emission_model(tp_model = tp_model
, ef_model = "ef_europe_emep"
, fleet_data = fleet_data_ef_europe
, pollutant = "PM10"
, process = c("tyre","road","brake")))
raster_cur <- system.file("extdata/bra_cur-srtm.tif", package = "gtfs2emis")
emi_emep_slope <- progressr::with_progress(emission_model(tp_model = tp_model
, ef_model = "ef_europe_emep"
, fleet_data = fleet_data_ef_europe
, heightfile = raster_cur
, pollutant = c("PM10","NOx")))
# Example using US EMFAC emission model and fleet
fleet_data_ef_moves <- data.frame( veh_type = "BUS_URBAN_D"
, model_year = 2010:2019
, fuel = "D"
, reference_year = 2020
, fleet_composition = rep(0.1,10))
fleet_data_ef_emfac <- data.frame( veh_type = "BUS_URBAN_D"
, model_year = 2010:2019
, fuel = "D"
, reference_year = 2020
, fleet_composition = rep(0.1,10))
# Example using US MOVES emission model and fleet
emi_moves <- emission_model(tp_model = tp_model
, ef_model = "ef_usa_moves"
, fleet_data = fleet_data_ef_moves
, pollutant = c("CO","PM10","CO2","CH4","NOx")
, reference_year = 2020)
emi_emfac <- emission_model(tp_model = tp_model
, ef_model = "ef_usa_emfac"
, fleet_data = fleet_data_ef_emfac
, pollutant = c("CO","PM10","CO2","CH4","NOx")
, reference_year = 2020)
}
# }
Run the code above in your browser using DataLab