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
Feature/save soc values as a sensor #1018
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Ahmad Wahid <ahmedwahid16101@gmail.com>
Signed-off-by: Ahmad Wahid <ahmedwahid16101@gmail.com>
Signed-off-by: Ahmad Wahid <ahmedwahid16101@gmail.com>
…-soc-values-as-a-sensor # Conflicts: # flexmeasures/data/models/planning/tests/test_solver.py
Signed-off-by: Ahmad Wahid <ahmedwahid16101@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. It's even a bit more already than what was needed. Let's limit the scope just a little for clarity and a step-wise robust approach, and other than that I think we only need to pass some more info to the integration function.
flexmeasures/data/schemas/sensors.py
Outdated
try: | ||
float(value) | ||
return value | ||
except ValueError: | ||
pass | ||
return ur.Quantity(value).to(self.to_unit) | ||
except DimensionalityError as e: | ||
raise FMValidationError( | ||
f"Cannot convert value `{value}` to '{self.to_unit}'" | ||
) from e | ||
elif ( | ||
isinstance(value, Sensor) | ||
or isinstance(value, int) | ||
or isinstance(value, float) | ||
): | ||
return value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we'll need changes to this schema for now. SoC values passed to the new field should be sensor descriptions ({"sensor": <id>}
) or strings containing a unit that is convertible to MWh (e.g. "50 kWh"
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The flex model gets SoC sensor and not a dictionay . So I still need to have a check for sensor as value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about this change?
…-soc-values-as-a-sensor
Signed-off-by: Ahmad Wahid <ahmedwahid16101@gmail.com>
Description
This PR introduces
create_soc_schedule
, a function to generate a state of charge (SOC) schedule from provided data. It also handles the creation or retrieval of the corresponding SOC sensor.Look & Feel
UI output looks like this:
How to test
Try to run the Toy examples(1 and 2), first add the beliefs from here and then add the schedule from here. You will see a sensor with name
soc schedule
and id4
. Similarly, you can see the data intimed_beliefs
table.Further Improvements
Potential improvements to be done in the same PR or follow up Issues/Discussions/PRs.
Related Items
Mention if this PR closes an Issue or Project.