程序代写代做代考 graph algorithm Mini Project 4

Mini Project 4
Valuing a Battery on the Electricity Market
Author: Dr. Paul Johnson, Paul.Johnson-2@manchester.ac.uk
In this project we study the solution of parabolic partial differential equations used to model electricity storage on a deregulated energy market. As governments around the world commit to increase the level of renewable energy they produce, wind power has come to the forefront as one of the most viable options. However, wind power does not come without its problems. Due to the intermittent nature of the wind, we may have a situation where the wind blows at the wrong time causing the electricity generated to be discarded. An obvious solution would seem to be the installation of batteries alongside the generators to store energy when there is a surplus so that it may be released when there is a deficit. There are many reasons (beyond the scope of this project) as to why this is not currently economically viable on a large scale in the UK, but non the less it will become important in the future as more and more energy is generated using wind. The simplified problem in this project investigates the value of installing a battery alongside a wind power generator in order to take advantage of a surplus in production to meet commitments if there is a deficit in production.
The structure of the project is as follows: in the first section you will learn how to solve the heat diffusion equation using some objects to simplify storage, then in the second section you will apply it to the full problem and investigate the resulting solutions. You are then offered a choice of extensions to the problem to investigate further.
4.1 Parabolic PDEs
One of the simplest parabolic PDEs is the heat diffusion equation which in one space dimension is
∂u = κ∂2u. (1.1) ∂t ∂x2
valid in the region a ≤ x ≤ b where κ is some given constant. 25

26
MINI PROJECT 4.
t
In the figure to the right we show the region R in which the PDE (1.1) must be satisfied. The function u must be specified both at the bound- ariesx=aandx=b,andalsoatt=0. Thisis shown by the dashed line S.
Consider the diffusion equation for the function u(x, t) given by u(x=0,t)=0, u(x=1,t)=1, u(x,t=0)=1.
BATTERY STORAGE
S
x
We need to find the solution of (1.1) for t > 0.
There are a number of different schemes which could be used to solve (1.1).
Explicit scheme
We may approximate (1.1) by
uk+1 −uk �uk −2uk +uk � i i=κi+1 i i−1.
Δt Δ2x
(1.2)
Here uki denotes an approximation to the exact solution u(x, t) of the PDE at x = xi = iΔi = i/N , and t = tk = kΔt. Here then i indexes our position in space an k our position in time. The scheme given in (1.2) is first order accurate in time O(Δt) and second order accuratein space O(Δy)2. The scheme (1.2) is explicit because the unknowns at level k + 1 can be computed directly from known values at level k.
Fully implicit, first order
Another approximation is one which makes use of an implicit scheme. Then instead of (1.2) we
have
uk+1 − uk �uk+1 − 2uk+1 + uk+1 �
i i =κ i+1 i i−1 . (1.3)
Δt Δ2x
The unknowns at level k + 1 are coupled together and we have a set of implicit equations to solve.
00 and Q=Qmax . (2.10)
X dt otherwise
This says that the battery cannot discharge if already empty, or charge if already full. Further, if X < 0 (and Q > 0), then we have a deficit of energy and we may sell the energy discharged |dQ| onto the market at the price p. Then the change in value of our option over an instant is given by
dV =−pmin(dQ,0). (2.11)
Then by using Itˆo’s lemma and combining equations (2.9), (2.10) and (2.11) it can be shown (see Howell et al. (2011)) that the net present value of the battery is described by the following
PDE:
subject to the conditions
X∂V +1σ2∂2V −rV−pmin(X,0)=0 ∂Q 2 ∂X2
V=0 asX→∞ V=pQ asX→−∞
(2.12)
1σ2∂2V−rV=0 if X<0 and Q=0 2 ∂X2 1σ2∂2V−rV=0 if X>0 and Q=Qmax 2 ∂X2
Now in order to solve the PDE we must divide the domain into two regions (see figure 4.1), one (X ≤ 0 or A) in which we can solve upwards, and the other (X ≥ 0 or B) in which we can solve downwards. Along the boundary X = 0 the solutions must be matched.
Fully implicit scheme
Let us discretise the problem so that
Xi = (i − N)ΔX ΔX = X∞ Qj = jΔQ ΔQ = Qmax
where
andthevaluefunctionvi,j =V(Xi,Qj).
NM
0 ≤ i ≤ 2N and 0 ≤ j ≤ M

