|
4 | 4 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
5 | 5 | ############################################################################# |
6 | 6 | # Solving an decision hazard battery storage problem using multiprocessed |
7 | | -# dynamic programming : |
8 | | -# We manage a network connecting an electrical demand, |
9 | | -# a renewable energy production unit, a battery and the global network. |
10 | | -# We want to minimize the cost of consumed electricity until time T: \sum_{t=0}^T c_t * G_{t+1}. |
11 | | -# We assume electrical demand d_t as well as cost of electricity c_t deterministic |
12 | | -# We decide which quantity to store before knowing renewable energy production |
13 | | -# but we don't waste the eventual excess. |
14 | | -# If more energy comes, we store the excess up to the state of charge upper bound. |
15 | | -# The remaining excess is provided directly to the demand or wasted if still too important. |
16 | | -# We have to ensure supply/demand balance: the energy provided by the network G_{t+1} |
17 | | -# equals the demand d_t plus the battery effective demand or minus the battery effective |
18 | | -# production U_{t+1} then minus the used renewable production xi_{t+1} - R_{t+1]. |
19 | | -# R_{t+1] is the renewable energy wasted/curtailed |
20 | | -# U_{t+1} is a function of the decision variable: the amount of energy decided |
21 | | -# to store or discharge u_t before the uncertainty realization. |
22 | | -# We forbid electricity sale to the network: G_t+1 >=0 . |
23 | | -# This inequality constraint can be translated on an equality constraint on R_{t+1} |
24 | | -# Min E [\sum_{t=1}^T c_t G_{t+1}] |
25 | | -# s.t. s_{t+1} = s_t + U_{t+1} |
26 | | -# G_{t+1} = d_t + U_{t+1} - (W_{t+1} - R_{t+1}) |
27 | | -# U_{t+1} = | rho_c * min(S_{max} - S_t, min( u_t ,W_{t+1})), if u_t >=0 |
28 | | -# | (1/rho_dc) * max(u_t, -max( d_t - W_{t+1}, 0)), otherwise |
29 | | -# R_{t+1} = max(W_{t+1} - d_t - U_{t+1}, 0) |
30 | | -# s_0 given |
31 | | -# s_{min} <= s_t <= s_{max} |
32 | | -# u_min <= u_t <= u_max |
33 | | -# u_t choosen knowing xi_0 .. xi_{t-1} |
34 | | -############################################################################# |
| 7 | +# dynamic programming. |
| 8 | +# |
| 9 | +# to launch (with N processes) |
| 10 | +# $ julia -p N battery_storage_parallel.jl |
| 11 | +# |
| 12 | +# PROBLEM DESCRIPTION |
| 13 | +# For t = 1..T, we want to satisfy a deterministic energy demand d_t using: |
| 14 | +# - a random renewable energy unit with production (at time t) W_t |
| 15 | +# - a battery with stock (at time t) S_t |
| 16 | +# - a quantity G_{t} bought on the market for a deterministic price c_t |
| 17 | +# The decision variable is the quantity U_t of energy stored (or discharged) in |
| 18 | +# the battery, is decided knowing the uncertainty W_0,...,W_t. |
| 19 | +# We want to minimize the money spent on buying electricity (cost are deterministic) : |
| 20 | +# min E[\sum_{t=0}^T c_t * G_{t}] |
| 21 | +# d_t + U_t <= W_t + G_t (a) |
| 22 | +# S_{t+1} = S_t + r (U_t)^+ + 1/r (U_t)^- (b) |
| 23 | +# Smin <= S_t <= Smax (c) |
| 24 | +# G_t >= 0 (d) |
| 25 | +# |
| 26 | +# (a) : more production than demand (excess is wasted) |
| 27 | +# (b) : dynamic of the stock with a charge coefficient r |
| 28 | +# (c) : limits on the battery |
| 29 | +# (d) : we don't sell electricity |
| 30 | + |
| 31 | + |
| 32 | + |
35 | 33 |
|
36 | 34 | import StochDynamicProgramming, Distributions |
37 | 35 | println("library loaded") |
|
0 commit comments