2 changed files with 54 additions and 0 deletions
@ -0,0 +1,53 @@ |
|||||
|
import numpy as np |
||||
|
import matplotlib.pyplot as plt |
||||
|
import PyQt5 as qt |
||||
|
|
||||
|
# Vn = 4e5 # En V |
||||
|
|
||||
|
def make_Y(n): |
||||
|
Y = np.zeros((n, n)) |
||||
|
return Y |
||||
|
|
||||
|
def connect_Y(x, y, Ys, Yp, Y): |
||||
|
Y[x, y] = -Ys |
||||
|
Y[y, x] = -Ys |
||||
|
Y[x, x] += Ys + Yp |
||||
|
Y[y, y] += Ys + Yp |
||||
|
|
||||
|
def spec(n, Y, Vn): |
||||
|
S = np.zeros((n, n)) |
||||
|
for i in range(n): |
||||
|
for k in range(n): |
||||
|
if i == k: |
||||
|
S[i, k] = n |
||||
|
else: |
||||
|
S[i, k] = -1 |
||||
|
S[i, k] *= Vn**2 * Y[i, k] |
||||
|
return S |
||||
|
|
||||
|
def delta_select(i, S): |
||||
|
for k in range(len(S)): |
||||
|
S[i, k] = 0 |
||||
|
|
||||
|
|
||||
|
Y = make_Y(4) |
||||
|
connect_Y(2, 3, 0.1, 0, Y) |
||||
|
connect_Y(1, 3, 0.15, 0, Y) |
||||
|
connect_Y(2, 1, 0.05, 0, Y) |
||||
|
connect_Y(2, 0, 0.05, 0, Y) |
||||
|
connect_Y(3, 0, 0.05, 0, Y) |
||||
|
print("Admittance matrix :") |
||||
|
print(Y) |
||||
|
S = spec(4, Y, 2e5) |
||||
|
print("System matrix :") |
||||
|
print(S) |
||||
|
invS = np.linalg.inv(S) |
||||
|
print(invS) |
||||
|
P = np.array([1000, -500, -250, -250]) |
||||
|
P = P * 1e6 |
||||
|
print("Power input :") |
||||
|
print(P) |
||||
|
delta = np.dot(invS, P) |
||||
|
print("Delta (rad) :") |
||||
|
print(delta) |
||||
|
print(delta * 180 / 3.1415) |
||||
Loading…
Reference in new issue