Problem 4.2

Problem 4.2#

Integrated Energy Grids

Problem 4.2

This is a continuation of Problem 3.2 from Lecture 3.

a) Assuming that the reactance in the links is \(x_l\)=1, calculate the Power Transfer Distribution Factor (PTDF) matrix

We will use the package numpy to operate with matrices.

import numpy as np
import numpy.linalg

Calculate list of nodes, links, degree, adjacency and Laplacian matrix. (this was already implemented in Problem 3.2)

nodes=[0,1,2,3,4]
links=[(0,1), (1,2), (1,3), (1,4), (2,4)]
D = np.zeros((len(nodes), len(nodes)))

for node in nodes:
    D[node, node] = sum([1 if node in link else 0 for link in links])
A = np.zeros((len(nodes), len(nodes)))

for node_a, node_b in links:
    A[node_a, node_b] = 1
    A[node_b, node_a] = 1
L = D - A
L
array([[ 1., -1.,  0.,  0.,  0.],
       [-1.,  4., -1., -1., -1.],
       [ 0., -1.,  2.,  0., -1.],
       [ 0., -1.,  0.,  1.,  0.],
       [ 0., -1., -1.,  0.,  2.]])
K = np.zeros((len(nodes),len(links)))

for i, (node_a, node_b) in enumerate(links):
    K[node_a,i] = 1
    K[node_b,i] = -1
    
K
array([[ 1.,  0.,  0.,  0.,  0.],
       [-1.,  1.,  1.,  1.,  0.],
       [ 0., -1.,  0.,  0.,  1.],
       [ 0.,  0., -1.,  0.,  0.],
       [ 0.,  0.,  0., -1., -1.]])

The PTDF matrix measures the sensitivity of power flows in each transmission line relative to incremental changes in nodal power injections or withdrawals throughout the electricity network.

\[p_\ell = \frac{1}{x_\ell}\sum_{i,j} K_{i\ell} (L^{-1})_{ij} p_j\]
\[p_\ell = \sum_j \text{PTDF}_{\ell j} p_j\]

The Power Transfer Distribution Factor (PTDF) matrix can be calculated as \(PTDF_{li}=K_{il}(L^{-1})_{ij}\)

PTDF=K.T.dot(np.linalg.pinv(L))
PTDF
array([[ 8.00000000e-01, -2.00000000e-01, -2.00000000e-01,
        -2.00000000e-01, -2.00000000e-01],
       [ 2.00000000e-01,  2.00000000e-01, -4.66666667e-01,
         2.00000000e-01, -1.33333333e-01],
       [ 2.00000000e-01,  2.00000000e-01,  2.00000000e-01,
        -8.00000000e-01,  2.00000000e-01],
       [ 2.00000000e-01,  2.00000000e-01, -1.33333333e-01,
         2.00000000e-01, -4.66666667e-01],
       [ 2.77555756e-17,  4.16333634e-17,  3.33333333e-01,
         0.00000000e+00, -3.33333333e-01]])

b) Assuming the power injection pattern described in Problem 4.1 determine the flows in the lines of the network and plot them.

The power flows \(p_l\) in the lines of the network can be determined knowing the power injection pattern for the nodes \(p_i\) and the PTDF matrix.

\(p_l=PTDF_{li}p_i\)

p_i=[-2, 5, 6, -8, -1]
p_l=PTDF.dot(p_i)
p_l
array([-2.        , -3.66666667,  8.        , -1.33333333,  2.33333333])