Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve energy model error #27

Merged
merged 2 commits into from
Nov 10, 2023
Merged

Improve energy model error #27

merged 2 commits into from
Nov 10, 2023

Conversation

nreinicke
Copy link
Collaborator

@nreinicke nreinicke commented Nov 10, 2023

Improves the error for the speed grade model when the energy model provided under the model_name parameter cannot be found in the library. When providing the key "model_name": "flying_car" for the default OSM energy config produces the error:

failure building traversal model: No energy model found with name 'flying_car', try one of: ["2022_Volvo_XC40_Recharge_twin", "2012_Ford_Focus", "2016_TOYOTA_Corolla_4cyl_2WD", "2016_TOYOTA_Highlander_Hybrid", "2016_TESLA_Model_S60_2WD", "2016_AUDI_A3_4cyl_2WD", "2016_CHEVROLET_Spark_EV", "2017_Maruti_Dzire_VDI", "2020_Chevrolet_Colorado_2WD_Diesel", "2016_Toyota_Prius_Two_FWD", "2022_Tesla_Model_3_RWD", "2017_CHEVROLET_Bolt", "2012_Ford_Fusion", "2016_TOYOTA_Camry_4cyl_2WD", "2020_VW_Golf_2.0TDI", "2022_Ford_F-150_Lightning_4WD", "2022_Tesla_Model_Y_RWD", "2016_FORD_C-MAX_HEV", "2016_FORD_Escape_4cyl_2WD", "2016_KIA_Optima_Hybrid", "2022_Renault_Zoe_ZE50_R135", "2016_BMW_328d_4cyl_2WD", "2016_HYUNDAI_Elantra_4cyl_2WD", "2017_Toyota_Highlander_3.5_L", "2023_Mitsubishi_Pajero_Sport", "2022_Toyota_Yaris_Hybrid_Mid", "2016_CHEVROLET_Malibu_4cyl_2WD", "2021_Peugot_3008", "2021_Fiat_Panda_Mild_Hybrid", "2016_Nissan_Leaf_30_kWh", "2020_VW_Golf_1.5TSI", "2016_MITSUBISHI_i-MiEV", "2016_FORD_Explorer_4cyl_2WD", "2016_Leaf_24_kWh"]

closes #23

Copy link
Collaborator

@robfitzgerald robfitzgerald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice quality of life improvement. just one request before we roll this in. thanks!

@@ -152,6 +144,8 @@ impl TryFrom<(Arc<SpeedGradeModelService>, &serde_json::Value)> for SpeedGradeMo
) -> Result<Self, Self::Error> {
let (service, conf) = input;

let model_names: Vec<&String> = service.energy_model_library.keys().collect();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we move line 147 to line 181, we only build this vector if there is an error, instead of building it each time we process a query

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep yep, that's a good point, change forthcoming

Copy link
Collaborator

@robfitzgerald robfitzgerald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍻

@nreinicke nreinicke merged commit d1468e7 into main Nov 10, 2023
5 checks passed
@nreinicke nreinicke deleted the ndr/energy-model-error branch November 10, 2023 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve routee-powertrain model error message
2 participants