Skip to content

Commit

Permalink
Toy tutorial UI fixes (#466)
Browse files Browse the repository at this point in the history
Correct mistake in how the battery schedule is visualized in the UI and CLI (positive values indicate production, i.e. discharging). Also make what is shown on chart tooltips easier to the eye.


* Switch interpretation of charging sensor to discharging for positive values

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

* Stop using the SI prefix when formatting quantitative data values, now that we show the unit right next to the value

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

* Avoid showing "null" versions for data source models

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

* Changelog entry

Signed-off-by: F.N. Claessen <felix@seita.nl>
  • Loading branch information
Flix6x committed Jul 21, 2022
1 parent 9d62a1c commit 1c0054b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions documentation/changelog.rst
Expand Up @@ -20,6 +20,7 @@ Bugfixes
* Do not fail asset page if entity addresses cannot be built [see `PR #457 <http://www.github.com/FlexMeasures/flexmeasures/pull/457>`_]
* Time scale axes in sensor data charts now match the requested date range, rather than stopping at the edge of the available data [see `PR #449 <http://www.github.com/FlexMeasures/flexmeasures/pull/449>`_]
* The docker-based tutorial now works with UI on all platforms (port 5000 did not expose on MacOS) [see `PR #465 <http://www.github.com/FlexMeasures/flexmeasures/pull/465>`_]
* Fix interpretation of scheduling results in toy tutorial [see `PR #466 <http://www.github.com/FlexMeasures/flexmeasures/pull/466>`_]

Infrastructure / Support
----------------------
Expand Down
2 changes: 1 addition & 1 deletion flexmeasures/cli/data_add.py
Expand Up @@ -996,7 +996,7 @@ def add_toy_account(kind: str, name: str):
)
# add charging sensor to battery
charging_sensor = Sensor(
name="charging",
name="discharging",
generic_asset=asset,
unit="MW",
timezone="Europe/Amsterdam",
Expand Down
2 changes: 1 addition & 1 deletion flexmeasures/data/models/charts/belief_charts.py
Expand Up @@ -79,7 +79,7 @@ def chart_for_multiple_sensors(
unit = sensor.unit if sensor.unit else "a.u."
event_value_field_definition = dict(
title=f"{capitalize(sensor.sensor_type)} ({unit})",
format=[".3s", unit],
format=[".3~r", unit],
formatType="quantityWithUnitFormat",
stack=None,
**{
Expand Down
5 changes: 4 additions & 1 deletion flexmeasures/data/models/data_sources.py
Expand Up @@ -88,9 +88,12 @@ def __str__(self):
return self.description

def to_dict(self) -> dict:
model_incl_version = self.model if self.model else ""
if self.model and self.version:
model_incl_version += f" ({self.version}"
return dict(
id=self.id,
name=self.name,
model=f"{self.model} ({self.version})" if self.model else "",
model=model_incl_version,
description=self.description,
)

0 comments on commit 1c0054b

Please sign in to comment.