EE 364A CONVEX OPTIMIZATION I - Stanford University. Final March 2022. Data File: https://web.stanford.edu/~boyd/cvxbook/cvxbook_additional_exercises/ Electric vehicle charging. A group of N electric vehicles need to ch
...
EE 364A CONVEX OPTIMIZATION I - Stanford University. Final March 2022. Data File: https://web.stanford.edu/~boyd/cvxbook/cvxbook_additional_exercises/ Electric vehicle charging. A group of N electric vehicles need to charge their batteries
over the next T time periods. The charging energy for vehicle i in period t is given
by ct;i ≥ 0, for t = 1; : : : ; T and i = 1; : : : ; N. In each time period, the total charging
energy over all vehicles cannot exceed Cmax, i.e., PN i=1 ct;i ≤ Cmax for t = 1; : : : ; T.
The state of charge for vehicle i in period t is denoted qt;i ≥ 0. The charging dynamics
is
qt+1;i = qt;i + ct;i; t = 1; : : : ; T; i = 1; : : : ; N:
Note that qt;i is defined for t = T + 1. The initial vehicle charges q1;i are given. The
charging energy and state of charge are given in kWh (kilowatt-hours).
The vehicles have different preferences for how much charge they acquire over time.
This is expressed by a target minimum charge level over time, given by qt;i tar 2 R+, t =
1; : : : ; T + 1. These are nondecreasing, i.e., qttar +1;i ≥ qt;i tar for t = 1; : : : ; T, i = 1; : : : ; N.
The charging shortfall in period t for vehicle i is given by
st;i = (qt;i tar − qt;i)+; t = 1; : : : ; T + 1; i = 1; : : : ; N;
where (a)+ = maxfa; 0g. Our objective is to minimize the mean square shortfall, given
by
S = 1
(T + 1)N
T +1
X t
=1
NX i
=1
s2
t;i:
This is the same as minimizing the root-mean-square (RMS) shortfall, given by pS
(which has units of kWh).
Explain how to solve the problem using convex optimization, and solve the following
problem instance. We have N = 4 vehicles, T = 90 time periods, and Cmax = 3.
The initial charges q1;i are 20, 0, 30, and 25, respectively. The target minimum charge
profiles have the form
qt;i tar = T + 1 t γi qides; t = 1; : : : ; T + 1; i = 1; : : : ; N;
with γ values 0:5; 0:3; 2:0; 0:6 and qides values 60; 100; 75; 125. Note that qides gives the
final value of the target minimum charge level for vehicle i, and the parameter γi sets
the ‘urgency’ of charging, with smaller values indicating more urgency, i.e., a target
minimum charge value that rises more quickly.
(With the charges all given in kWh, and the time period 5 minutes, these values are
all realistic. The total charging period is 7.5 hours, and the maximum charging of
3kWh/period corresponds to a real power of 36kW. And no, you do not need to know
or understand this to solve the problem.)
Give the optimal RMS shortfall, i.e., the squareroot of the optimal objective value.
Plot the target minimum charge values and optimal state of charge for each vehicle,
2with dashed lines showing the target and solid lines showing the optimal charge. Plot
the optimal charging energies ct;i over time in a stack plot.
Constant charging. Compare the optimal charging above to a very simple charging
policy: Charge each vehicle at a constant energy per period, proportional to qides −q1;i,
i.e.,
ct;i = θiCmax; i = 1; : : : ; N; t = 1; : : : ; T;
with
θi = PN j=1 qides (qjdes − q−1;iq1;j); i = 1; : : : ; N:
Give the associated RMS shortfall, and the same plots as above.
Plotting hints. In Python, a basic stack plot is obtained with
import matplotlib.pyplot as plt
plt.stackplot(rr, y.T)
where rr is a range object (like range(a, b)) with len(list(rr)) == n and y is an
n × N NumPy array.
In Julia, a basic stack plot is obtained with
using Plots
areaplot(rr, y)
where rr is a range object (like a:b) and y is an n × N MatrixfFloat64g object, with
n = b − a + 1.
For those using Julia, you’ll be better off using the solver ECOS, and not SCS or
OSQP.
[Show More]