calcul des puissances de ligne
This commit is contained in:
parent
22d5ce1c88
commit
01ba4fa13b
1 changed files with 49 additions and 5 deletions
|
@ -14,7 +14,7 @@ def connect_Y(x, y, Ys, Yp, Y):
|
||||||
Y[x, x] += Ys + Yp
|
Y[x, x] += Ys + Yp
|
||||||
Y[y, y] += Ys + Yp
|
Y[y, y] += Ys + Yp
|
||||||
|
|
||||||
def spec(n, Y, Vn):
|
def system_matrix(n, Y, Vn):
|
||||||
S = np.zeros((n, n))
|
S = np.zeros((n, n))
|
||||||
for i in range(n):
|
for i in range(n):
|
||||||
for k in range(n):
|
for k in range(n):
|
||||||
|
@ -25,6 +25,35 @@ def spec(n, Y, Vn):
|
||||||
S[i, k] *= Vn**2 * Y[i, k]
|
S[i, k] *= Vn**2 * Y[i, k]
|
||||||
return S
|
return S
|
||||||
|
|
||||||
|
def line_coor(n):
|
||||||
|
tab = []
|
||||||
|
i = 0
|
||||||
|
k = 1
|
||||||
|
while i < n:
|
||||||
|
|
||||||
|
while k < n:
|
||||||
|
tab += [[i, k]]
|
||||||
|
k += 1
|
||||||
|
i += 1
|
||||||
|
k = i + 1
|
||||||
|
|
||||||
|
return tab
|
||||||
|
|
||||||
|
print(line_coor(4))
|
||||||
|
|
||||||
|
def line_matrix(Y):
|
||||||
|
n = len(Y)
|
||||||
|
t = line_coor(n)
|
||||||
|
lS = np.zeros((len(t), n))
|
||||||
|
|
||||||
|
for i in range(len(t)):
|
||||||
|
e = t[i]
|
||||||
|
y = - Y[e[0], e[1]]
|
||||||
|
lS[i, e[0]] = y
|
||||||
|
lS[i, e[1]] = - y
|
||||||
|
|
||||||
|
return lS
|
||||||
|
|
||||||
def delta_select(i, S):
|
def delta_select(i, S):
|
||||||
S = np.delete(S, (i), axis=0)
|
S = np.delete(S, (i), axis=0)
|
||||||
S = np.delete(S, (i), axis=1)
|
S = np.delete(S, (i), axis=1)
|
||||||
|
@ -39,6 +68,9 @@ def complete_data(P, delta, i):
|
||||||
nP = np.array(P[:i].tolist() + [-np.sum(P)] + P[i:].tolist())
|
nP = np.array(P[:i].tolist() + [-np.sum(P)] + P[i:].tolist())
|
||||||
return ndelta, nP
|
return ndelta, nP
|
||||||
|
|
||||||
|
# Vn
|
||||||
|
Vn = 2e5
|
||||||
|
|
||||||
# Vecteur des puissances
|
# Vecteur des puissances
|
||||||
P = np.array([1000, -500, -250, -250])
|
P = np.array([1000, -500, -250, -250])
|
||||||
P = P * 1e6 # Passage en MW
|
P = P * 1e6 # Passage en MW
|
||||||
|
@ -53,13 +85,13 @@ connect_Y(3, 0, 0.05, 0, Y)
|
||||||
print("Admittance matrix :", Y)
|
print("Admittance matrix :", Y)
|
||||||
|
|
||||||
# Mise en place du système linéaire à résoudre
|
# Mise en place du système linéaire à résoudre
|
||||||
S = spec(4, Y, 2e5) # dim n
|
S = system_matrix(4, Y, Vn) # dim n
|
||||||
S = delta_select(3, S) # dim n-1, sélection de l'angle de transport de référence (delta_3)
|
S = delta_select(3, S) # dim n-1, sélection de l'angle de transport de référence (delta_3)
|
||||||
print("System matrix :", S)
|
print("System matrix :", S)
|
||||||
|
|
||||||
# Sélection des puissances (dimension n-1)
|
# Sélection des puissances (dimension n-1)
|
||||||
P = power_select(3, P)
|
P = power_select(3, P)
|
||||||
print("Puissances de référence : ", P)
|
print("Power input : ", P)
|
||||||
|
|
||||||
# Résolution (dimension n-1)
|
# Résolution (dimension n-1)
|
||||||
invS = np.linalg.inv(S)
|
invS = np.linalg.inv(S)
|
||||||
|
@ -70,5 +102,17 @@ delta = np.dot(invS, P)
|
||||||
|
|
||||||
# Ajout de l'angle de transport d'origine et de la puissance associée (on repasse en dim n)
|
# Ajout de l'angle de transport d'origine et de la puissance associée (on repasse en dim n)
|
||||||
ndelta, nP = complete_data(P, delta, 3)
|
ndelta, nP = complete_data(P, delta, 3)
|
||||||
print("Power input :", nP)
|
print("Power :", nP)
|
||||||
print("Delta (rad) :", ndelta * 180 / 3.1415)
|
print("Delta (rad) :", ndelta * 180 / 3.1415)
|
||||||
|
|
||||||
|
# Calcul de la matrice de ligne
|
||||||
|
lS = line_matrix(Y)
|
||||||
|
print("Line matrix : ", lS)
|
||||||
|
|
||||||
|
# Calcul des puissances de lignes
|
||||||
|
line_power = Vn**2 * np.dot(lS, ndelta)
|
||||||
|
lcoor = line_coor(len(ndelta))
|
||||||
|
disp_line = []
|
||||||
|
for i in range(len(line_power)):
|
||||||
|
disp_line += [lcoor[i] + [line_power[i]]]
|
||||||
|
print("Line power : ", disp_line)
|
||||||
|
|
Loading…
Reference in a new issue