flexmeasures icon indicating copy to clipboard operation
flexmeasures copied to clipboard

Add replay button to sensor and asset pages

Open Flix6x opened this issue 1 year ago • 5 comments

Closes #436

  • [x] Add replay button to sensor page
  • [x] Add replay button to asset page
  • [x] Get chart data including older beliefs
  • [x] Loop through data replaying the past
  • [x] Show simulation time underneath replay button
  • [x] Speed up chart responsiveness: draw only the most recent beliefs in the chart
  • [x] Speed up slicing: pop and append data
  • [x] Speed up chart updating: remove only obsolete beliefs and insert only new beliefs [did not result in faster chart updating]

Flix6x avatar Jul 15 '22 12:07 Flix6x

Pull Request Test Coverage Report for Build 3015290146

  • 5 of 13 (38.46%) changed or added relevant lines in 3 files are covered.
  • 31 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.04%) to 65.056%

Changes Missing Coverage Covered Lines Changed/Added Lines %
flexmeasures/data/models/time_series.py 3 6 50.0%
flexmeasures/data/models/generic_assets.py 0 5 0.0%
<!-- Total: 5 13
Files with Coverage Reduction New Missed Lines %
flexmeasures/data/models/time_series.py 1 70.03%
flexmeasures/data/schemas/generic_assets.py 9 83.05%
flexmeasures/data/queries/utils.py 21 51.32%
<!-- Total: 31
Totals Coverage Status
Change from base Build 2999633885: -0.04%
Covered Lines: 6477
Relevant Lines: 9349

💛 - Coveralls

coveralls avatar Jul 15 '22 12:07 coveralls

I feel a pause button (next to Play) would be very useful to have!

nhoening avatar Jul 18 '22 13:07 nhoening

I feel a pause button (next to Play) would be very useful to have!

Did you notice the play button already animates into a pause button?

Flix6x avatar Jul 21 '22 14:07 Flix6x

No, I did not!

nhoening avatar Jul 21 '22 14:07 nhoening

Please note that the current code includes some helpful logging statements in your browser console: which functionality is being called when hitting the button, and some statements about execution time. I'll remove those timers at a later point.

When selecting a longer time periode (more than a week), the simulation slows down a bit. This seems to be mainly from reloading the data into the graph. Slicing the data takes 10-30 ms, and loading that data into the graph takes 30-200 ms, depending on how much data is shown in the graph. I tried different approaches here, but fell back to the original approach of telling vega to remove all previous data and to insert a completely new dataset at each iteration. Updating the view with removing only a few data points (representing obsolete beliefs) and inserting only a few data points (representing the most recent new beliefs) actually made it slower.

Flix6x avatar Jul 21 '22 14:07 Flix6x

One more comment: I notice that a few lines in base.html do not have a semicolon:

220, 251, 259-261, 263, 265, 267-272, 308, 309, 311-319, etc.

I believe we should add them, or otherwise follow one formatting style.

nhoening avatar Sep 06 '22 14:09 nhoening