Community
OpenEnergyMonitor

Community

Emoncms Demand Shaper module


(Trystan Lea) #1

The emoncms demand shaper module uses a day ahead forecast and user set schedules to determine the best time to run household loads. An example could be charging an electric car, the user enters a desired completion time and charge duration, the demand shaper module then works out the best time to charge the car, generally there will be higher power availability overnight and during sunny midday hours. The demand shaper attempts to avoid running appliances at peak times while ensuring that the appliance has completed the required run period.

The demand shaper supports the following forecasts:

  • UK Grid Carbon Intensity forecast
  • Agile Octopus tariff forecast
  • EnergyLocal power availability forecast

Github: https://github.com/emoncms/demandshaper

See extended discussion on demand side response here: OpenEnergyMonitor Demand Side Response Development

See the github repository readme for the installation guide and requirements.

The demand shaper process publishes the device state to an MQTT topic of the form:

emon/devicename/state

Which is picked up by the smart plug. The EmonEVSE will listen for start & end time schedule updates rather than regular on/off state updates - work still in progress.

There are a number of interesting elements that happen behind the scene when the demand shaper module is used in conjunction with the latest emoncms & device module and EmonESP firmware for the Sonoff S20. I have copied in the guide for using the demand shaper module with the sonoff s20 plug from the readme here for illustration. Note the sections “What happened here?” :slight_smile:

Using the Demand Shaper module with a SonOff S20 smart plug

Preperation

  1. Install the EmonESP (control_merge branch) firmware on a Sonoff S20 smartplug. See guide here:
    https://github.com/openenergymonitor/EmonESP/blob/control_merge/sonoffS20.md

  2. Enable the UDP broadcast script on the emonbase/emonpi:

    crontab -e
    * * * * * php /home/pi/emonpi/UDPBroadcast/broadcast.php 2>&1
  1. Install the demand shaper module as above and make sure that you have the latest emoncms master branch and latest emoncms device module installed.

User guide

  1. The Sonoff S20 smartplug creates a WIFI access point, connect to the access point and enter home WIFI network. That is all the configuration required.

  1. Connect back to your home WIFI network. Login to emoncms and navigate to inputs. Refresh the page until a popup appears asking to connect:

What happened here?: The smart plug discovers the emonbase/emonpi automatically by listening out for the periodic UDP packet published by the emonbase/emonpi, enabled by the UDP broadcast script.

  1. After clicking allow the smart plug will then appear in the inputs list with a small icon identifying it as a schedulable device:

What happened here?: The smart plug received the MQTT authentication details from the emonbase/emonpi automatically as part of a pairing process enabled by clicking on Allow. After connecting to MQTT the smartplug sent a descriptor message that automatically created and configured an emoncms device based on the smartplug device template in the emoncms device module.

  1. Click on the clock icon to load the demandshaper module, where the smart plug can be scheduled:

  1. Wait for the plug to turn on! :slight_smile:

We are using these developments in the EnergyLocal smart grid project and much of the above was completed last year. The main new additions are the support of the Octopus Agile tariff forecast and UK grid carbon intensity forecast which starts to make this module useful on a wider basis.


OpenEnergyMonitor Development Plan Outline
OpenEnergyMonitor Demand Side Response Development
2018 Development Progress Update
(Craig Fryer) #2

From my experience, the cloud cover forecasts compared to what is actually generated and when can be very different. Note I am referring to SE Queensland (Australia), so different forecasts. Even so I find it very challenging. I have tried using sky observing cameras, satellite images (30 minute delay) and the cloud cover forecasts. To date I have only achieved load matching with a level of priority.

I hope this module works out well.


(Trystan Lea) #3

Thanks @whatsupskip yes I imagine that integrating local weather forecasting will be the harder challenge :slight_smile: this is a longer term goal for the module with the use of available forecasts (carbon intensity, octopus agile) the primary starting point.

Do you have any examples of the differences in forecast and actual (both good and bad)? What forecast service did you use?

Could you elaborate on, sounds interesting:


(Trystan Lea) #4

Making progress on the demand shaper module development.

In particular section 5, bullet point 3 & 4 from: OpenEnergyMonitor Development Plan Outline

  • automated and regular schedule recalculation to attempt to improve schedule timing based on newer forecasts.
  • re-scheduling of schedules in progress, take into account time already run and time left to run in re-scheduled run period.

This is now implemented and in testing. I have been using the module to charge my EV via an EmonEVSE, setting the schedule every evening, e.g ready for 8am, charge for 1 or 2 hours. The module then finds the best time and reschedules multiple times as more up to date forecasts from the UK grid carbon API become available.

image

To enable this I have added OpenEVSE support to the module using the $ST set charge period command. Here’s an example log of the schedule recalculation through the night:

2018-12-04 23:08:00 emon/openevse/rapi/in/$ST 6 0 7 30
2018-12-05 00:09:00 emon/openevse/rapi/in/$ST 4 0 5 30
2018-12-05 01:09:00 emon/openevse/rapi/in/$ST 4 30 6 0
2018-12-05 02:09:00 emon/openevse/rapi/in/$ST 5 0 6 30
2018-12-05 03:09:00 emon/openevse/rapi/in/$ST 5 30 7 0
2018-12-05 04:09:00 emon/openevse/rapi/in/$ST 6 0 7 30

It just so happens that the adjustments ended up coming back to the original schedule in this example, but that’s unusual.

Screenshot of schedule created last night and resulting charge this morning:

There is also a new sidebar menu and a link in the emoncms Extra’s menu to the demand shaper: