Skip to content

Commit

Permalink
Merge branch 'main' into feature/cli/export-chart
Browse files Browse the repository at this point in the history
  • Loading branch information
victorgarcia98 committed Aug 25, 2023
2 parents 7c177a4 + f54a201 commit a2bdbd4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion documentation/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Bugfixes
* Use the `source` to filter beliefs in the `AggregatorReporter` and fix the case of having multiple sources [see `PR #819 <https://github.com/FlexMeasures/flexmeasures/pull/819>`_]
* Disable HiGHS logs on the standard output when `LOGGING_LEVEL=INFO` [see `PR #824 <https://github.com/FlexMeasures/flexmeasures/pull/824>`_ and `PR #826 <https://github.com/FlexMeasures/flexmeasures/pull/826>`_]
* Fix showing sensor data on the asset page of public assets, and searching for annotations on public assets [see `PR #830 <https://github.com/FlexMeasures/flexmeasures/pull/830>`_]

* Make the command `flexmeasures add schedule for-storage` to pass the soc-target timestamp to the flex model as strings instead of `pd.Timestamp` [see `PR #834 <https://github.com/FlexMeasures/flexmeasures/pull/834>`_]

v0.15.0 | August 9, 2023
============================
Expand Down
10 changes: 6 additions & 4 deletions flexmeasures/cli/data_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,7 @@ def create_schedule(ctx):
),
multiple=True,
required=False,
help="Target state of charge (e.g 100%, or 1) at some datetime. Follow up with a float value and a timezone-aware datetime in ISO 6081 format."
help="Target state of charge (e.g 100%, or 1) at some datetime. Follow up with a float value and a timezone-aware datetime in ISO 8601 format."
" This argument can be given multiple times."
" For example: --soc-target 100% 2022-02-23T13:40:52+00:00",
)
Expand Down Expand Up @@ -1164,15 +1164,17 @@ def add_schedule_for_storage(
soc_at_start = convert_units(soc_at_start.magnitude, soc_at_start.units, "MWh", capacity=capacity_str) # type: ignore
soc_targets = []
for soc_target_tuple in soc_target_strings:
soc_target_value_str, soc_target_dt_str = soc_target_tuple
soc_target_value_str, soc_target_datetime_str = soc_target_tuple
soc_target_value = convert_units(
soc_target_value_str.magnitude,
str(soc_target_value_str.units),
"MWh",
capacity=capacity_str,
)
soc_target_datetime = pd.Timestamp(soc_target_dt_str)
soc_targets.append(dict(value=soc_target_value, datetime=soc_target_datetime))
soc_targets.append(
dict(value=soc_target_value, datetime=soc_target_datetime_str)
)

if soc_min is not None:
soc_min = convert_units(soc_min.magnitude, str(soc_min.units), "MWh", capacity=capacity_str) # type: ignore
if soc_max is not None:
Expand Down
10 changes: 0 additions & 10 deletions flexmeasures/data/models/planning/linear_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,29 +140,19 @@ def commitment_quantity_select(m, c, j):
return commitment_quantities[c].iloc[j]

def device_max_select(m, d, j):
min_v = device_constraints[d]["min"].iloc[j]
max_v = device_constraints[d]["max"].iloc[j]
equal_v = device_constraints[d]["equals"].iloc[j]
if np.isnan(max_v) and np.isnan(equal_v):
return infinity
else:
if not np.isnan(equal_v):
# make min_v < equal_v
equal_v = np.nanmax([equal_v, min_v])

return np.nanmin([max_v, equal_v])

def device_min_select(m, d, j):
min_v = device_constraints[d]["min"].iloc[j]
max_v = device_constraints[d]["max"].iloc[j]
equal_v = device_constraints[d]["equals"].iloc[j]
if np.isnan(min_v) and np.isnan(equal_v):
return -infinity
else:
if not np.isnan(equal_v):
# make equal_v <= max_v
equal_v = np.nanmin([equal_v, max_v])

return np.nanmax([min_v, equal_v])

def device_derivative_max_select(m, d, j):
Expand Down

0 comments on commit a2bdbd4

Please sign in to comment.