Skip to content

Commit

Permalink
Merge a646d7e into ba189c4
Browse files Browse the repository at this point in the history
  • Loading branch information
victorgarcia98 committed Jul 28, 2023
2 parents ba189c4 + a646d7e commit 240f2f9
Show file tree
Hide file tree
Showing 8 changed files with 529 additions and 346 deletions.
2 changes: 1 addition & 1 deletion documentation/cli/change_log.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ since v0.15.0 | July XX, 2023

* Allow deleting multiple sensors with a single call to ``flexmeasures delete sensor`` by passing the ``--id`` option multiple times.
* Add ``flexmeasures add schedule for-process`` to create a new process schedule for a given power sensor.

* Add ``--kind process`` option to create the asset and sensors for the ``ProcessScheduler`` tutorial.

since v0.14.1 | June XX, 2023
=================================
Expand Down
3 changes: 3 additions & 0 deletions documentation/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,11 @@ The platform operator of FlexMeasures can be an Aggregator.
:maxdepth: 1

tut/installation
tut/toy-example-setup
tut/toy-example-from-scratch
tut/toy-example-expanded
tut/toy-example-process
tut/installation
tut/posting_data
tut/forecasting_scheduling
tut/building_uis
Expand Down
10 changes: 6 additions & 4 deletions documentation/tut/toy-example-expanded.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ Now, we'll reschedule the battery while taking into account the solar production

.. code-block:: bash
$ flexmeasures add schedule for-storage --sensor-id 1 --consumption-price-sensor 2 \
$ flexmeasures add schedule for-storage --sensor-id 2 --consumption-price-sensor 1 \
--inflexible-device-sensor 3 \
--start ${TOMORROW}T07:00+01:00 --duration PT12H \
--start ${TOMORROW}T07:00+02:00 --duration PT12H \
--soc-at-start 50% --roundtrip-efficiency 90%
New schedule is stored.
We can see the updated scheduling in the `FlexMeasures UI <http://localhost:5000/sensors/1/>`_ :
We can see the updated scheduling in the `FlexMeasures UI <http://localhost:5000/sensors/2/>`_ :

.. image:: https://github.com/FlexMeasures/screenshots/raw/main/tut/toy-schedule/sensor-data-charging-with-solar.png
:align: center
Expand All @@ -103,4 +103,6 @@ First, during the sunny hours of the day, when solar power is being send to the

Second, charging of the battery is also changed a bit (around 10am), as less can be discharged later.

We hope this part of the tutorial shows how to incorporate a limited grid connection rather easily with FlexMeasures. There are more ways to model such settings, but this is a straightforward one.
We hope this part of the tutorial shows how to incorporate a limited grid connection rather easily with FlexMeasures. There are more ways to model such settings, but this is a straightforward one.

This tutorial showed the fastest way to a schedule. In :ref:`_tut_toy_schedule_process`, we'll go further into settings with more realistic ingredients: solar panels and a limited grid connection.
268 changes: 7 additions & 261 deletions documentation/tut/toy-example-from-scratch.rst

Large diffs are not rendered by default.

110 changes: 110 additions & 0 deletions documentation/tut/toy-example-process.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
.. _tut_toy_schedule_process:



Toy example III: Computing schedules for processes
====================================================================

Until this point we've been using a static battery, one of the most flexible energy assets, to reduce electricity bills.

However, in some settings, we can reduce electricity bills by *just* consuming energy smartly. In other words, if the process can be displaced, by breaking it into smaller consumption periods or shifting its start time, the process run can match the lower price hours better.

For example, we could have a load that consumes energy at a constant rate (e.g. 100kW) for a fix duration (e.g. 3h), but there's some flexibility in the start time. In that case, we could find the optimal start time in order to minimize the energy cost.

Examples of flexible processes are:
- Water irrigation in agriculture
- Mechanical pulping in the paper industry
- Water pumping in waster water management
- Cooling for the food industry


For consumers under ToU (Time of Use) tariffs, FlexMeasures `ProcessScheduler` can plan the start time of the process to minimizes the overall cost of energy.
Alternatively, it can create a consumption pan to minimize the CO2 emissions.


In this tutorial, you'll learn how to schedule processes using three different policies: INFLEXIBLE, BREAKABLE and SHIFTABLE.

Moreover, we'll touch upon the use of time restrictions to avoid scheduling a process in certain times of the day.


Setup
.....


Before moving forward, we'll add the `process` asset and three sensors to store the schedules resulting from following three different policies.

.. code-block:: bash
$ flexmeasures add toy-account --kind process
Asset type solar already exists.
Asset type wind already exists.
Asset type one-way_evse already exists.
Asset type two-way_evse already exists.
Asset type battery already exists.
Asset type building already exists.
Asset type process already exists.
Account '<Account Toy Account (ID:1)>' already exists. Skipping account creation. Use `flexmeasures delete account --id 1` if you need to remove it.
User with email toy-user@flexmeasures.io already exists in account Toy Account.
The sensor recording day-ahead prices is day-ahead prices (ID: 1).
Created <GenericAsset None: 'toy-process' (process)>
Created Power (INFLEXIBLE)
Created Power (BREAKABLE)
Created Power (SHIFTABLE)
The sensor recording the power of the INFLEXIBLE load is Power (INFLEXIBLE) (ID: 4).
The sensor recording the power of the BREAKABLE load is Power (BREAKABLE) (ID: 5).
The sensor recording the power of the SHIFTABLE load is Power (SHIFTABLE) (ID: 6).
Trigger an updated schedule
----------------------------
In this example, we are planning to consume 200kW for a period of 4h, tomorrow.
In addition, we'll add a time period in which the scheduler won't be able to run the process.
Now we are ready to schedule a process. Let's start with the INFLEXIBLE policy, the simplest. The scheduler
cannot schedule the process after one hour from midnight.
.. code-block:: bash
flexmeasures add schedule for-process --sensor-id 4 --consumption-price-sensor 1\
--start ${TOMORROW}T00:00:00+02:00 --duration PT24H --process-duration PT4H \
--process-power 0.2MW --process-type INFLEXIBLE \
--forbid "{\"start\" : \"${TOMORROW}T00:00:00+02:00\", \"duration\" : \"PT1H\"}"
This policy consist of scheduling the process as soon as possible. That is from 1am to 2am, as the time restriction from 12am to 1am makes the scheduler unable to start at 12am.
Following the INFLEXIBLE policy, we'll schedule the same 4h block using a BREAKABLE policy.
In this other case, will restrict the period from 2pm to 3pm from scheduling any process. This block corresponds to the lowest price of the day.
.. code-block:: bash
flexmeasures add schedule for-process --sensor-id 5 --consumption-price-sensor 1\
--start ${TOMORROW}T00:00:00+02:00 --duration PT24H --process-duration PT4H \
--process-power 0.2MW --process-type BREAKABLE \
--forbid "{\"start\" : \"${TOMORROW}T14:00:00+02:00\", \"duration\" : \"PT1H\"}"
The BREAKABLE policy splits or breaks the process into blocks that can be scheduled discontinuously.
Finally, we'll schedule the process using the SHIFTABLE policy. We'll keep the same time restrictions as in the BREAKABLE process.
.. code-block:: bash
flexmeasures add schedule for-process --sensor-id 6 --consumption-price-sensor 1\
--start ${TOMORROW}T00:00:00+02:00 --duration PT24H --process-duration PT4H \
--process-power 0.2MW --process-type SHIFTABLE \
--forbid "{\"start\" : \"${TOMORROW}T14:00:00+02:00\", \"duration\" : \"PT1H\"}"
.. image:: https://github.com/FlexMeasures/screenshots/raw/main/tut/toy-schedule/asset-view-process.png
:align: center
|
The image above show the schedules following the three policies.
In the first policy, there's no flexibility and it needs to schedule as soon as possible. Meanwhile, in the BREAKABLE policy, the consumption blocks surrounds the time restriction to consume in the cheapest hours. Finally, in the SHIFTABLE the process is shifted to capture the best prices, avoiding the time restrictions.
Loading

0 comments on commit 240f2f9

Please sign in to comment.