Skip to content

Comments

Real-Time Monitoring with InfluxDB & Grafana#250

Open
martinkuechler wants to merge 13 commits intodos-group:mainfrom
philipkalesse:main
Open

Real-Time Monitoring with InfluxDB & Grafana#250
martinkuechler wants to merge 13 commits intodos-group:mainfrom
philipkalesse:main

Conversation

@martinkuechler
Copy link

Real-Time Monitoring with InfluxDB & Grafana

This PR adds real-time simulation monitoring using InfluxDB and Grafana, introduces tagging and geolocation for actors and microgrids, and refactors related components.

Monitoring Integration

  • New Monitor controller streams simulation data to InfluxDB.
  • Added InfluxConfig and InfluxWriter.
  • Enables filtering/grouping in Grafana by actor tag, microgrid, and location.

Observability Stack

  • Docker Compose setup for InfluxDB and Grafana.
  • Includes preconfigured data source and example dashboards.
  • Updated README with setup instructions and usage examples.

Data Model Updates

  • Actor: optional tag and coords (lat, lon), exposed in actor state.
  • Microgrid and Environment: optional coords support propagated through the simulation.

Code & Tests

  • Updated tests to include tag in actor state.
  • Cleaned up imports and exposed new monitoring classes at top-level.
  • Refactored API controller for simpler process handling.

Enables real-time dashboards with structured filtering and geospatial visualization.

philipkalesse and others added 13 commits December 11, 2025 17:08
* Added docker compose file

* Add InfluxDB support to controller

Added optional parameters for InfluxDB configuration and implemented data export functionality to InfluxDB in finalize method.

* Migrate InfluxDB to version 3 and adjust Grafana settings

Updated InfluxDB service to version 3 and modified Grafana configuration.

* Add files via upload

* Update docker-compose.yml

* preload dashboard

* influxdb2 on dashbords. accessing doesnt work for some reason

* Update InfluxDB and Grafana configurations to use environment variables and fixed grafana-influx connection

* updated grafana dashboards, added winddata

---------

Co-authored-by: Philip Kaleße <philipkalesse@Mac-mini-von-Philip.fritz.box>
Co-authored-by: Martin Küchler <152016274+martinkuechler@users.noreply.github.com>
Co-authored-by: martin <martinnice1379@gmail.com>
* fixed issue in sim.py

* Sim funktioniert ohne problem in der INFLUX_URL muss das / am Ende weg

* 2 microgrids writing into csv file

* json changes for different microgrids drop down but need to fill in the name of microgrid in dropdown

* dropdown working

* added third microgrid for testing works fine

* Add coordinates and tags to microgrid actors; update CSV logging for coordinates and tag sums

* Added Map to the dashboard

* feat(influx): skip CSV, stream directly to InfluxDB

Replace batch export with real-time streaming:
- Write data directly to InfluxDB during simulation (in step())
- Skip CSV file generation when InfluxDB is configured
- Actor tags become InfluxDB tags (category=solar/wind/load)
- Each actor written as individual time series point
- Enables live visualization in Grafana during simulation run

* cleaned up dashboard and fixed map

* Readme edited

* edit Monitor in README Simple scenario

* README wrong microgrids deleted

* Add second wind trace with stronger wind characteristics and variability

- Implemented `make_berlin_wind_trace_2` function to generate a new wind trace
  with increased wind strength and variability.
- Introduced a daily cycle with a phase shift and a stronger trend.
- Added noise to the wind data for more realism.
- Integrated the new wind trace into the main simulation, adding a second wind turbine actor.

---------

Co-authored-by: Marc Hentschel <marc.hentschel@campus.tu-berlin.de>
Co-authored-by: martin <martinnice1379@gmail.com>
* Update ConstantSignal to StaticSignal in docs

API changed in bf3f75e

* bugfix for simulations without storage

* updated docs structure

* fixed missing prometheus_client dependency

* migrated examples to executable Python scripts

* simplified docs setup

* renamed controller variable time -> now

* update website and overview figure

* cleanup

* improved docs and docstrings

* renamed MicrogridPolicy to Policy

* added missing types and improved docstrings

* removed deprecated SilActor

* fully refactored controller architecture to rely on a single Mosaik entity

* implemented direct access to storage/policy/actor from controller

* improved controller docstrings

* formatting

* bugfix for empty storage simulations

* split the Monitor into a MemoryLogger and CsvLogger

* renamed Actor.p to Actor.power to be less cryptic

* rewrote plot_microgrid_trace as plot_result_df

* rewrote the docs using Material for MkDocs

* updated docs dependencies + cleanup

* configure readthedocs to use MkDocs

* updated logo and favicon

* updated docs

* updated examples and unit tests

* updated README.md

* linting and bugfix in docs

* fixed github workflows

* minor update to docs

* improve docstrings and convert rst links to Markdown

* improved logging

* fix simulation time synchronization in grid simulator

* Add Monitor to imports and __all__ in __init__.py

* Fix write condition in InfluxWriter to check for _write_api presence

* Refactor datetime imports and clean up whitespace in InfluxWriter and Monitor classes

* Add 'tag' field to actor state in TestActor

---------

Co-authored-by: Otto Richter <otto@codeberg.org>
Co-authored-by: Philipp Wiesner <wiesner@tu-berlin.de>
* Update ConstantSignal to StaticSignal in docs

API changed in bf3f75e

* bugfix for simulations without storage

* updated docs structure

* fixed missing prometheus_client dependency

* migrated examples to executable Python scripts

* simplified docs setup

* renamed controller variable time -> now

* update website and overview figure

* cleanup

* improved docs and docstrings

* renamed MicrogridPolicy to Policy

* added missing types and improved docstrings

* removed deprecated SilActor

* fully refactored controller architecture to rely on a single Mosaik entity

* implemented direct access to storage/policy/actor from controller

* improved controller docstrings

* formatting

* bugfix for empty storage simulations

* split the Monitor into a MemoryLogger and CsvLogger

* renamed Actor.p to Actor.power to be less cryptic

* rewrote plot_microgrid_trace as plot_result_df

* rewrote the docs using Material for MkDocs

* updated docs dependencies + cleanup

* configure readthedocs to use MkDocs

* updated logo and favicon

* updated docs

* updated examples and unit tests

* updated README.md

* linting and bugfix in docs

* fixed github workflows

* minor update to docs

* improve docstrings and convert rst links to Markdown

* improved logging

* fix simulation time synchronization in grid simulator

* Add Monitor to imports and __all__ in __init__.py

* Fix write condition in InfluxWriter to check for _write_api presence

* Refactor datetime imports and clean up whitespace in InfluxWriter and Monitor classes

* Add 'tag' field to actor state in TestActor

---------

Co-authored-by: Otto Richter <otto@codeberg.org>
Co-authored-by: Philipp Wiesner <wiesner@tu-berlin.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants