quintel / etengine

Calculation engine for the Energy Transition Model
https://energytransitionmodel.com/
MIT License
15 stars 7 forks source link

Merit order appears to be disabled #1294

Closed robcalon closed 1 year ago

robcalon commented 1 year ago

The merit order for the following scenario won't resolve. When checking the 'settings_enable_merit_order' value the merit order seems to be enabled. What could be wrong?

https://engine.energytransitionmodel.com/api/v3/scenarios/947555/curves/merit_order

robcalon commented 1 year ago

I also noted that this error is quite hard to catch as I'd have expected ETEngine to return a 422 including a JSON encoded message, where I now received a 200 with a TEXT encoded message.

marliekeverweij commented 1 year ago

@antw do you maybe have time to have a look at this issue?

antw commented 1 year ago

This is because the end year for the scenario is set to 2019, and 2019 is also the start year for the NL2019 dataset. Currently, ETEngine does not support the two years being the same, and doing so has the undesired effect of turning off the merit order (and all hourly calculations).

In theory, I expect we could support this but I'm not sure how big an effort it would be. In the meantime, I'll add a validation when creating a scenario and have ETEngine return a more appropriate response.

antw commented 1 year ago

I also noted that this error is quite hard to catch as I'd have expected ETEngine to return a 422 including a JSON encoded message, where I now received a 200 with a TEXT encoded message.

I've fixed this to return a 404 Not Found instead of 200 OK. That seemed like the most appropriate code to me, since the curves are not available if Merit is turned off. We tend to use 422 to indicate validation errors; if Merit is turned off your request is valid, it's just that there's no data we can send back to you.

robcalon commented 1 year ago

In theory, I expect we could support this but I'm not sure how big an effort it would be. In the meantime, I'll add a validation when creating a scenario and have ETEngine return a more appropriate response.

The aim is to use these scenario's to reference default states. I know that a lot of outputs have a 2019 reference value, but it's not always present or unambiguous, e.g. for reference values for hourly curves or the default input parameters of a scenario that is copied from another scenario. The need is not necessarily in manipulating the 2019 scenario but in fetching the reference states. For now we can bypass this by creating reference scenarios with a different end year than 2019.