index.rst 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. Welcome to the FlexMeasures documentation!
  2. ===================================================================
  3. *FlexMeasures* is an intelligent EMS to optimize behind-the-meter energy flexibility.
  4. Build your smart energy apps & services with FlexMeasures as backend for real-time orchestration!
  5. The problem FlexMeasures helps you to solve is: **What are the best times to power flexible assets, such as batteries or heat pumps?**
  6. In a nutshell, FlexMeasures turns data into optimized schedules for flexible assets.
  7. *Why?* Planning ahead allows flexible assets to serve the whole system with their flexibility, e.g. by shifting energy consumption to more optimal times. For the asset owners, this creates CO₂ savings but also monetary value (e.g. through self-consumption, dynamic tariffs and grid incentives).
  8. .. image:: https://raw.githubusercontent.com/FlexMeasures/screenshots/main/architecture/simple-flexEMS.png
  9. :align: center
  10. .. :scale: 40%
  11. FlexMeasures is written in Python, and runs on Flask and Postgres.
  12. We aim to create developer-friendly technology that saves time in developing complex services.
  13. Read more on this in :ref:`dev_why`.
  14. FlexMeasures proudly is an incubation project at `the Linux Energy Foundation <https://www.lfenergy.org/>`_.
  15. A quick glance
  16. ----------------
  17. The main purpose of FlexMeasures is to create optimized schedules. Let's have a quick glance at what that looks like in the UI and what a code implementation would be like:
  18. .. tabs::
  19. .. tab:: Battery optimized by price
  20. .. image:: https://raw.githubusercontent.com/FlexMeasures/screenshots/main/tut/toy-schedule/asset-view-without-solar.png
  21. :target: https://raw.githubusercontent.com/FlexMeasures/screenshots/main/tut/toy-schedule/asset-view-without-solar.png
  22. :align: center
  23. .. :scale: 40%
  24. .. tab:: Same but constrained by solar
  25. .. image:: https://raw.githubusercontent.com/FlexMeasures/screenshots/main/tut/toy-schedule/asset-view-with-solar.png
  26. :target: https://raw.githubusercontent.com/FlexMeasures/screenshots/main/tut/toy-schedule/asset-view-with-solar.png
  27. :align: center
  28. .. :scale: 40%
  29. .. tab:: Code example
  30. A tiny, but complete example (corresponding to the left tab): Let's install FlexMeasures from scratch. Then, using only the terminal (FlexMeasures of course also has APIs for all of this), load hourly prices and optimize a 12h-schedule for a battery that is half full at the beginning. Finally, we'll display our new schedule in the terminal.
  31. .. code-block:: console
  32. $ pip install flexmeasures # FlexMeasures can also be run via Docker
  33. $ docker pull postgres; docker run --name pg-docker -e POSTGRES_PASSWORD=docker -e POSTGRES_DB=flexmeasures-db -d -p 5433:5432 postgres:latest
  34. $ export SQLALCHEMY_DATABASE_URI="postgresql://postgres:docker@127.0.0.1:5433/flexmeasures-db" && export SECRET_KEY=notsecret
  35. $ flexmeasures db upgrade # create tables
  36. $ flexmeasures add toy-account --kind battery # setup account incl. a user, battery (ID 2) and market (ID 1)
  37. $ flexmeasures add beliefs --sensor 2 --source toy-user prices-tomorrow.csv --timezone utc # load prices, also possible per API
  38. $ flexmeasures add schedule for-storage --sensor 2 --consumption-price-sensor 1 \
  39. --start ${TOMORROW}T07:00+01:00 --duration PT12H \
  40. --soc-at-start 50% --roundtrip-efficiency 90% # this is also possible per API
  41. $ flexmeasures show beliefs --sensor 2 --start ${TOMORROW}T07:00:00+01:00 --duration PT12H # also visible per UI, of course
  42. A short explanation of the optimization shown above: This battery is optimized to buy power cheaply and sell it at expensive times - the red-dotted line is what FlexMeasures computed to be the best schedule, given all knowledge (in this case, the prices shown in blue). However, in the example in the middle tab, the battery has to store local solar power as well (orange line), which constrains how much it can do with its capacity (that's why the schedule is limited in capacity and thus cycling less energy overall than on the left).
  43. Want to read more about the example case shown here? We discuss this in more depth at :ref:`tut_toy_schedule` and the tutorials that build on that.
  44. What FlexMeasures does
  45. -----------------------
  46. .. _usage:
  47. .. tabs::
  48. .. tab:: Main functionality
  49. - Scheduling
  50. The main purpose of FlexMeasures is to create optimized schedules. That's also what the "quick glance" section above focuses on. Everything else supports this main purpose. FlexMeasures provides in-built schedulers for storage and processes. Schedulers solve optimization problems for you and are highly customizable to the situation at hand. Read more at :ref:`scheduling` and, for hands-on introductions, at :ref:`tut_toy_schedule` and :ref:`tut_toy_schedule_process`.
  51. - Reporting
  52. FlexMeasures needs to give users an idea of its effects and outcomes. For instance, computing the energy costs are an important use case. But also creating intermediate data for your scheduler can be a crucial feature (e.g. the allowed headroom for a battery is the difference between the grid connection capacity and the PV power). Read more at :ref:`reporting` and :ref:`tut_toy_schedule_reporter`.
  53. - Forecasting
  54. Optimizing the future (by scheduling) requires some predictions. Several predictions can be gotten from third parties (e.g. weather conditions, for which we wrote `a plugin <https://github.com/SeitaBV/flexmeasures-openweathermap>`_), others need to be done manually. FlexMeasures provides some support for this (read more at :ref:`forecasting` and :ref:`tut_forecasting_scheduling`), but you can also create predictions with one of the many excellent tools out there and feed them into FlexMeasures.
  55. - Monitoring
  56. As FlexMeasures is a real-time platform, processing data and computing new schedules continuously, hosting it requires to be notified when things go wrong. There is in-built :ref:`host_error_monitoring` for tracking connection problems and tasks that did not finish correctly. Also, you can connect to Sentry. We have `further plans to monitor data quality <https://github.com/FlexMeasures/flexmeasures/projects/12>`_.
  57. .. tab:: Interfacing with FlexMeasures
  58. - API
  59. FlexMeasures runs in the cloud (although it can also run on-premise if needed, for instance as Docker container). Therefore, a well-supported REST-like API is crucial. You can add & retrieve data, trigger schedule computations and even add and edit the structure (of assets and sensors). Read more at :ref:`api_introduction`.
  60. - UI
  61. We built a user interface for FlexMeasures, so assets, data and schedules can be inspected by devs, hosters and analysts. You can start with :ref:`_dashboard` to get an idea. We expect that real energy flexibility services will come with their own UI, maybe as they are connecting FlexMeasures as a smart backend to an existing user-facing ESCO platform. In these cases, the API is more useful. However, FlexMeasures can provide its data plots and visualizations through the API in these cases, see :ref:`tut_building_uis`.
  62. - CLI
  63. For the engineers hosting FlexMeasures, a command-line interface is crucial. We developed a range of :ref:`cli` based on the ``flexmeasures`` directive (see also the code example above), so that DevOps personnel can administer accounts & users, load & review data and heck on computation jobs. The CLI is also useful to automate calls to third party APIs (via CRON jobs for instance) ― this is usually done when plugins add their own ``flexmeasures`` commands.
  64. - FlexMeasures Client
  65. For automating the interaction with FlexMeasures from local sites (e.g. from a smart gateway - think RaspberryPi or higher-level), we created `the FlexMeasures Client <https://github.com/FlexMeasures/flexmeasures-client>`_. The Flexmeasures Client package provides functionality for authentication, posting sensor data, triggering schedules and retrieving schedules from a FlexMeasures instance through the API.
  66. .. _use_cases_and_users:
  67. Use cases & Users
  68. -----------
  69. .. tabs::
  70. .. tab:: Use cases
  71. Here are a few relevant areas in which FlexMeasures can help you:
  72. - E-mobility (smart :abbr:`EV (Electric Vehicle)` charging, :abbr:`V2G (Vehicle to Grid)`, :abbr:`V2H (Vehicle to Home)`)
  73. - Heating (heat pump control, in combination with heat buffers)
  74. - Industry (best running times for processes with buffering capacity)
  75. You decide what to optimize for ― prices, CO₂, peaks.
  76. It becomes even more interesting to use FlexMeasures in *integrated scenarios* with increased complexity. For example, in modern domestic/office settings that combine solar panels, electric heating and EV charging, in industry settings that optimize for self-consumption of local solar panels, or when consumers can engage with multiple markets simultaneously.
  77. In these cases, our goal is that FlexMeasures helps you to achieve *"value stacking"*, which is often required to achieve a positive business case. Multiple sources of value can combine with multiple types of assets.
  78. .. tab:: Users
  79. As possible users, we see energy service companies (ESCOs) who want to build real-time apps & services around energy flexibility for their customers, or medium/large industrials who are looking for support in their internal digital tooling.
  80. However, even small companies and hobby projects might find FlexMeasures useful! We are constantly improving the ease of use.
  81. Within these organizations, several kinds of engineers might be working with FlexMeasures: gateway installers, ESCO data engineers and service developers.
  82. FlexMeasures can be used as your EMS, but it can also integrate with existing systems as a smart backend ― an add-on to deal with energy flexibility specifically.
  83. The image below shows the FlexMeasures eco-system and the users, where the server (this repository) is supported by the FlexMeasures client and several plugins to implement many kinds of services with optimized schedules:
  84. .. image:: https://raw.githubusercontent.com/FlexMeasures/screenshots/main/architecture/FlexMeasures-IntegrationMap.drawio.png
  85. :target: https://raw.githubusercontent.com/FlexMeasures/screenshots/main/architecture/FlexMeasures-IntegrationMap.drawio.png
  86. :align: center
  87. .. :scale: 40%
  88. This image should also make clear how to extend FlexMeasures on the edges to make it work for your exact use case ― by gateway integration, plugins and using FlexMeasures via its API.
  89. Where to start reading?
  90. --------------------------
  91. You (the reader) might be a user connecting with a FlexMeasures server or working on hosting FlexMeasures. Maybe you are planning to develop a plugin or even core functionality. Maybe you are a CTO looking for a suitable open source framework.
  92. In :ref:`getting_started`, we have some helpful tips how to dive into this documentation!
  93. .. toctree::
  94. :maxdepth: 1
  95. :hidden:
  96. getting-started
  97. get-in-touch
  98. changelog
  99. .. toctree::
  100. :caption: Features
  101. :maxdepth: 1
  102. features/scheduling
  103. features/forecasting
  104. features/reporting
  105. .. toctree::
  106. :caption: Tutorials
  107. :maxdepth: 1
  108. tut/toy-example-setup
  109. tut/toy-example-from-scratch
  110. tut/toy-example-expanded
  111. tut/flex-model-v2g
  112. tut/toy-example-process
  113. tut/toy-example-reporter
  114. tut/posting_data
  115. tut/forecasting_scheduling
  116. tut/building_uis
  117. .. toctree::
  118. :caption: Concepts
  119. :maxdepth: 1
  120. concepts/flexibility
  121. concepts/data-model
  122. concepts/security_auth
  123. concepts/device_scheduler
  124. .. toctree::
  125. :caption: The in-built UI
  126. :maxdepth: 1
  127. views/dashboard
  128. views/asset-data
  129. views/sensors
  130. views/account
  131. views/admin
  132. .. toctree::
  133. :caption: The API
  134. :maxdepth: 1
  135. api/introduction
  136. api/notation
  137. api/v3_0
  138. api/dev
  139. api/change_log
  140. .. toctree::
  141. :caption: The CLI
  142. :maxdepth: 1
  143. cli/commands
  144. cli/change_log
  145. .. toctree::
  146. :caption: Hosting FlexMeasures
  147. :maxdepth: 1
  148. host/installation
  149. host/docker
  150. host/data
  151. host/deployment
  152. configuration
  153. host/queues
  154. host/error-monitoring
  155. host/modes
  156. .. toctree::
  157. :caption: Developing Plugins
  158. :maxdepth: 1
  159. plugin/introduction
  160. plugin/showcase
  161. plugin/customisation
  162. .. toctree::
  163. :caption: Developing on FlexMeasures
  164. :maxdepth: 1
  165. dev/why
  166. dev/setup-and-guidelines
  167. dev/api
  168. dev/ci
  169. dev/auth
  170. dev/docker-compose
  171. dev/dependency-management
  172. .. autosummary::
  173. :caption: Code Documentation
  174. :toctree: _autosummary/
  175. :template: custom-module-template.rst
  176. :recursive:
  177. flexmeasures.api
  178. flexmeasures.app
  179. flexmeasures.auth
  180. flexmeasures.cli
  181. flexmeasures.data
  182. flexmeasures.ui
  183. flexmeasures.utils
  184. .. Code documentation
  185. .. ------------------
  186. .. Go To :ref:`source`.
  187. .. Indices and tables
  188. .. ==================
  189. .. * :ref:`genindex`
  190. .. * :ref:`modindex`
  191. .. * :ref:`search`