Time-of-Use: charge electric vehicle

Dear community,

I am sharing some improvements to the time-of-use-tariff optimization with you. The new implementation is now able to schedule charging of an electric vehicle during cheapest hours.

I am merging the code to next release, so testing is easy. See changes here:

The implemented use-case is as follows:

  • Plug the car to the charging station
  • Charging will be scheduled so that the car charges the configured energySessionLimit (or 30 kWh if none is configured) till next day 7 am
  • This use-case follows the idea, that sufficient energy should be charged for the next commute to office.

To test the implementation:

  • Use latest develop branch (or Release 2025.1.0)
  • Configure _energy component version = V2_ENERGY_SCHEDULABLE
  • Configure ctrlEvcs0 component to smartMode = true
  • Restart OpenEMS
  • Plug the car to the charging station
  • Give the Optimizer some time to calculate a proper schedule. It should calculate a bad version immediately and it will improve on every full 15-minutes.
  • The Schedule is printed in the console log and can be visualized in the EVCS Modal in UI:

The PR lists some known bugs and TODOs:

  • KEBA SessonEnergy:
    • The way the KEBA charging station handles the SessionEnergy causes the above use-case to fail on the second day.
    • Fix will come in a separate PR; for now simply increase the session-energy slightly in the Controller every day
  • JSCalendar
    • Currently “7am on every day” is hardcoded (see TARGET_HOUR)
    • In future the smartConfig configuration option will be used to hold a JsonArray compatible with JSCalender (RFC 8984).
    • This will allow configuring any kind of event, e.g. “charge 15 kWh till 7 am on weekdays”; “charge 40 kWh on sundays”. See JSCalendarTest for examples.
  • InitialPopulation
    • the InitialPopulation is a manually defined schedule that the Optimizer uses as the immediate “best result” and as start for its search through the solution space.
    • Future improvements here will give faster better results. See InitialPopulation

I am looking forward to reading your feedback and test results. Thanks in advance!

Happy new year 2025!

2 Likes