Skip to content
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

Fix bugs in tutorial and CLI scheduling trigger #545

Merged
merged 5 commits into from Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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