4.2. BATTERY STORAGE MODEL
29
Q
A
B
X
Figure 4.1: The domain and boundaries on which the PDE must be solved.
The fully implicit method we propose to solve this problem is an iterative scheme where we
solve in the region A using a guess for the solution in B, and then solve in the region B using a
guess for the solution in A. So to complete one iteration involves sweeping across A and then B.
We use q to denote the value at the qth iteration, or vq , and q + 1/2 indicates we are halfway
through one iteration.
Region A
Then the scheme for v in the region A is as follows. Firstly, when j = 0 and 0 < i < N we have 1 vq+1/2 − 2vq+1/2 + vq+1/2 σ2 i−1,0 i,0 i+1,0 − rvq+1/2 = 0. 2 Δ2 i,0 X and then on the boundary for j = 0 we get vq+1/2 = 0, vq+1/2 − �2 + rΔ2X � vq+1/2 = −vq . 0,0 N−1,0 1σ2 N,0 N+1,0 (2.13) i,j (2.14) Here we must guess the value of the system where i > N, hence the q and this guess should
2
simply be the most up-to-date value. The unknown values vq+1/2 must be found.
i,0 NextifweareinthedischargingregionAthenwehave0 j ≥ 0 and N < i < 2N and the (2.19) scheme is vq+1 − vq+1 1 vq+1 − 2vq+1 + vq+1 Xi i,j+1 i,j + σ2 i−1,j i,j i+1,j − rvq+1 = 0. ΔQ 2 Δ2 i,j X If we rearrange (2.20) with κi = σ2ΔQ/(2XiΔ2X) and ρi = rΔQ/Xiwe have κivq+1 −(1+2κi +ρi)vq+1 +κivq+1 =−vq+1 , N j ≥ 0. So long as we solve for j = M first we can then move downwards from j = M − 1
down to j = 0 treating the right hand side of the equations as knowns (vq+1 ). i,j +1
In order to fully solve the problem you must iterate until your solution has converged, or vq+1 =vq foralliandj.
i,j i,j
4.3 Report
You should prepare a report in the form of a continuous piece of prose that describes the problem and your solution to it. In particular, you should include the following:
• A brief analysis of the heat diffusion equation, demonstrating both the solution and grid dependence of each scheme given the problem defined in section 4.1.2.
• Choosing the following parameters, X∞ = 25, Qmax = 1, σ = 0.5, r = 0.01, and p = 1, solve the battery storage problem. Try using different grids by varying N and M. Provide a accurate graph of V (X, 0) and V (X, Qmax) for these chosen parameters.
• Describe how you evaluate when your solution has converged.
• Try to vary both σ and r. How does it affect your boundary conditions? Plot out different
different types of solution that you see.
Depending on how well the project goes, you might also try the following:
• Create a “Storage” class to solve the problem and store all of the parameters and the solution. You may try to include functions to set boundary conditions, and the form of the PDE we solve. You may also look to write a function to setup the problem, solve the problem and output the results to file.

BIBLIOGRAPHY 31 • Adding mean reversion to the SDE (2.9) the PDE becomes
X∂V +1σ2∂2V −αX∂V −rV −pmin(X,0)=0 (3.23) ∂Q 2 ∂X2 ∂X
subject to the conditions
∂V−α∂V=p ∂Q ∂X
∂V−α∂V=0 ∂Q ∂X
as X→−∞
as X→+∞
if X<0 and Q=0 if X>0 and Q=Qmax
Try to solve this problem with α = 0.1. Investigate how the solution changes, with respect
to the value of the system and also the position of the boundary conditions.
Bibliography
S.D. Howell, P.W. Duck, P.V. Johnson, H. Pinto, G. Strbac, A. Hazel, N. Proudlove, and M. Black. A PDE System for Modelling Stochastic Storage in Physical and Financial Sys- tems. IMA Journal of Management Mathematics, 22(3), 2011.
G. D. Smith. Numerical Solution of Partial Differential Equations. Oxford University Press, 1985.
1σ2∂2V −αX∂V −rV =0 2∂X2 ∂X
1σ2∂2V −αX∂V −rV =0 2∂X2 ∂X