diff --git a/DESCRIPTION b/DESCRIPTION index 2cb2dfd6..8acc25a1 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: vein Type: Package Title: Vehicular Emissions Inventories -Version: 1.1.3 -Date: 2024-04-09 +Version: 1.1.4 +Date: 2024-08-20 Authors@R: c( person(given = "Sergio", family = "Ibarra-Espinosa", role = c("aut", "cre"), diff --git a/NEWS.md b/NEWS.md index f575067e..3d78f294 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ NEWS =========== +### vein 1.1.4 (date: 2024-08-20) + +- ef_ldv_speed when LCV G and eu longer than 1, works + ### vein 1.1.2 (date: 2024-01-24) - fix speciation "pm2023" diff --git a/docs/404.html b/docs/404.html index 2efd80b8..d5924095 100644 --- a/docs/404.html +++ b/docs/404.html @@ -45,7 +45,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/CODE_OF_CONDUCT.html b/docs/CODE_OF_CONDUCT.html index ec25825c..705f81ec 100644 --- a/docs/CODE_OF_CONDUCT.html +++ b/docs/CODE_OF_CONDUCT.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/CONTRIBUTING.html b/docs/CONTRIBUTING.html index dc6c88d4..fdbb2d06 100644 --- a/docs/CONTRIBUTING.html +++ b/docs/CONTRIBUTING.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 7f81b965..aa983ae2 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/articles/basics.html b/docs/articles/basics.html index f55370f1..b33463d0 100644 --- a/docs/articles/basics.html +++ b/docs/articles/basics.html @@ -44,7 +44,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/articles/index.html b/docs/articles/index.html index 6374d899..bf18278c 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/authors.html b/docs/authors.html index 405a0041..d9056880 100755 --- a/docs/authors.html +++ b/docs/authors.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 @@ -104,13 +104,13 @@

Citation

}

Ibarra-Espinosa S (2024). vein: Vehicular Emissions Inventories. -R package version 1.1.3, https://github.com/atmoschem/vein. +R package version 1.1.4, https://github.com/atmoschem/vein.

@Manual{,
   title = {vein: Vehicular Emissions Inventories},
   author = {Sergio Ibarra-Espinosa},
   year = {2024},
-  note = {R package version 1.1.3},
+  note = {R package version 1.1.4},
   url = {https://github.com/atmoschem/vein},
 }
diff --git a/docs/index.html b/docs/index.html index 12c28197..88534776 100755 --- a/docs/index.html +++ b/docs/index.html @@ -46,7 +46,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/news/index.html b/docs/news/index.html index ef0124e9..b5071c00 100755 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 174eda78..0fca7134 100755 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,9 +1,9 @@ -pandoc: 3.1.3 +pandoc: 3.1.11 pkgdown: 2.1.0 pkgdown_sha: ~ articles: basics: basics.html -last_built: 2024-07-08T01:27Z +last_built: 2024-08-21T04:00Z urls: reference: http://atmoschem.github.io/vein/reference article: http://atmoschem.github.io/vein/articles diff --git a/docs/reference/EmissionFactors.html b/docs/reference/EmissionFactors.html index 77231324..363c7191 100755 --- a/docs/reference/EmissionFactors.html +++ b/docs/reference/EmissionFactors.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/EmissionFactorsList.html b/docs/reference/EmissionFactorsList.html index 58ee5add..bec829dd 100755 --- a/docs/reference/EmissionFactorsList.html +++ b/docs/reference/EmissionFactorsList.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/Emissions.html b/docs/reference/Emissions.html index 556a9587..dadaefe0 100755 --- a/docs/reference/Emissions.html +++ b/docs/reference/Emissions.html @@ -26,7 +26,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/EmissionsArray.html b/docs/reference/EmissionsArray.html index bbac3b3c..7441f55a 100755 --- a/docs/reference/EmissionsArray.html +++ b/docs/reference/EmissionsArray.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/GriddedEmissionsArray.html b/docs/reference/GriddedEmissionsArray.html index 7d73e899..00be41ff 100644 --- a/docs/reference/GriddedEmissionsArray.html +++ b/docs/reference/GriddedEmissionsArray.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/Rplot002.png b/docs/reference/Rplot002.png index be48cea0..551bd31b 100644 Binary files a/docs/reference/Rplot002.png and b/docs/reference/Rplot002.png differ diff --git a/docs/reference/Rplot003.png b/docs/reference/Rplot003.png index ead26a77..cfeab77c 100644 Binary files a/docs/reference/Rplot003.png and b/docs/reference/Rplot003.png differ diff --git a/docs/reference/Speed-2.png b/docs/reference/Speed-2.png index 15659509..00e5d1e3 100644 Binary files a/docs/reference/Speed-2.png and b/docs/reference/Speed-2.png differ diff --git a/docs/reference/Speed-3.png b/docs/reference/Speed-3.png index d4575b68..5e32d8c3 100644 Binary files a/docs/reference/Speed-3.png and b/docs/reference/Speed-3.png differ diff --git a/docs/reference/Speed.html b/docs/reference/Speed.html index fd440785..0874d941 100755 --- a/docs/reference/Speed.html +++ b/docs/reference/Speed.html @@ -27,7 +27,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/Vehicles.html b/docs/reference/Vehicles.html index c2f07f33..cb3400e5 100755 --- a/docs/reference/Vehicles.html +++ b/docs/reference/Vehicles.html @@ -26,7 +26,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/add_lkm.html b/docs/reference/add_lkm.html index 46661c44..4a9615cb 100644 --- a/docs/reference/add_lkm.html +++ b/docs/reference/add_lkm.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/add_miles.html b/docs/reference/add_miles.html index 36b25897..a3dc9c0a 100644 --- a/docs/reference/add_miles.html +++ b/docs/reference/add_miles.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/add_polid.html b/docs/reference/add_polid.html index 11c60a3d..b075aa8d 100644 --- a/docs/reference/add_polid.html +++ b/docs/reference/add_polid.html @@ -28,7 +28,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/addscale.html b/docs/reference/addscale.html index 3a8dbb11..9afc2df7 100644 --- a/docs/reference/addscale.html +++ b/docs/reference/addscale.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/adt.html b/docs/reference/adt.html index 75c5f2e2..dd653a13 100644 --- a/docs/reference/adt.html +++ b/docs/reference/adt.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/age.html b/docs/reference/age.html index 31f6ed43..46fe607c 100644 --- a/docs/reference/age.html +++ b/docs/reference/age.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/age_hdv.html b/docs/reference/age_hdv.html index 1fd802ad..463b4807 100755 --- a/docs/reference/age_hdv.html +++ b/docs/reference/age_hdv.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/age_ldv.html b/docs/reference/age_ldv.html index 326a13ff..aabf7844 100755 --- a/docs/reference/age_ldv.html +++ b/docs/reference/age_ldv.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/age_moto.html b/docs/reference/age_moto.html index 9eb32822..41e620a3 100755 --- a/docs/reference/age_moto.html +++ b/docs/reference/age_moto.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/aw.html b/docs/reference/aw.html index 7abb043f..3be17841 100644 --- a/docs/reference/aw.html +++ b/docs/reference/aw.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/celsius.html b/docs/reference/celsius.html index 2ace5d7c..90dac76b 100644 --- a/docs/reference/celsius.html +++ b/docs/reference/celsius.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/check_nt.html b/docs/reference/check_nt.html index 79f7f534..9f36f2d3 100644 --- a/docs/reference/check_nt.html +++ b/docs/reference/check_nt.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/cold_mileage.html b/docs/reference/cold_mileage.html index 55b62bf5..604830d5 100644 --- a/docs/reference/cold_mileage.html +++ b/docs/reference/cold_mileage.html @@ -25,7 +25,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/colplot.html b/docs/reference/colplot.html index 015d0ba3..ca84cccd 100644 --- a/docs/reference/colplot.html +++ b/docs/reference/colplot.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/decoder.html b/docs/reference/decoder.html index cffeff95..cd2c7a2a 100644 --- a/docs/reference/decoder.html +++ b/docs/reference/decoder.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/dmonth.html b/docs/reference/dmonth.html index 49c918ae..9b1274e5 100644 --- a/docs/reference/dmonth.html +++ b/docs/reference/dmonth.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/ef_cetesb.html b/docs/reference/ef_cetesb.html index a1de09e3..d88f1fbe 100644 --- a/docs/reference/ef_cetesb.html +++ b/docs/reference/ef_cetesb.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/ef_china.html b/docs/reference/ef_china.html index 9ce6abf7..85d63979 100644 --- a/docs/reference/ef_china.html +++ b/docs/reference/ef_china.html @@ -26,7 +26,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/ef_china_det.html b/docs/reference/ef_china_det.html index 70a3aa35..0821e1ae 100644 --- a/docs/reference/ef_china_det.html +++ b/docs/reference/ef_china_det.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/ef_china_h.html b/docs/reference/ef_china_h.html index 8d3635c5..68a20e5a 100644 --- a/docs/reference/ef_china_h.html +++ b/docs/reference/ef_china_h.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/ef_china_hu.html b/docs/reference/ef_china_hu.html index eda0cf60..f3a72309 100644 --- a/docs/reference/ef_china_hu.html +++ b/docs/reference/ef_china_hu.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/ef_china_long.html b/docs/reference/ef_china_long.html index 621977d1..351969e9 100644 --- a/docs/reference/ef_china_long.html +++ b/docs/reference/ef_china_long.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/ef_china_s.html b/docs/reference/ef_china_s.html index d8fd4f83..b9aa75e1 100644 --- a/docs/reference/ef_china_s.html +++ b/docs/reference/ef_china_s.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/ef_china_speed.html b/docs/reference/ef_china_speed.html index 516d3d31..ef652b40 100644 --- a/docs/reference/ef_china_speed.html +++ b/docs/reference/ef_china_speed.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/ef_china_te.html b/docs/reference/ef_china_te.html index b97c415f..29de7824 100644 --- a/docs/reference/ef_china_te.html +++ b/docs/reference/ef_china_te.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/ef_china_th.html b/docs/reference/ef_china_th.html index 60a83c57..87e1fb0f 100644 --- a/docs/reference/ef_china_th.html +++ b/docs/reference/ef_china_th.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/ef_eea.html b/docs/reference/ef_eea.html index 0ca732e4..fa60a0fc 100644 --- a/docs/reference/ef_eea.html +++ b/docs/reference/ef_eea.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/ef_emfac.html b/docs/reference/ef_emfac.html index 5c7fca86..675b79fe 100644 --- a/docs/reference/ef_emfac.html +++ b/docs/reference/ef_emfac.html @@ -25,7 +25,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/ef_evap.html b/docs/reference/ef_evap.html index 328e815b..3b58d75b 100755 --- a/docs/reference/ef_evap.html +++ b/docs/reference/ef_evap.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/ef_fun.html b/docs/reference/ef_fun.html index 1116d5e6..06803548 100644 --- a/docs/reference/ef_fun.html +++ b/docs/reference/ef_fun.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/ef_hdv_scaled.html b/docs/reference/ef_hdv_scaled.html index 19b1de93..f0472752 100755 --- a/docs/reference/ef_hdv_scaled.html +++ b/docs/reference/ef_hdv_scaled.html @@ -27,7 +27,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/ef_hdv_speed.html b/docs/reference/ef_hdv_speed.html index 04ecdd95..41af47f0 100755 --- a/docs/reference/ef_hdv_speed.html +++ b/docs/reference/ef_hdv_speed.html @@ -25,7 +25,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/ef_im.html b/docs/reference/ef_im.html index c8b60464..ec12aeb3 100644 --- a/docs/reference/ef_im.html +++ b/docs/reference/ef_im.html @@ -27,7 +27,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/ef_ldv_cold.html b/docs/reference/ef_ldv_cold.html index d4320378..cd595c2b 100755 --- a/docs/reference/ef_ldv_cold.html +++ b/docs/reference/ef_ldv_cold.html @@ -26,7 +26,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/ef_ldv_cold_list.html b/docs/reference/ef_ldv_cold_list.html index cc012985..c16b566c 100755 --- a/docs/reference/ef_ldv_cold_list.html +++ b/docs/reference/ef_ldv_cold_list.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/ef_ldv_scaled.html b/docs/reference/ef_ldv_scaled.html index bb81d394..2bcbcc2c 100755 --- a/docs/reference/ef_ldv_scaled.html +++ b/docs/reference/ef_ldv_scaled.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/ef_ldv_speed.html b/docs/reference/ef_ldv_speed.html index 512acd9e..38170eaf 100755 --- a/docs/reference/ef_ldv_speed.html +++ b/docs/reference/ef_ldv_speed.html @@ -26,7 +26,7 @@ vein - 1.1.3 + 1.1.4 @@ -304,6 +304,14 @@

Examples

xlab = "Speed", ylab = "Age") persp(x = as.matrix(a), theta = 35, xlab = "Speed", ylab = "Euros", zlab = "CO [g/km]", col = cptcity::lucky(), phi = 25) + +ef <- ef_ldv_speed(v = "LCV", + t = "4S", + cc = "<3.5", + f = "G", + p = "FC", + eu = c("I", "II"), + speed = Speed(10)) } # } diff --git a/docs/reference/ef_local.html b/docs/reference/ef_local.html index 158a12df..03ad760d 100644 --- a/docs/reference/ef_local.html +++ b/docs/reference/ef_local.html @@ -25,7 +25,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/ef_nitro.html b/docs/reference/ef_nitro.html index 996624ec..44c471c2 100755 --- a/docs/reference/ef_nitro.html +++ b/docs/reference/ef_nitro.html @@ -26,7 +26,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/ef_wear.html b/docs/reference/ef_wear.html index 2ac3e4d2..c1869543 100755 --- a/docs/reference/ef_wear.html +++ b/docs/reference/ef_wear.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/ef_whe.html b/docs/reference/ef_whe.html index d951e14b..59e622c1 100644 --- a/docs/reference/ef_whe.html +++ b/docs/reference/ef_whe.html @@ -28,7 +28,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/emis.html b/docs/reference/emis.html index 74e4ea9c..de13d12b 100755 --- a/docs/reference/emis.html +++ b/docs/reference/emis.html @@ -25,7 +25,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/emis_chem.html b/docs/reference/emis_chem.html index aec89cbe..52ed1eda 100644 --- a/docs/reference/emis_chem.html +++ b/docs/reference/emis_chem.html @@ -25,7 +25,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/emis_chem2.html b/docs/reference/emis_chem2.html index f888cd77..6be17f31 100644 --- a/docs/reference/emis_chem2.html +++ b/docs/reference/emis_chem2.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/emis_china.html b/docs/reference/emis_china.html index ff3e5367..5a0ffeac 100644 --- a/docs/reference/emis_china.html +++ b/docs/reference/emis_china.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/emis_cold.html b/docs/reference/emis_cold.html index aeb18f07..29a42f2d 100755 --- a/docs/reference/emis_cold.html +++ b/docs/reference/emis_cold.html @@ -26,7 +26,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/emis_cold_td.html b/docs/reference/emis_cold_td.html index 065af260..315b934b 100644 --- a/docs/reference/emis_cold_td.html +++ b/docs/reference/emis_cold_td.html @@ -30,7 +30,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/emis_det.html b/docs/reference/emis_det.html index 0b5526b6..89f2aedc 100755 --- a/docs/reference/emis_det.html +++ b/docs/reference/emis_det.html @@ -27,7 +27,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/emis_dist.html b/docs/reference/emis_dist.html index d2c7c467..3f9eaa18 100644 --- a/docs/reference/emis_dist.html +++ b/docs/reference/emis_dist.html @@ -26,7 +26,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/emis_emfac.html b/docs/reference/emis_emfac.html index f8371ac4..d516654c 100644 --- a/docs/reference/emis_emfac.html +++ b/docs/reference/emis_emfac.html @@ -25,7 +25,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/emis_evap.html b/docs/reference/emis_evap.html index c06ac49f..9c9abc05 100755 --- a/docs/reference/emis_evap.html +++ b/docs/reference/emis_evap.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/emis_evap2.html b/docs/reference/emis_evap2.html index 4dd6389d..4f1a22eb 100644 --- a/docs/reference/emis_evap2.html +++ b/docs/reference/emis_evap2.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/emis_grid.html b/docs/reference/emis_grid.html index aceeb388..f47b0a34 100755 --- a/docs/reference/emis_grid.html +++ b/docs/reference/emis_grid.html @@ -28,7 +28,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/emis_hot_td.html b/docs/reference/emis_hot_td.html index 77f0fb3d..26b4ec13 100644 --- a/docs/reference/emis_hot_td.html +++ b/docs/reference/emis_hot_td.html @@ -30,7 +30,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/emis_long.html b/docs/reference/emis_long.html index 4c78f560..7ca266dd 100644 --- a/docs/reference/emis_long.html +++ b/docs/reference/emis_long.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/emis_merge.html b/docs/reference/emis_merge.html index 2398d023..084428ab 100644 --- a/docs/reference/emis_merge.html +++ b/docs/reference/emis_merge.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/emis_order.html b/docs/reference/emis_order.html index 40f7706e..519b484f 100644 --- a/docs/reference/emis_order.html +++ b/docs/reference/emis_order.html @@ -29,7 +29,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/emis_paved.html b/docs/reference/emis_paved.html index 4949e8c1..a4feead7 100755 --- a/docs/reference/emis_paved.html +++ b/docs/reference/emis_paved.html @@ -27,7 +27,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/emis_post.html b/docs/reference/emis_post.html index 9863d3b3..c7488197 100755 --- a/docs/reference/emis_post.html +++ b/docs/reference/emis_post.html @@ -26,7 +26,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/emis_to_streets.html b/docs/reference/emis_to_streets.html index 91f3708b..5fb6f5e3 100644 --- a/docs/reference/emis_to_streets.html +++ b/docs/reference/emis_to_streets.html @@ -26,7 +26,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/emis_wear.html b/docs/reference/emis_wear.html index 3ff8e83c..8f345ea4 100755 --- a/docs/reference/emis_wear.html +++ b/docs/reference/emis_wear.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/fe2015.html b/docs/reference/fe2015.html index c55564a6..b8c38a74 100755 --- a/docs/reference/fe2015.html +++ b/docs/reference/fe2015.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/fkm.html b/docs/reference/fkm.html index 9856f74e..3f386904 100755 --- a/docs/reference/fkm.html +++ b/docs/reference/fkm.html @@ -26,7 +26,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/fuel_corr.html b/docs/reference/fuel_corr.html index 08b034a4..e532ac2f 100644 --- a/docs/reference/fuel_corr.html +++ b/docs/reference/fuel_corr.html @@ -25,7 +25,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/get_ef_ref.html b/docs/reference/get_ef_ref.html index 994e8792..57b0a0f2 100644 --- a/docs/reference/get_ef_ref.html +++ b/docs/reference/get_ef_ref.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/get_project.html b/docs/reference/get_project.html index fb991a07..135eb049 100644 --- a/docs/reference/get_project.html +++ b/docs/reference/get_project.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/grid_emis.html b/docs/reference/grid_emis.html index 3bcebc2f..cf4622bf 100644 --- a/docs/reference/grid_emis.html +++ b/docs/reference/grid_emis.html @@ -26,7 +26,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/index.html b/docs/reference/index.html index 5e2cee45..020ed4a7 100755 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/invcop.html b/docs/reference/invcop.html index efce2c98..fc4512eb 100644 --- a/docs/reference/invcop.html +++ b/docs/reference/invcop.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/inventory.html b/docs/reference/inventory.html index 6887d97c..b01e0819 100644 --- a/docs/reference/inventory.html +++ b/docs/reference/inventory.html @@ -25,7 +25,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/long_to_wide.html b/docs/reference/long_to_wide.html index 0d0500c5..5dbd9c24 100644 --- a/docs/reference/long_to_wide.html +++ b/docs/reference/long_to_wide.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/make_grid.html b/docs/reference/make_grid.html index 8a352299..6573d389 100755 --- a/docs/reference/make_grid.html +++ b/docs/reference/make_grid.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/moves_ef.html b/docs/reference/moves_ef.html index 51b43265..fe1f4353 100644 --- a/docs/reference/moves_ef.html +++ b/docs/reference/moves_ef.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/moves_rpd.html b/docs/reference/moves_rpd.html index 5585503f..924047df 100644 --- a/docs/reference/moves_rpd.html +++ b/docs/reference/moves_rpd.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/moves_rpdy.html b/docs/reference/moves_rpdy.html index 92a699aa..30dd826f 100644 --- a/docs/reference/moves_rpdy.html +++ b/docs/reference/moves_rpdy.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/moves_rpdy_meta.html b/docs/reference/moves_rpdy_meta.html index 5bfa9bb6..74ee2aef 100644 --- a/docs/reference/moves_rpdy_meta.html +++ b/docs/reference/moves_rpdy_meta.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/moves_rpdy_sf.html b/docs/reference/moves_rpdy_sf.html index 5c5e3bc0..6684cd96 100644 --- a/docs/reference/moves_rpdy_sf.html +++ b/docs/reference/moves_rpdy_sf.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/moves_rpsy_meta.html b/docs/reference/moves_rpsy_meta.html index 72285b44..1da6b7a8 100644 --- a/docs/reference/moves_rpsy_meta.html +++ b/docs/reference/moves_rpsy_meta.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/moves_rpsy_sf.html b/docs/reference/moves_rpsy_sf.html index 6f686974..467de456 100644 --- a/docs/reference/moves_rpsy_sf.html +++ b/docs/reference/moves_rpsy_sf.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/moves_speed.html b/docs/reference/moves_speed.html index 1d3ea37e..3d8d5dee 100644 --- a/docs/reference/moves_speed.html +++ b/docs/reference/moves_speed.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/my_age.html b/docs/reference/my_age.html index ccf27003..2c00d974 100755 --- a/docs/reference/my_age.html +++ b/docs/reference/my_age.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/net.html b/docs/reference/net.html index 7e394243..a59551a9 100755 --- a/docs/reference/net.html +++ b/docs/reference/net.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/netspeed-1.png b/docs/reference/netspeed-1.png index 1d0a2daf..99b30ed5 100644 Binary files a/docs/reference/netspeed-1.png and b/docs/reference/netspeed-1.png differ diff --git a/docs/reference/netspeed.html b/docs/reference/netspeed.html index 025cdd15..4fffe462 100755 --- a/docs/reference/netspeed.html +++ b/docs/reference/netspeed.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/pc_cold.html b/docs/reference/pc_cold.html index 5523bc49..7658d6f1 100755 --- a/docs/reference/pc_cold.html +++ b/docs/reference/pc_cold.html @@ -26,7 +26,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/pc_profile.html b/docs/reference/pc_profile.html index 2ff502e0..4186c485 100755 --- a/docs/reference/pc_profile.html +++ b/docs/reference/pc_profile.html @@ -26,7 +26,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/pollutants.html b/docs/reference/pollutants.html index ebea0680..1603257c 100644 --- a/docs/reference/pollutants.html +++ b/docs/reference/pollutants.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/profiles.html b/docs/reference/profiles.html index 4346192a..e3f9066b 100644 --- a/docs/reference/profiles.html +++ b/docs/reference/profiles.html @@ -27,7 +27,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/remove_units.html b/docs/reference/remove_units.html index 6b2b06c5..5649eb00 100644 --- a/docs/reference/remove_units.html +++ b/docs/reference/remove_units.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/speciate.html b/docs/reference/speciate.html index 0fa0d53e..9997fe08 100755 --- a/docs/reference/speciate.html +++ b/docs/reference/speciate.html @@ -25,7 +25,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/split_emis.html b/docs/reference/split_emis.html index c510ec48..480b6634 100644 --- a/docs/reference/split_emis.html +++ b/docs/reference/split_emis.html @@ -23,7 +23,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/temp_fact.html b/docs/reference/temp_fact.html index 2a8cdd1e..1fd308d3 100755 --- a/docs/reference/temp_fact.html +++ b/docs/reference/temp_fact.html @@ -25,7 +25,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/temp_veh.html b/docs/reference/temp_veh.html index 35795b4b..ec8ea281 100644 --- a/docs/reference/temp_veh.html +++ b/docs/reference/temp_veh.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/to_latex.html b/docs/reference/to_latex.html index 35b526d0..39dad40c 100644 --- a/docs/reference/to_latex.html +++ b/docs/reference/to_latex.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/vein-deprecated.html b/docs/reference/vein-deprecated.html index e7a477bc..4d68084d 100644 --- a/docs/reference/vein-deprecated.html +++ b/docs/reference/vein-deprecated.html @@ -26,7 +26,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/vein-package.html b/docs/reference/vein-package.html index 01075f67..9dc93c52 100644 --- a/docs/reference/vein-package.html +++ b/docs/reference/vein-package.html @@ -25,7 +25,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/vein_notes.html b/docs/reference/vein_notes.html index e973cb5b..7584eba8 100644 --- a/docs/reference/vein_notes.html +++ b/docs/reference/vein_notes.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/vkm.html b/docs/reference/vkm.html index e865d2c8..486490d4 100755 --- a/docs/reference/vkm.html +++ b/docs/reference/vkm.html @@ -25,7 +25,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/docs/reference/wide_to_long.html b/docs/reference/wide_to_long.html index bcd551cc..ec7250c5 100644 --- a/docs/reference/wide_to_long.html +++ b/docs/reference/wide_to_long.html @@ -24,7 +24,7 @@ vein - 1.1.3 + 1.1.4 diff --git a/man/ef_ldv_speed.Rd b/man/ef_ldv_speed.Rd index 2d0e353f..334a1a15 100644 --- a/man/ef_ldv_speed.Rd +++ b/man/ef_ldv_speed.Rd @@ -212,6 +212,14 @@ 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) + +ef <- ef_ldv_speed(v = "LCV", + t = "4S", + cc = "<3.5", + f = "G", + p = "FC", + eu = c("I", "II"), + speed = Speed(10)) } } \seealso{ diff --git a/projects/argentina/config/inventory.xlsx b/projects/argentina/config/inventory.xlsx index 2f77f270..8eae59eb 100755 Binary files a/projects/argentina/config/inventory.xlsx and b/projects/argentina/config/inventory.xlsx differ diff --git a/projects/argentina/config/r/02_fuel.R b/projects/argentina/config/r/02_fuel.R index 8c64a88c..c12e5280 100644 --- a/projects/argentina/config/r/02_fuel.R +++ b/projects/argentina/config/r/02_fuel.R @@ -1,54 +1,38 @@ library(data.table) library(ggplot2) library(units) -library(forecast) x <- readxl::read_excel("config/inventory.xlsx", - "fuel_all") + "fuel") setDT(x) x -x$ESTADO <- toupper(iconv(x$ESTADO, to = "ASCII//TRANSLIT")) +x$region <- toupper(iconv(x$region, to = "ASCII//TRANSLIT")) fn <- readxl::read_excel("config/inventory.xlsx", "geocode") -fn$ESTADO <- toupper(iconv(fn$ESTADO, to = "ASCII//TRANSLIT")) -unique(intersect(unique(x$ESTADO), - fn$ESTADO)) +fn$region <- toupper(iconv(fn$Provincia, to = "ASCII//TRANSLIT")) + +unique(intersect(unique(x$region), + fn$region)) x <- merge(x, - fn[, c("ESTADO", "UF"), + fn[, c("region", "UF"), with = F], all.x = TRUE) x -x$Year <- x$ANO -x <- x[Year < 2023] -x$m <- rep(1:12, nrow(x)/12) - -setorderv(x, - cols = c("ESTADO", "Year", "m"), - order = c(1, -1, 1)) - - -x$m3 <- units::set_units(x$m3, m^3) -x[, d := ifelse( - fuel == "E", 0.809, - ifelse( - fuel == "D", 0.84, - 0.75425))] -x$d <- units::set_units(x$d, "t/m^3") -x$consumption_t <- x$m3*x$d +x$date <- ISOdate(x$Year, x$Month, 1, 0,0,0) +x$consumption_t <- x$density_tm3*x$FUEL_M3 -x$date <- ISOdate(x$Year, x$m, 1, 0,0,0) - +x$m3 <- x$FUEL_M3 ggplot(x, aes(x = date, @@ -68,83 +52,17 @@ dev.off() setorderv(x, "date", order = -1) -names(x)[6] <- "region" saveRDS(x, "config/rds/fuel_month.rds") writexl::write_xlsx(x, "config/xlsx/fuel_month.xlsx") xy <- x[, lapply(.SD, sum), - .SDcols = c("consumption_t", - "m3"), - by = .(fuel, region, Year)] + .SDcols = c("consumption_t", + "m3"), + by = .(fuel, region, Year)] setorderv(xy, "Year", order = -1) - -# all ratios gives 0.9 -fs <- c("E", "D", "G") - -rbindlist(lapply(1:3,function(j){ - rbindlist(lapply(1:40,function(i){ - l <- xy[fuel == fs[j], - consumption_t[.N]*0.9^i, - by = region] - l$Year <- 2000 - i - names(l)[2] <- "consumption_t" - l$fuel <- fs[j] - l$type <- "data" - l - } )) -} )) -> fuel_past - -fuel_past$consumption_t <- as.numeric(fuel_past$consumption_t) - - -fd <- function(x) { - as.numeric( - vein::ef_fun(ef = x, - x = 1:(length(x) + 78), - x0 = 10, - k = 0.15, - L = max(x)*0.95, - verbose = FALSE)) -} - -ufs <- unique(xy$region) - - -rbindlist(lapply(1:3,function(j){ - rbindlist(lapply(seq_along(ufs),function(i){ - - d <- as.numeric(rev(xy[fuel == fs[j] & - region == ufs[i]]$consumption_t)) - - df1 <- data.table( - Year = 2000:2022, - consumption_t = d, - region = ufs[i], - fuel = fs[j], - type = "data" - ) - - df2 <- data.table( - Year = 2000:2100, - consumption_t = fd(d), - region = ufs[i], - fuel = fs[j], - type = "projection" - ) - - rbind(df1, df2) - } )) -} )) -> fuel_future - - -df <- rbind(fuel_past, - fuel_future[type == "data"], - fuel_future[type == "projection" & - Year > 2022]) - setorderv(df, c("region", "Year", diff --git a/projects/argentina/config/r/04_met.R b/projects/argentina/config/r/04_met.R index f1b2b2e0..727c6a69 100644 --- a/projects/argentina/config/r/04_met.R +++ b/projects/argentina/config/r/04_met.R @@ -3,29 +3,35 @@ x <- readxl::read_excel("config/inventory.xlsx", "met") setDT(x) -x$date <- ISOdate(x$Year, x$Month, 1, 0,0,0) +x$Month <- month(x$date) + + x[, mean(Temperature), - by = .(region, capitals, date, scenario, Year, Month)] -> mett + by = .(region, capitals, date, Year, Month)] -> mett names(mett)[ncol(mett)] <- "Temperature" unique(mett$scenario) -mett[Year %in% 2020:2022 & - scenario == "historic"]$scenario <- "SSP 1.9" - -mett[Year %in% 2020:2022, unique(scenario)] - - -mett[is.na(Temperature), unique(Year)] -met1 <- mett[Year %in% 1960:2020] -met2 <- mett[Year == 2022] -met2$Year <- 2021 -met3 <- mett[Year %in% 2022:2100] -met <- rbind(met1, met2, met3) - -met[is.na(Temperature), unique(Year)] - -saveRDS(met, "config/rds/met.rds") +saveRDS(mett, "config/rds/met.rds") writexl::write_xlsx(met, "config/xlsx/met.xlsx") + +# rain #### +x <- readxl::read_excel("config/inventory.xlsx", + "rain") +setDT(x) +x$date <- as.Date(paste0(x$Fecha, "-01")) +x +x$Month <- month(x$date) +x$month <- month(x$date) + +nd <- unlist(lapply(1:nrow(x), function(i) { +vein::dmonth(year = year(x$date[i]), month = month(x$date[i])) +})) + +x$P <- x$numDias +x$N <- nd +x$PN <- x$P/x$N +saveRDS(x, "config/rds/rain.rds") +saveRDS(x, "estimation/2019/config/rain.rds") diff --git a/projects/argentina/config/rds/fuel.rds b/projects/argentina/config/rds/fuel.rds index 564035d5..bfb385ef 100644 Binary files a/projects/argentina/config/rds/fuel.rds and b/projects/argentina/config/rds/fuel.rds differ diff --git a/projects/argentina/config/rds/fuel_month.rds b/projects/argentina/config/rds/fuel_month.rds index 17f059ca..c0734b8d 100644 Binary files a/projects/argentina/config/rds/fuel_month.rds and b/projects/argentina/config/rds/fuel_month.rds differ diff --git a/projects/argentina/config/rds/met.rds b/projects/argentina/config/rds/met.rds index c687c24c..ff93b340 100644 Binary files a/projects/argentina/config/rds/met.rds and b/projects/argentina/config/rds/met.rds differ diff --git a/projects/argentina/config/rds/rain.rds b/projects/argentina/config/rds/rain.rds new file mode 100644 index 00000000..1d733bdb Binary files /dev/null and b/projects/argentina/config/rds/rain.rds differ diff --git a/projects/argentina/config/xlsx/fuel.xlsx b/projects/argentina/config/xlsx/fuel.xlsx index 63fcf934..0691964a 100644 Binary files a/projects/argentina/config/xlsx/fuel.xlsx and b/projects/argentina/config/xlsx/fuel.xlsx differ diff --git a/projects/argentina/config/xlsx/fuel_month.xlsx b/projects/argentina/config/xlsx/fuel_month.xlsx index 13e8545e..e0d8e575 100644 Binary files a/projects/argentina/config/xlsx/fuel_month.xlsx and b/projects/argentina/config/xlsx/fuel_month.xlsx differ diff --git a/projects/argentina/estimation/2019.tar.gz b/projects/argentina/estimation/2019.tar.gz index 468d25fe..239a8dc1 100644 Binary files a/projects/argentina/estimation/2019.tar.gz and b/projects/argentina/estimation/2019.tar.gz differ diff --git a/projects/argentina/estimation/2019/2019.Rproj b/projects/argentina/estimation/2019/2019.Rproj new file mode 100644 index 00000000..d64e28bb --- /dev/null +++ b/projects/argentina/estimation/2019/2019.Rproj @@ -0,0 +1,16 @@ +Version: 1.0 + +RestoreWorkspace: Default +SaveWorkspace: Default +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: knitr +LaTeX: pdfLaTeX + +AutoAppendNewline: Yes +StripTrailingWhitespace: Yes diff --git a/projects/argentina/estimation/2019/config/config.R b/projects/argentina/estimation/2019/config/config.R index d1cbd99c..f3fcf90d 100644 --- a/projects/argentina/estimation/2019/config/config.R +++ b/projects/argentina/estimation/2019/config/config.R @@ -22,17 +22,21 @@ setDT(veh) setDT(fuel_month) +# necesita columnas Year, Month, FUEL_M3 *density_tm3 fuel_month[, date := ISOdate(Year, Month, 1, 0,0,0)] - fuel_month[, consumption_t := FUEL_M3 *density_tm3] +# manual fuel_month[, type := "data"] pmonth <- fuel_month fuel_month[, sum(consumption_t), - by = .(region, Year = year(date), fuel, type) + by = .(region, + Year, + fuel, + type) ] -> fuel names(fuel)[ncol(fuel)] <- "consumption_t" @@ -55,13 +59,13 @@ setDT(im_pm) met$region <- toupper(met$region) pmonth$region <- toupper(pmonth$region) +rain$region <- toupper(rain$region) # pmonth #### -setDT(pmonth) switch (language, - "portuguese" = cat( "Filtrando pmonth: ", year_select, "\n"), - "english" = cat( "Filtering pmonth: ", year_select, "\n"), - "spanish" = cat( "Filtrando pmonth: ", year_select, "\n")) + "portuguese" = cat( "Filtrando fuel_month: ", year_select, "\n"), + "english" = cat( "Filtering fuel_month: ", year_select, "\n"), + "spanish" = cat( "Filtrando fuel_month: ", year_select, "\n")) pmonth <- pmonth[Year == year_select] @@ -76,6 +80,8 @@ switch (language, met <- met[Year == year_select] +rain <- rain[year(date) == year_select] + # fuel #### switch (language, "portuguese" = cat( "Filtrando fuel: ", year_select, "\n"), @@ -94,6 +100,7 @@ saveRDS(veh, "config/fleet_age.rds") saveRDS(fuel, "config/fuel.rds") saveRDS(fuel_spec, "config/fuel_spec.rds") saveRDS(met, "config/met.rds") +saveRDS(rain, "config/rain.rds") saveRDS(pmonth, "config/pmonth.rds") saveRDS(euro, "config/euro.rds") saveRDS(tech, "config/tech.rds") @@ -191,6 +198,7 @@ p <- ggplot(pmonth, facet_wrap(~ region) + theme_bw(base_size = 16) + theme(panel.spacing = unit(0,'lines')) +p png("images/FUEL.png", width = 3000, @@ -276,7 +284,6 @@ for(i in seq_along(n_veh)) { # Plot Mileage #### - switch (language, "portuguese" = cat("Plotando quilometragem \n"), "english" = cat("Plot mileage `tfs`\n"), @@ -362,7 +369,6 @@ aes(x = Year, geom_tile() + theme_bw(base_size = 14) -> p - png(paste0("images/standard.png"), width = 3000, height = 2500, @@ -375,17 +381,16 @@ dev.off() # Plot Temperature #### units(celsius(1))$numerator -for(i in 1){ ggplot(met, aes(x = date, - y = Temperature, - colour = scenario)) + + y = Temperature)) + geom_line() + labs(title = year_select) + facet_wrap(~ region) + theme_bw(base_size = 16) -> p - + + png("images/Temperature.png", width = 2000, height = 1500, @@ -393,7 +398,27 @@ for(i in 1){ res = 300) print(p) dev.off() -} + + +# Plot Rain #### + + ggplot(rain, + aes(x = date, + y = PN)) + + geom_line() + + labs(title = year_select) + + facet_wrap(~ region) + + theme_bw(base_size = 16) -> p + + + png("images/Rain.png", + width = 2000, + height = 1500, + "px", + res = 300) + print(p) + dev.off() + # # Plot month ##### # pmonth <- as.data.frame(pmonth) @@ -426,14 +451,14 @@ switch (language, vein_notes(notes = c("Default notes for vein::get_project"), file = "notes/README", - title = paste0("Brazil by state ", year_select), + title = paste0("Argentina by state ", year_select), approach = 'Top-Down', - traffic = "DENATRAN", - composition = "CETESB", - ef = paste0("CETESB ", scale), - cold_start = "Not Applicable", + traffic = "DNRBA", + composition = "DNRBA", + ef = "COPERT", + cold_start = "COPERT", evaporative = "Running Losses, Diurnal and Hot Soak", - standards = "PROCONVE, PROMOT", + standards = "EURO", mileage = "Bruni and Bales 2013") # saveRDS diff --git a/projects/argentina/estimation/2019/notes/README_2024-07-23_222150.124075.txt b/projects/argentina/estimation/2019/notes/README_2024-07-23_222150.124075.txt deleted file mode 100644 index deeadff8..00000000 --- a/projects/argentina/estimation/2019/notes/README_2024-07-23_222150.124075.txt +++ /dev/null @@ -1,95 +0,0 @@ -======================================== -Brazil by state 2019 -======================================== - -Directory: /media/sergio/ext4/models/vein/projects/argentina/estimation/2019 - -Local Time: 2024-07-23 22:21:50.124448 -Inventory compiler: sergio -======================================== - -sysname = Linux -release = 6.8.0-38-generic -version = #38-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 7 15:25:01 UTC 2024 -nodename = sergio-gl639sd -machine = x86_64 -user = sergio -R version = 4.3.3 -nickname = Angel Food Cake -Memory used = 1568Mb -======================================== - -VEIN version = 1.1.3 -======================================== - -Traffic: -DENATRAN - -Approach: -Top-Down - -Vehicular composition: -CETESB - -Emission Factors: -CETESB none - -Cold starts: -Not Applicable - -Evaporative: -Running Losses, Diurnal and Hot Soak - -Traffic standards: -PROCONVE, PROMOT - -Traffic mileage: -Bruni and Bales 2013 - -Notes: -Default notes for vein::get_project -======================================== - -Session Info: -R version 4.3.3 (2024-02-29) -Platform: x86_64-pc-linux-gnu (64-bit) -Running under: Ubuntu 24.04 LTS - -Matrix products: default -BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.12.0 -LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0 - -locale: - [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 - [4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 - [7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C -[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C - -time zone: America/Denver -tzcode source: system (glibc) - -attached base packages: -[1] stats graphics grDevices utils datasets methods base - -other attached packages: -[1] eixport_0.6.0 stars_0.6-4 abind_1.4-5 units_0.8-5 data.table_1.15.4 -[6] ggplot2_3.5.1 cptcity_1.0.6 sf_1.0-16 vein_1.1.3 - -loaded via a namespace (and not attached): - [1] utf8_1.2.4 generics_0.1.3 class_7.3-22 KernSmooth_2.23-22 - [5] lattice_0.22-5 magrittr_2.0.3 grid_4.3.3 cellranger_1.1.0 - [9] e1071_1.7-14 DBI_1.2.3 fansi_1.0.6 scales_1.3.0 -[13] codetools_0.2-19 cli_3.6.3 rlang_1.1.4 crayon_1.5.2 -[17] munsell_0.5.0 withr_3.0.0 tools_4.3.3 raster_3.6-26 -[21] parallel_4.3.3 dplyr_1.1.4 colorspace_2.1-0 ncdf4_1.22 -[25] vctrs_0.6.5 R6_2.5.1 proxy_0.4-27 lifecycle_1.0.4 -[29] classInt_0.4-10 pkgconfig_2.0.3 terra_1.7-78 pillar_1.9.0 -[33] gtable_0.3.4 glue_1.7.0 Rcpp_1.0.12 tibble_3.2.1 -[37] tidyselect_1.2.0 farver_2.1.1 labeling_0.4.3 dotCall64_1.1-1 -[41] compiler_4.3.3 readxl_1.4.3 sp_2.1-3 - -======================================== - - - -Thanks for using VEIN diff --git a/projects/argentina/estimation/2019/notes/README_2024-08-19_221200.049097.txt b/projects/argentina/estimation/2019/notes/README_2024-08-19_221200.049097.txt new file mode 100644 index 00000000..e0f06821 --- /dev/null +++ b/projects/argentina/estimation/2019/notes/README_2024-08-19_221200.049097.txt @@ -0,0 +1,86 @@ +======================================== +Argentina by state 2019 +======================================== + +Directory: /media/sergio/ext4/models/vein/projects/argentina/estimation/2019 + +Local Time: 2024-08-19 22:12:00.049551 +Inventory compiler: sergio +======================================== + +sysname = Linux +release = 6.8.0-40-generic +version = #40-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 5 10:34:03 UTC 2024 +nodename = sergio-gl639sd +machine = x86_64 +user = sergio +R version = 4.4.1 +nickname = Race for Your Life +Memory used = 1520Mb +======================================== + +VEIN version = 1.1.3 +======================================== + +Traffic: +DNRBA + +Approach: +Top-Down + +Vehicular composition: +DNRBA + +Emission Factors: +COPERT + +Cold starts: +COPERT + +Evaporative: +Running Losses, Diurnal and Hot Soak + +Traffic standards: +EURO + +Traffic mileage: +Bruni and Bales 2013 + +Notes: +Default notes for vein::get_project +======================================== + +Session Info: +R version 4.4.1 (2024-06-14) +Platform: x86_64-pc-linux-gnu +Running under: Ubuntu 24.04 LTS + +Matrix products: default +BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.12.0 +LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0 + +locale: + [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 + [8] LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C + +time zone: America/Denver +tzcode source: system (glibc) + +attached base packages: +[1] stats graphics grDevices utils datasets methods base + +other attached packages: +[1] stars_0.6-6 abind_1.4-5 eixport_0.6.0 units_0.8-5 data.table_1.15.4 ggplot2_3.5.1 cptcity_1.0.6 sf_1.0-16 vein_1.1.3 + +loaded via a namespace (and not attached): + [1] utf8_1.2.4 class_7.3-22 KernSmooth_2.23-24 lattice_0.22-5 magrittr_2.0.3 grid_4.4.1 cellranger_1.1.0 processx_3.8.4 pkgbuild_1.4.4 e1071_1.7-14 +[11] DBI_1.2.3 ps_1.7.7 fansi_1.0.6 scales_1.3.0 codetools_0.2-20 cli_3.6.3 rlang_1.1.4 munsell_0.5.1 remotes_2.5.0 withr_3.0.0 +[21] tools_4.4.1 raster_3.6-26 parallel_4.4.1 colorspace_2.1-1 ncdf4_1.23 curl_5.2.1 vctrs_0.6.5 R6_2.5.1 proxy_0.4-27 lifecycle_1.0.4 +[31] classInt_0.4-10 pkgconfig_2.0.3 desc_1.4.3 callr_3.7.6 terra_1.7-78 pillar_1.9.0 gtable_0.3.5 glue_1.7.0 Rcpp_1.0.13 tibble_3.2.1 +[41] farver_2.1.2 labeling_0.4.3 dotCall64_1.1-1 compiler_4.4.1 readxl_1.4.3 sp_2.1-4 + +======================================== + + + +Thanks for using VEIN diff --git a/projects/argentina/estimation/2019/scripts/fuel_eval_br.R b/projects/argentina/estimation/2019/scripts/fuel_eval_br.R new file mode 100755 index 00000000..fe44bab8 --- /dev/null +++ b/projects/argentina/estimation/2019/scripts/fuel_eval_br.R @@ -0,0 +1,222 @@ + +year <- as.numeric(substr(x = getwd(), + start = nchar(getwd()) - 3, + stop = nchar(getwd()) )) + +year_selected <- year + +suppressWarnings(file.remove("emi/FC_INITIAL.csv")) + +reg <- unique(pmonth$region) + +# Exhaust #### +for(k in seq_along(reg)) { + + cat(reg[k], " ") + + + for(i in seq_along(metadata$vehicles)) { + + # cat("\n", metadata$vehicles[i], + # rep("", max(nchar(metadata$vehicles) + 1) - nchar(metadata$vehicles[i]))) + + + x <- readRDS(paste0("veh/", metadata$vehicles[i], ".rds")) + + x[is.na(x)] <- 0 + + x <- x[region == reg[k], ] + + x$region <- NULL + + setDF(x) + + dm <- pmonth[region == reg[k] & + fuel == metadata$fuel[i]]$consumption_t + + for(j in seq_along(pol)){ + + # cat(pol[j]) + + + ef <- ef_cetesb(p = pol[j], + veh = metadata$vehicles[i], + year = year_selected, + agemax = ncol(x), + verbose = verbose) + + array_x <- emis_hot_td( + veh = x, + lkm = mileage[[metadata$vehicles[i]]][1:metadata$maxage[i]], + ef = ef, + fortran = TRUE, + pro_month = dm, + verbose = verbose, + params = list(veh = metadata$vehicles[i], + size = metadata$size[i], + fuel = metadata$fuel[i], + pollutant = pol[j], + type_emi = "Exhaust", + subtype_emi = "Exhaust", + baseyear = year_selected)) + + array_x$region <- reg[k] + + fwrite(array_x, "emi/FC_INITIAL.csv", append = TRUE) + } + } +} + +cat("\n") + +switch (language, + "portuguese" = message("\nArquivos em:"), + "english" = message("\nFiles in:"), + "spanish" = message("\nArchivos en:")) + +cat(paste0(getwd(), "/emi/*\n")) + + + +# data.table #### +dt <- fread("emi/FC_INITIAL.csv") + +dt$pollutant <- as.character(dt$pollutant) +dt$g <- units::set_units(dt$emissions, "g") +dt$t <- units::set_units(dt$g, t) + +dt0 <- dt[pollutant == "FC", + round(sum(t, na.rm = T), 2), + by = .(fuel, + region)] + +# data.table::setkey(dt0, c("fuel", "region")) + +names(dt0)[3] <- "estimation_t" +dtf <- merge(dt0, fuel, by = c("fuel", "region")) +dtf$estimation_consumption <- dtf$estimation_t/dtf$consumption_t +print(dtf[, c("region", + "fuel", + "estimation_t", + "consumption_t", + "estimation_consumption")]) + +dtf$kfinal <- as.numeric(1/dtf$estimation_consumption) + +dtf$kfinal[is.na(dtf$kfinal)] <- 1 + +dtf$kfinal[is.infinite(dtf$kfinal)] <- 1 +fwrite(dtf, "config/kfuel.csv") + +# 2) Traffic #### +language <- "english" # spanish portuguese +metadata <- readRDS("config/metadata.rds") +categories <- c("pc", "lcv", "trucks", "bus", "mc") # in network/net.gpkg +veh <- readRDS("config/fleet_age.rds") +verbose <- FALSE +theme <- "black" # dark clean ink +survival <- TRUE +fuel <- dtf +source("scripts/trafficfuel.R", + encoding = "UTF-8", + echo = TRUE) + +# Re estimating FC #### +suppressWarnings(file.remove("emi/FC_ADJUSTED.csv")) + +switch (language, + "portuguese" = message("\nEstimando consumo de combustivel:"), + "english" = message("\nEstimating fuel consumption"), + "spanish" = message("\nEstimando consumo de combustible")) + + +# Exhaust #### +for(k in seq_along(reg)) { + + cat(reg[k], " ") + + + for(i in seq_along(metadata$vehicles)) { + + # cat("\n", metadata$vehicles[i], + # rep("", max(nchar(metadata$vehicles) + 1) - nchar(metadata$vehicles[i]))) + + + x <- readRDS(paste0("veh/", metadata$vehicles[i], ".rds")) + + x[is.na(x)] <- 0 + x <- x[region == reg[k], ] + + x$region <- NULL + + setDF(x) + + dm <- pmonth[region == reg[k] & + fuel == metadata$fuel[i]]$consumption_t + + for(j in seq_along(pol)){ + + # cat(pol[j]) + + + ef <- ef_cetesb(p = pol[j], + veh = metadata$vehicles[i], + year = year_selected, + agemax = ncol(x), + verbose = verbose) + + array_x <- emis_hot_td( + veh = x, + lkm = mileage[[metadata$vehicles[i]]][1:metadata$maxage[i]], + ef = ef, + fortran = TRUE, + pro_month = dm, + verbose = verbose, + params = list(veh = metadata$vehicles[i], + size = metadata$size[i], + fuel = metadata$fuel[i], + pollutant = pol[j], + type_emi = "Exhaust", + subtype_emi = "Exhaust", + baseyear = year_selected)) + + array_x$region <- reg[k] + + fwrite(array_x, "emi/FC_ADJUSTED.csv", append = TRUE) + } + } +} + +cat("\n") + +# data.table #### +dt <- fread("emi/FC_ADJUSTED.csv") +fuel <- readRDS("config/fuel.rds") + +dt$pollutant <- as.character(dt$pollutant) +dt$g <- units::set_units(dt$emissions, "g") +dt$t <- units::set_units(dt$g, t) + +dt0 <- dt[pollutant == "FC", + round(sum(t), 2), + by = .(fuel, + region)] + +# data.table::setkey(dt0, c("fuel", "region")) + +names(dt0)[3] <- "estimation_t" +dtf <- merge(dt0, fuel, by = c("fuel", "region")) + +dtf$estimation_consumption <- dtf$estimation_t/dtf$consumption_t +print(dtf[, c("region", + "fuel", + "estimation_t", + "consumption_t", + "estimation_consumption")]) + +switch (language, + "portuguese" = message("Limpando..."), + "english" = message("Cleaning..."), + "spanish" = message("Limpiando...")) + + diff --git a/projects/argentina/estimation/2019/scripts/fuel_eval_eea.R b/projects/argentina/estimation/2019/scripts/fuel_eval_eea.R new file mode 100755 index 00000000..5419cd6f --- /dev/null +++ b/projects/argentina/estimation/2019/scripts/fuel_eval_eea.R @@ -0,0 +1,443 @@ + +year <- as.numeric(substr(x = getwd(), + start = nchar(getwd()) - 3, + stop = nchar(getwd()) )) + +year_selected <- year + +suppressWarnings(file.remove("emi/FC_INITIAL.csv")) + +metadata_original <- metadata + +metadata <- metadata[metadata$fuel != "ELEC", ] +# para vehiculos hibridos solo hay euro 4, entonces se asumio para +# esa categoria en inventory.xlsx +# es importante cerar el numero de vehiculos antes que estos entraran +# en circulacion + +setDT(pmonth) + + +reg <- unique(pmonth$region) + +# Exhaust #### +for(k in seq_along(reg)) { + + cat(reg[k], " ") + + + for(i in seq_along(metadata$vehicles)) { + + # cat("\n", metadata$vehicles[i], + # rep("", max(nchar(metadata$vehicles) + 1) - nchar(metadata$vehicles[i]))) + + + x <- readRDS(paste0("veh/", metadata$vehicles[i], ".rds")) + + x[is.na(x)] <- 0 + + x <- x[region == reg[k], ] + + x$region <- NULL + + setDF(x) + + # euro + cate <- suppressWarnings( + as.character(as.roman(gsub("Euro ", "", + euro[[metadata$vehicles[i]]])))) + cate[is.na(cate)] <- "PRE" + + dm <- pmonth[region == reg[k] & + fuel == metadata$fuel[i]]$consumption_t + + for(j in seq_along(pol)){ + + # cat(pol[j]) + + if(metadata$v_eea_old[i] %in% c("PC", "LCV", "Motorcycle")) { + + + ef <- ef_ldv_speed(v = metadata$v_eea_old[i], + t = metadata$t_eea_old[i], + cc = metadata$cc_eea_old[i], + f = metadata$fuel_eea_old[i], + p = "FC", + eu = cate, + speed = Speed(metadata$speed[i])) + + } else { + ef <- ef_hdv_speed(v = metadata$v_eea_old[i], + t = metadata$t_eea_old[i], + g = metadata$cc_eea_old[i], + eu = cate, + gr = 0, + l = 0.5, + p = "FC", + speed = Speed(metadata$speed[i])) + } + + nrow(x) == nrow(ef) + + ef$speed <- NULL + + + + array_x <- emis_hot_td( + veh = x, + lkm = mileage[[metadata$vehicles[i]]][1:metadata$maxage[i]], + ef = ef[1:metadata$maxage[i]], + fortran = TRUE, + pro_month = dm, + verbose = verbose, + params = list(veh = metadata$vehicles[i], + size = metadata$size[i], + fuel = metadata$fuel[i], + pollutant = pol[j], + type_emi = "Exhaust", + subtype_emi = "Exhaust", + baseyear = year_selected)) + + array_x$region <- reg[k] + + fwrite(array_x, "emi/FC_INITIAL.csv", append = TRUE) + } + } +} + + +# Cold Start #### +cat("\n\nCold Exhaust Fuel Consumption ") + +metadata_cold <- metadata[metadata$fuel_eea_old %in% "G" & + metadata$v_eea_old %in% c("PC", "LCV"), ] + +for (i in seq_along(metadata_cold$vehicles)) { + cat( + "\n", metadata_cold$vehicles[i], + rep("", max(nchar(metadata_cold$vehicles) + 1) - nchar(metadata_cold$vehicles[i])) + ) + + x <- readRDS(paste0("veh/", metadata_cold$vehicles[i], ".rds")) + "veh/PC" + # euro + cate <- suppressWarnings( + as.character(as.roman(gsub("Euro ", "", + euro[[metadata_cold$vehicles[i]]])))) + cate[is.na(cate)] <- "PRE" + + for (j in seq_along(pol)) { + cat(pol[j], " ") + + + ltrip <- add_lkm(metadata_cold$km_cycle[i]) + ta <- met$value + a <- cold_mileage(ltrip = ltrip, ta = celsius(ta)) + + (ef <- ef_ldv_speed(v = metadata_cold$v_eea_old[i], + t = metadata_cold$t_eea_old[i], + cc = metadata_cold$cc_eea_old[i], + f = metadata_cold$fuel_eea_old[i], + p = "FC", + eu = cate, + speed = Speed(metadata_cold$speed[i]))) + + (efcold <- ef_ldv_cold(ta = matrix(ta, nrow = 1), + cc = ifelse(metadata_cold$cc_eea_old[i] == "<3.5", + ">2000", + metadata_cold$cc_eea_old[i]), + f = metadata_cold$fuel_eea_old[i], + p = "FC", + eu = cate, + speed = Speed(metadata_cold$speed[i]))) + + nrow(x) == nrow(ef) + ef$speed <- NULL + + array_x <- emis_cold_td( + veh = x, + lkm = mileage[[metadata_cold$vehicles[i]]], + ef = ef[, 1:ncol(x)], + efcold = efcold[, 1:ncol(x)], + fortran = TRUE, + beta = matrix(a, nrow = 1), + nt = nt, + pro_month = pmonth[fuel == ifelse(metadata$vehicles[i] == "D", "D", "G")]$consumption_lt, + verbose = verbose, + params = list( + veh = metadata_cold$vehicles[i], + size = metadata_cold$size[i], + fuel = metadata_cold$fuel[i], + pollutant = pol[j], + type_emi = "Cold", + subtype_emi = "Exhaust", + baseyear = year, + month = rep(1:12, each = ncol(x)) + ) + ) + + + fwrite(array_x, "emi/FC.csv", append = TRUE) + } +} + + +switch(language, + "portuguese" = message("\nArquivos em:"), + "english" = message("\nFiles in:"), + "spanish" = message("\nArchivos en:") +) + +cat(paste0(getwd(), "/emi/*\n")) + +# data.table #### +dt <- fread("emi/FC.csv") + +dt$pollutant <- as.character(dt$pollutant) +dt$g <- units::set_units(dt$emissions, "g") +dt$t <- units::set_units(dt$g, t) + +dt0 <- dt[pollutant == "FC", + round(sum(t), 2), + by = .(fuel) +] +data.table::setkey(dt0, "fuel") + +names(dt0)[2] <- "estimation_t" + +dtf <- merge(dt0, fuel, by = "fuel") + +setorderv(dtf, cols = c("fuel")) + +dtf$density_tm3 <- units::set_units(dtf$density_tm3, "t/m^3") +dtf$consumption_lt <- units::set_units(dtf$consumption_lt, "l") +dtf$consumption_m3 <- units::set_units(dtf$consumption_lt, "m^3") +dtf$consumption_t <- dtf$consumption_m3 * dtf$density_tm3 +dtf$estimation_consumption <- dtf$estimation_t / dtf$consumption_t +print(dtf[, c("fuel", "estimation_t", "consumption_t", "estimation_consumption")]) + +# calibrate k #### +k_D <- as.numeric(1/dtf[fuel == "D"]$estimation_consumption) +k_G <- as.numeric(1/dtf[fuel == "G"]$estimation_consumption) +language <- "spanish" # english spanish portuguese +net <- readRDS("network/net.rds") +metadata <- readRDS("config/metadata.rds") +categories <- c("pc", "lcv", "trucks", "bus", "mc") # in network/net.gpkg +veh <- readRDS("config/fleet_age.rds") +verbose <- FALSE +year <- 2019 +theme <- "black" # dark clean ink + +source("scripts/traffic.R") + +# re estimate fc #### +file.remove("emi/FC.csv") + +metadata_original <- metadata + +metadata <- metadata[metadata$fuel != "ELEC", ] + +# Hot Exhaust #### +cat("\n\nHot Running Fuel Consumption\n ") +for (i in seq_along(metadata$vehicles)) { + cat( + "\n", metadata$vehicles[i], + rep("", max(nchar(metadata$vehicles) + 1) - nchar(metadata$vehicles[i])) + ) + + x <- readRDS(paste0("veh/", metadata$vehicles[i], ".rds")) + + # euro + cate <- suppressWarnings( + as.character(as.roman(gsub("Euro ", "", + euro[[metadata$vehicles[i]]])))) + cate[is.na(cate)] <- "PRE" + + for (j in seq_along(pol)) { + cat(pol[j], " ") + + if(metadata$v_eea_old[i] %in% c("PC", "LCV", "Motorcycle")) { + + ef <- ef_ldv_speed(v = metadata$v_eea_old[i], + t = metadata$t_eea_old[i], + cc = metadata$cc_eea_old[i], + f = metadata$fuel_eea_old[i], + p = "FC", + eu = cate, + speed = Speed(metadata$speed[i])) + + } else { + ef <- ef_hdv_speed(v = metadata$v_eea_old[i], + t = metadata$t_eea_old[i], + g = metadata$cc_eea_old[i], + eu = cate, + gr = 0, + l = 0.5, + p = "FC", + speed = Speed(metadata$speed[i])) + } + + nrow(x) == nrow(ef) + ef$speed <- NULL + + array_x <- emis_hot_td( + veh = x, + lkm = mileage[[metadata$vehicles[i]]], + ef = ef[, 1:ncol(x)], + fortran = TRUE, + nt = nt, + pro_month = pmonth[fuel == ifelse(metadata$vehicles[i] == "D", "D", "G")]$consumption_lt, + verbose = verbose, + params = list( + veh = metadata$vehicles[i], + size = metadata$size[i], + fuel = metadata$fuel[i], + pollutant = pol[j], + type_emi = "Running", + subtype_emi = "Exhaust", + baseyear = year + ) + ) + + fwrite(array_x, "emi/FC.csv", append = TRUE) + } +} + +# Cold Start #### +cat("\n\nCold Exhaust Fuel Consumption ") +metadata_cold <- metadata[metadata$fuel_eea_old %in% "G" & + metadata$v_eea_old %in% c("PC", "LCV"), ] + +for (i in seq_along(metadata_cold$vehicles)) { + cat( + "\n", metadata_cold$vehicles[i], + rep("", max(nchar(metadata_cold$vehicles) + 1) - nchar(metadata_cold$vehicles[i])) + ) + + x <- readRDS(paste0("veh/", metadata_cold$vehicles[i], ".rds")) + "veh/PC" + # euro + cate <- suppressWarnings( + as.character(as.roman(gsub("Euro ", "", + euro[[metadata_cold$vehicles[i]]])))) + cate[is.na(cate)] <- "PRE" + + for (j in seq_along(pol)) { + cat(pol[j], " ") + + + ltrip <- add_lkm(metadata_cold$km_cycle[i]) + ta <- met$value + a <- cold_mileage(ltrip = ltrip, ta = celsius(ta)) + + (ef <- ef_ldv_speed(v = metadata_cold$v_eea_old[i], + t = metadata_cold$t_eea_old[i], + cc = metadata_cold$cc_eea_old[i], + f = metadata_cold$fuel_eea_old[i], + p = "FC", + eu = cate, + speed = Speed(metadata_cold$speed[i]))) + + (efcold <- ef_ldv_cold(ta = matrix(ta, nrow = 1), + cc = ifelse(metadata_cold$cc_eea_old[i] == "<3.5", + ">2000", + metadata_cold$cc_eea_old[i]), + f = metadata_cold$fuel_eea_old[i], + p = "FC", + eu = cate, + speed = Speed(metadata_cold$speed[i]))) + + nrow(x) == nrow(ef) + ef$speed <- NULL + + array_x <- emis_cold_td( + veh = x, + lkm = mileage[[metadata_cold$vehicles[i]]], + ef = ef[, 1:ncol(x)], + efcold = efcold[, 1:ncol(x)], + fortran = TRUE, + beta = matrix(a, nrow = 1), + nt = nt, + pro_month = pmonth[fuel == ifelse(metadata$vehicles[i] == "D", "D", "G")]$consumption_lt, + verbose = verbose, + params = list( + veh = metadata_cold$vehicles[i], + size = metadata_cold$size[i], + fuel = metadata_cold$fuel[i], + pollutant = pol[j], + type_emi = "Cold", + subtype_emi = "Exhaust", + baseyear = year, + month = rep(1:12, each = ncol(x)) + ) + ) + + + fwrite(array_x, "emi/FC.csv", append = TRUE) + } +} + + +switch(language, + "portuguese" = message("\nArquivos em:"), + "english" = message("\nFiles in:"), + "spanish" = message("\nArchivos en:") +) + + +switch(language, + "portuguese" = message("\nArquivos em:"), + "english" = message("\nFiles in:"), + "spanish" = message("\nArchivos en:") +) + +cat(paste0(getwd(), "/emi/*\n")) + +# data.table #### +dt <- fread("emi/FC.csv") + +dt$pollutant <- as.character(dt$pollutant) +dt$g <- units::set_units(dt$emissions, "g") +dt$t <- units::set_units(dt$g, t) + +dt0 <- dt[pollutant == "FC", + round(sum(t), 2), + by = .(fuel) +] +data.table::setkey(dt0, "fuel") + +names(dt0)[2] <- "estimation_t" + +dtf <- merge(dt0, fuel, by = "fuel") + +setorderv(dtf, cols = c("fuel")) + +dtf$density_tm3 <- units::set_units(dtf$density_tm3, "t/m^3") +dtf$consumption_lt <- units::set_units(dtf$consumption_lt, "l") +dtf$consumption_m3 <- units::set_units(dtf$consumption_lt, "m^3") +dtf$consumption_t <- dtf$consumption_m3 * dtf$density_tm3 +dtf$estimation_consumption <- dtf$estimation_t / dtf$consumption_t +print(dtf[, c("fuel", "estimation_t", "consumption_t", "estimation_consumption")]) + +switch(language, + "portuguese" = message("Limpando..."), + "english" = message("Cleaning..."), + "spanish" = message("Limpiando...") +) +# suppressWarnings(rm(i, j, pol, dt, dt0, dtf, factor_emi, fuel)) +# suppressWarnings(rm( +# kPC, kPC_G, kPC_E, kPC_FG, kPC_FE, +# kLCV, kLCV_G, kLCV_E, kLCV_FG, kLCV_FE, kLCV_D, +# kTRUCKS, kTRUCKS_SL_D, kTRUCKS_L_D, kTRUCKS_M_D, kTRUCKS_SH_D, kTRUCKS_H_D, +# kBUS, kBUS_URBAN_D, kBUS_MICRO_D, kBUS_COACH_D, +# kMC, kMC_150_G, kMC_150_500_G, kMC_500_G, +# kMC_150_FG, kMC_150_500_FG, kMC_500_FG, +# kMC_150_FE, kMC_150_500_FE, kMC_500_FE, +# l_PC, l_LCV, l_TRUCKS, l_BUS, l_MC, +# i, arquivos, cores, df, f, ff, +# n_PC, n_LCV, n_TRUCKS, n_BUS, n_MC, +# na, nveh, p, tit, tit2, veiculos, x, kf, +# k_G, k_D, k_E, +# )) +ls() +invisible(gc()) diff --git a/projects/argentina/estimation/2019/scripts/main_01_config.R b/projects/argentina/estimation/2019/scripts/main_01_config.R index 9907c5c9..5508a7b9 100644 --- a/projects/argentina/estimation/2019/scripts/main_01_config.R +++ b/projects/argentina/estimation/2019/scripts/main_01_config.R @@ -7,7 +7,6 @@ library(cptcity) # 7120 colour palettes library(ggplot2) # plots library(data.table) # faster data.frames library(units) -library(stars) library(eixport) sessionInfo() @@ -17,20 +16,23 @@ language <- "english" # spanish portuguese path <- "../../config/inventory.xlsx" readxl::excel_sheets(path) metadata <- readxl::read_xlsx(path = path, sheet = "metadata") +# assuming HY and GLP G in the meantime +metadata$fuel <- gsub("HY", "G", metadata$fuel) +metadata$fuel <- gsub("GLP", "G", metadata$fuel) + mileage <- readRDS("../../config/rds/mileage.rds") tfs <- readxl::read_xlsx(path = path, sheet = "tfs") - veh <- readRDS("../../config/rds/fleet_age.rds") # assuming fuel 2019 -fuel_month <- readxl::read_xlsx(path = path, sheet = "fuel_month") +fuel_month <- readRDS("../../config/rds/fuel_month.rds") # columns used: date, FUEL_M3, density_tm3, type, fuel -fuel_month$Year <- 2019 s <- readxl::read_xlsx(path = path, sheet = "s") fuel_spec <- readxl::read_xlsx(path = path, sheet = "fuel_spec") met <- readRDS("../../config/rds/met.rds") +rain <- readRDS("../../config/rds/rain.rds") euro <- readxl::read_xlsx(path = path, sheet = "euro") tech <- readxl::read_xlsx(path = path, sheet = "tech") diff --git a/projects/argentina/estimation/2019/scripts/main_03_fuel_eval.R b/projects/argentina/estimation/2019/scripts/main_03_fuel_eval.R index 4c926789..0fab7c3f 100644 --- a/projects/argentina/estimation/2019/scripts/main_03_fuel_eval.R +++ b/projects/argentina/estimation/2019/scripts/main_03_fuel_eval.R @@ -7,7 +7,6 @@ library(cptcity) # 7120 colour palettes library(ggplot2) # plots library(data.table) # faster data.frames library(units) -library(stars) library(eixport) sessionInfo() @@ -21,9 +20,11 @@ veh <- readRDS("config/fleet_age.rds") pmonth <- readRDS("config/pmonth.rds") met <- readRDS("config/met.rds") verbose <- FALSE - +euro <- readRDS("config/euro.rds") +tech <- readRDS("config/tech.rds") # fuel calibration with fuel consumption data fuel <- readRDS("config/fuel.rds") + pol <- "FC" source("scripts/fuel_eval.R", encoding = "UTF-8") rm(list = ls()) diff --git a/projects/argentina/estimation/2019/scripts/traffic.R b/projects/argentina/estimation/2019/scripts/traffic.R index 641f2d18..8fdf4660 100644 --- a/projects/argentina/estimation/2019/scripts/traffic.R +++ b/projects/argentina/estimation/2019/scripts/traffic.R @@ -85,12 +85,12 @@ if(survival) { }} } -# lleguehasta aqui # veh #### # v <- metadata$vehicles +# columna region en hoja fuel #### reg <- unique(fuel[["region"]]) if(any(grepl("region", names(veh)))) { diff --git a/projects/argentina/figs/fuel_consumed.png b/projects/argentina/figs/fuel_consumed.png index 6017f6da..ec0d443d 100644 Binary files a/projects/argentina/figs/fuel_consumed.png and b/projects/argentina/figs/fuel_consumed.png differ