Skip to content

Commit

Permalink
Fix bugs in tutorial and CLI scheduling trigger (#545)
Browse files Browse the repository at this point in the history
* Add missing timezone

Signed-off-by: F.N. Claessen <felix@seita.nl>

* Fix call to make_schedule

Signed-off-by: F.N. Claessen <felix@seita.nl>

* Ensure storage specs, also when make_schedule is called directly (i.e. no job)

Signed-off-by: F.N. Claessen <felix@seita.nl>

* One more missing timezone

Signed-off-by: F.N. Claessen <felix@seita.nl>

* Wrong timezone (only updated from utc to Europe/Amsterdam in #481)

Signed-off-by: F.N. Claessen <felix@seita.nl>

Signed-off-by: F.N. Claessen <felix@seita.nl>
  • Loading branch information
Flix6x committed Dec 1, 2022
1 parent 81b6525 commit 236b472
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion documentation/index.rst
Expand Up @@ -40,7 +40,7 @@ A tiny, but complete example: Let's install FlexMeasures from scratch. Then, usi
$ export SQLALCHEMY_DATABASE_URI="postgresql://postgres:docker@127.0.0.1:5433/flexmeasures-db" && export SECRET_KEY=notsecret
$ flexmeasures db upgrade # create tables
$ flexmeasures add toy-account --kind battery # setup account & a user, a battery (Id 2) and a market (Id 3)
$ flexmeasures add beliefs --sensor-id 3 --source toy-user prices-tomorrow.csv # load prices, also possible per API
$ flexmeasures add beliefs --sensor-id 3 --source toy-user prices-tomorrow.csv --timezone utc # load prices, also possible per API
$ flexmeasures add schedule --sensor-id 2 --consumption-price-sensor 3 \
--start ${TOMORROW}T07:00+01:00 --duration PT12H \
--soc-at-start 50% --roundtrip-efficiency 90% # this is also possible per API
Expand Down
2 changes: 1 addition & 1 deletion documentation/tut/toy-example-from-scratch.rst
Expand Up @@ -19,7 +19,7 @@ Below are the ``flexmeasures`` CLI commands we'll run, and which we'll explain s
# setup an account with a user, a battery (Id 2) and a market (Id 3)
$ flexmeasures add toy-account --kind battery
# load prices to optimise the schedule against
$ flexmeasures add beliefs --sensor-id 3 --source toy-user prices-tomorrow.csv
$ flexmeasures add beliefs --sensor-id 3 --source toy-user prices-tomorrow.csv --timezone utc
# make the schedule
$ flexmeasures add schedule --sensor-id 2 --consumption-price-sensor 3 \
--start ${TOMORROW}T07:00+01:00 --duration PT12H \
Expand Down
12 changes: 7 additions & 5 deletions flexmeasures/cli/data_add.py
Expand Up @@ -1015,11 +1015,13 @@ def create_schedule(
end=end,
belief_time=server_now(),
resolution=power_sensor.event_resolution,
soc_at_start=soc_at_start,
soc_targets=soc_targets,
soc_min=soc_min,
soc_max=soc_max,
roundtrip_efficiency=roundtrip_efficiency,
storage_specs=dict(
soc_at_start=soc_at_start,
soc_targets=soc_targets,
soc_min=soc_min,
soc_max=soc_max,
roundtrip_efficiency=roundtrip_efficiency,
),
consumption_price_sensor=consumption_price_sensor,
production_price_sensor=production_price_sensor,
)
Expand Down
2 changes: 2 additions & 0 deletions flexmeasures/data/services/scheduling.py
Expand Up @@ -144,6 +144,8 @@ def make_schedule(
% sensor.generic_asset.generic_asset_type
)

storage_specs = ensure_storage_specs(storage_specs, sensor, start, end, resolution)

consumption_schedule = scheduler().schedule(
sensor,
start,
Expand Down

0 comments on commit 236b472

Please sign in to comment.