1

I want to find a charging schedule that minimize cost of charging an EV.

The main objective is to have a fully charged car for the next morning, but the sub objective is to minimize cost based these two things combined:

  1. Charge when electricity is cheapest - I know the hourly electricity price for the next 24 hours
  2. Minimize hourly peak demand charges for the household - I pay a small additional fee each month if my hourly demand exceed different steps.

I know the power size of the charger (W), the capacity of the car battery (Wh), how many hours I have to charge (h), I know what my household peak is right now (W), and all prices for both consumption (Money/Wh) and peak demands (xx Money, if hourly demand > xxxx Wh).

  • What would one call this type of minimization problem?
  • How would one go forward to solve this?
  • Is there a python package that can help me solve this? (I have seen similar problems been solved with Gurobi)
  • Could you please explain what did you mean by Charge when electricity is cheapest - I know the hourly electricity price for the next 24 hours? –  Oct 18 '21 at 15:08
  • 2
    @DarshanPatil: this should be self-explanatory... Electricity costs different amounts based on the time of day. The OP wants to find the cheapest hours of the day and (re)charge the vehicle during those time periods. – abiessu Oct 18 '21 at 15:12
  • 1
    @DarshanPatil - Consumption price where I live vary from hour to hour. Its usually more expensive when people get home from work, and cheaper during night. I have an array of 24 items containing the exact prices for the next 24 hours.

    Finding the cheapest hour and charging at that hour is pretty easy - but I also have to consider the power peak this creates. When demanding a lot of power at the same time I have to pay more. I want to find the best charging schedule to minimize consumption cost and demand peak costs combined.

    – NorwegianClassic Oct 18 '21 at 15:42
  • @abiessu - What about the "demand peak" objective, is it understandable? Do you know the name of this type of problem? – NorwegianClassic Oct 18 '21 at 15:44
  • You can plot electricity rate vs time and let as per the consumption/requirement you'll need to charge for (t)hrs/day now try to get the minimum area under the curve. (Though it's uncertain what to do on the last day of the month) –  Oct 18 '21 at 16:03

1 Answers1

1

Let me give you a starting point. The decision variables will be $SoC(t)$ (the state-of-charge of EV battery at time $t$, in %) and $P(t)$ (charging power set-point at time $t$, in kW), where $t \in T$, and $T=\{1,2.,, t_{end}\}$ is the charging horizon.

Perhaps the most important constraints are the state-of-charge dynamics, which are given by:

$SoC(t) = SoC(t-1)+\frac{\Delta T}{Cap}\eta P(t), \forall t \in T-\{1\}$

where $\Delta T$ is the discrete time step size (usually taken as 5 min... 1 hour), $Cap$ is the battery capacity in kWh, $\eta$ is the grid-to-battery efficiency (usually between 90%-98%, and can be assumed constant for simplicity). Note that $SoC(1)$ is the initial state-of-charge, and must be given as a data.

Other constraints can be upper/lower bounds on $SoC(t)$ and $P(t)$, depending on the charging needs and EV/battery/supply equipment technical limits.

The objective function is the total cost of electricity, which consists of two parts: energy charges (charged per kWh) and demand charges (charged per kW according to the monthly peak). The former is easy to formulate:

$\text{Energy charges} = \sum_{t \in T} c(t)P(t)\Delta T$

where $c(t)$ is the (known) energy charge at time $t$, given in $\$/kWh$. I will leave the formulation of demand charges to you.

As you can see, if you are only concerned with the energy charges, the problem can be cast as an LP (of course, with some assumptions).

I strongly suggest you to have a look at https://ev.caltech.edu/ , where you will find tons of interesting data, papers, and a Python-based simulation platform for EV charging scheduling.

cbs
  • 303
  • Thanks @cbs, much appreciated! This really pushed me towards the right direction. I used the PuLP package for python and was able to create a schedule that minimized cost based on energy charges - however when I started to look into the demand charge part of the function it got harder. Since we add an additional fee for every demand step, won't this be non-linear and a problem possible to solve with LP? This demand step isn't a constrain right? - its part of the objective? – NorwegianClassic Oct 20 '21 at 14:12
  • Demand charge should be indeed a part of the constraint. However, due to the complicated structure of demand charges, it is hard to come up with an exact representation for it to specify an objective function. It is even more challenging to simultaneously minimize the energy and demand charges. One of the reasons is that the demand charges are billed according to the "monthly" peak, while the optimization control horizon is a "day". What people generally do is to "indirectly" minimize the demand charges by minimizing the "load variance". – cbs Oct 20 '21 at 17:07
  • Let $P_{load}(t)$ be the "base load" (e.g., the household load), $P(t)$ is the charging power. Load variance is defined as:

    $\sum_{t} (P(t) + P_{load}(t) - P_{avg})^2$

    where $P_{avg} = \frac{1}{card(T)}\sum_{t} ( P(t) + P_{load}(t) )$.

    Selecting load variance as the objective makes the problem a quadratic programming problem. Minimizing load variance will "flatten" the load profile, which definitely helps to reduce the demand charges but there is no one-to-one mapping between demand charges and load variance.

    – cbs Oct 20 '21 at 17:08
  • 1
    I wrote "Demand charge should be indeed a part of the constraint" where I meant part of the "objective". – cbs Oct 20 '21 at 17:13
  • Thanks again cbs. Great points you're bringing up, maybe minimize load is enough. However, I was hoping to model the demand charge, and the scipy optimize minimize package seems to be able to take in a custom function with many if's and what not in it. Wouldn't that be possible? – NorwegianClassic Oct 21 '21 at 08:59
  • 1
    With some careful thinking and experimenting, I am sure it will be possible. I am just noting that there isn't any straight-forward way, at least to the best of my knowledge. – cbs Oct 21 '21 at 09:06
  • Btw, why is SOC so important? It seems like I was able to solve this without using SOC and the dynamics of it. I only used $p(t_i)$ (power of charger at hour $i$) as decision variables and this as a constraint: $(p(t_1)+p(t_2)+p(t_2)+p(t_3)+...) * \eta = 15000 W/h$ Am I missing something here? – NorwegianClassic Oct 29 '21 at 07:47