knitr::opts_chunk$set(echo = FALSE) colorize <- function(x, color) { if (knitr::is_latex_output()) { sprintf("\\textcolor{%s}{%s}", color, x) } else if (knitr::is_html_output()) { sprintf("<span style='color: %s;'>%s</span>", color, x) } else x }
This article wants to define the optimization problem corresponding to a smart charging scenario for electric vehicles. The smart charging concept is widely used in different fields and applications. In this case, we define smart charging as a tool to coordinate individual EV charging sessions in order to obtain the optimal aggregated demand profile according to a certain objective. There are different practical strategies to coordinate each session, such as postponing sessions, reducing the charging power or the total energy charged, a combination of several strategies, etc. Currently, {evflex}
package only supports postpone strategy.
The main goals of the EV demand optimization performed with {evflex}
package are:
These variables will be represented with the following nomenclature:
The formulation of the problem is depicted by Equation \@ref(eq:opt-objective):
\begin{equation} min \sum_{t=1}^{T} w_1 (R_t-L_t-O_t)^2 + w_2 (V_t - O_t)^2 (#eq:opt-objective) \end{equation}
The first term represents the energy exchanged with the distribution grid since it is a subtraction between the renewable energy generation and the EV demand (both flexible and static). This subtraction is squared to highly peak values. Thus, minimizing this term corresponds to avoid the difference between renewable generation and EV demand on one hand, and peak shaving on the other hand.
The second term represents the difference between the original flexible EV demand and the final flexible EV demand modulated by the optimization algorithm. The difference is squared too in order to avoid negative values. Minimizing this term corresponds results in less changes to the original EV sessions schedule. It could be interesting for the charging point operator when every sessions postponed represents an economic cost.
Both terms have a corresponding weight parameter ($w_1$ and $w_2$) to customize the optimization result according to a defined interest. Increasing $w_1$ over $w_2$ would result to a more energy-focused optimization while probably higher values of $w_2$ over $w_1$ would correspond to a more practical approach.
If we develop the objective formula in Equation \@ref(eq:opt-objective) we obtain:
\begin{equation} min \sum_{t=1}^{T} w_1 (R_t² + L_t² + O_t² - 2 R_t L_t + 2 L_t O_t - 2 O_t R_t) + w_2 (V_t² - 2 V_t O_t + O_t²) (#eq:opt-objective-2) \end{equation}
\begin{equation} min \sum_{t=1}^{T} w_1 R_t L_t (R_t + L_t - 2) + O_t² (w_2 + w_1) + 2 O_t (w_1 L_t - w_1 R_t - w_2 V_t) + w_2 V_t² (#eq:opt-objective-3) \end{equation}
Now we can discard the constant terms of the equation since they don't produce any difference in the final result to minimize. Therefore, the final optimization problem equation is depicted in Equation \@ref(eq:opt-equation):
\begin{equation} min \sum_{t=1}^{T} O_t² (w_2 + w_1) + 2 O_t (w_1 L_t - w_1 R_t - w_2 V_t) (#eq:opt-equation) \end{equation}
The optimization constraints depend of each study case and, in this case, it is a smart charging scenario considering postpone strategy. Therefore, our objective function in Equation \@ref(eq:opt-equation) will be constrained to Equations \@ref(eq:opt-constraint-energy), \@ref(eq:opt-constraint-foreshift) and \@ref(eq:opt-constraint-positive):
\begin{equation} \sum_{t=1}^T O_t \Delta t = E (#eq:opt-constraint-energy) \end{equation}
\begin{equation} \sum_{t=1}^U O_t \Delta t \le \sum_{t=1}^U V_t \Delta t \quad U = 1, 2, \dots, T (#eq:opt-constraint-foreshift) \end{equation}
\begin{equation} O_t \ge 0 \quad t \in T (#eq:opt-constraint-positive) \end{equation}
The form of our optimization problem corresponds to Quadratic programming formulation, described in Equation \@ref(eq:cvx-formulation):
\begin{equation} \begin{array}{ll} \text{minimize} & \mathrm (1/2) x^\top \mathrm P \, \mathrm x + \mathrm q^{\top} \mathrm x \ \text{subject to} & \mathrm G \mathrm x \leq \mathrm h \ & \mathrm A \mathrm x = \mathrm b \end{array} (#eq:cvx-formulation) \end{equation}
To handle this type of optimization problem, the optimization engine used in {evflex}
package is the CVXOPT Python package.
In this section, the demonstration of the smart charging algorithm has considered a set of sessions simulated by {evsim}
package and the models built with package {evprof}
. Figures \@ref(fig:opt1) - \@ref(fig:opt5) show the significant differences in the optimal setpoint definition taking into account different weights for the optimization objectives. Following the same nomenclature exposed in the previous sections, $w_1$ is the weight of Energy optimization (i.e. minimize the energy exchanged with the distribution grid) and $w_2$ is the weight of Cost optimization (i.e. minimize the difference between the original and optimal flexible EV demand).
In Figures \@ref(fig:opt1) - \@ref(fig:opt5) we see the following variables:
r colorize("(Orange)", "orange")
r colorize("(Blue)", "blue")
r colorize("(Dashed green)", "green")
r colorize("(Green)", "green")
knitr::include_graphics('figures/1-0.png')
knitr::include_graphics('figures/0.75-0.25.png')
knitr::include_graphics('figures/0.5-0.5.png')
knitr::include_graphics('figures/0.25-0.75.png')
knitr::include_graphics('figures/0-1.png')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.