-
Notifications
You must be signed in to change notification settings - Fork 38
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
Validate unit types in flex context schema #1353
Comments
Just a quick note: what about scheduling against emission intensity? |
Ah, so everything that we call "price" here could be "CO2/some energy", as well? What is the unit for CO2? We could add another util function |
I suggest implementing your suggestions for the |
Also related: we've encountered practical use cases for expressing SoC units in arbitrary units, such as temperature units or percentages (something we don't currently support). Correspondingly, that would necessitate arbitrary conversion efficiencies between power and SoC deltas. |
It seems like that will be relevant for the flex-model right? |
One more note: the breach prices and peak prices are capacity prices (EUR/MW rather than EUR/MWh).
Yes, you are right.
Please clarify. |
So we might need another util function to check for these.
|
Following the discussions, the changes/modifications this issue suggested should be done in the DBFlexContextSchema, right? Or just in the FlexContextSchema? |
I believe the FlexContextSchema would be right for this, or do you see a reason otherwise? I'm not sure why |
ithink we did that to avoid clashes with other parts of the code that are using the FlexContextSchema with these values we are forbiding |
@nhoening i just came across something. ltts use the prices field for this example (the prices field expect the first two that only takes sensors for now) The other four values can take a sensor. That will then mean that this validation to check for valid energy_price unit will only take place if we confirm the value is not a sensor but rather a fixed value. Or if its a sensor we go check if the sensor is of that unit. This also applies to the power fields as well |
I assume "Itts" means "Let's"? Yes, as the issue description says, we need to check either the fixed value or the sensor's unit. Or did I miss another question? |
One reason is that scheduling against emission intensity should remain supported:
So in my opinion, the unit validation on price fields should be limited to the
|
Thanks for the explanations. Considerations about this (not relevant for this PR): We might live with some differences between expressiveness in DB fields and what the API enables for some time.
|
For each field, we can note if the field needs a power, energy, currency or energy price unit.
Then, we can amend the FlexContextSchema with a check for that (checking the fixed value or the sensor's unit). If the check fails throw a validation error with a helpful message (including an example, e.g.
kW
for power, orEUR/kWh
for energy price).The util functions are already in place in
flexmeasures/utils/unit_utils.py
, e.g.is_power_unit()
.Let's check both the field values and sensor for fitting units.
My take on what should be checked for what field:
The text was updated successfully, but these errors were encountered: