Closed Joaobazzo closed 3 years ago
Hi all. This is a draft of the general structure flow I have in mind for the gtfs2emis
function:
gtfs
: a gtfs.zip file fleet_data
: a data.frame
with information of fleet characteristics
df
can either bring detailed info for each route_id
or a summary table describing overall characteristics of the fleetpollutants_list:
a vector of list of pollutantsoutput_dir
: directory to save outputsThese would be the big steps of the gtfs2emis
function:
Read gps-like records in data.table
gtfs2gps::gtfs2gps
data.table
, then use data.table::fread
gps_dt
Convert gps_dt
into multilinestring
gps_linestring
Merge fleet_data
info to gps_linestring
route_ids
Loads emission factors data
vein
packageCalculate transport emissions by combining info from:
gps_linestring
with fleet characteristicsgps_linestring
data, where each column presents the amount of emission in each linestring segment Save outputs
I would also add as input:
local emission_factors
: In Brasil we use data from CETESB
, but the user can add some local data. We could also provide/suggest general emission factor data used in situations without local information.
age of fleet associated with euro standard
: Class data.table/data.frame. It's useful because we can relate a certain technology of a bus to an euro standard, so we can use speed-dependent emission factor. For instance, in Brazil, buses from 2016 have comparable technology to EURO V
- which has consequently specific emission factors dependent on speed. We can find a lot of these relationships in https://www.transportpolicy.net/ , so I don't think it will be an issue
terrain_data
: If user wants to have slope-dependent emissions. If this data is missing, we don't consider slope.
Several ideas about the structure of the package were discussed
Inputs
1) GTFS data
GTFS data should be first import through a prep_data function, so the main function can import only the data of interest. The prep_data function should do the following tasks: i) convert GTFS to GPS; i.1) convert GPS data from
POINTS
toMULTILINESTRING
ii) filter by the hour; iii) filter by shape_id; iv) filter by trip_id;The main data from GTFS, should de something like
2) Fleet
fleet_data
Ideally, the fleet data should be preprocessed previously and be presented according to the structure
route_id
;age
;category
;fuel
It will require later on a function to check whether or not the table is presented accordingly.
In case of no information, the main function of
emis
should use general data from a source (which should be defined later on) to estimate thefleet_data
3) Emission factor
The emission factor data should be imported, initially, through
vein
, especially functions such asvein::ef_hdv_speed()
, and so on. In the case of no argument input, perhaps a general emission factor should be provided4) Output
Ideally, the output of the main function should be as broad as possible. Some post-processing function can be than created to export data such as: