Commit 6b707a23 authored by martin.moraga's avatar martin.moraga
Browse files

fixed some errors

parent 502c02b9
......@@ -147,7 +147,7 @@ class PowerflowResults():
"""
S1 = np.array([])
for branch in self.branches:
S1 = np.append(S, branch.power)
S1 = np.append(S1, branch.power)
return S1
def get_S2(self):
......@@ -157,7 +157,7 @@ class PowerflowResults():
"""
S2 = np.array([])
for branch in self.branches:
S2 = np.append(S, branch.power2)
S2 = np.append(S2, branch.power2)
return S2
def solve(system):
......@@ -243,7 +243,8 @@ def solve(system):
results.calculateIinj()
results.calculateSinj()
results.calculateI()
results.calculateS()
results.calculateS1()
results.calculateS2()
return results, num_iter
......
......@@ -26,18 +26,12 @@ branch, node = py_95bus_network_data.Network_95_nodes(Base, slackV)
V, I, Iinj, S1, S2, Sinj, num_iter = solve(branch, node)
system = network.load_python_data(node, branch, node.type)
res = nv_powerflow_cim.PF_Results()
res.V, res.num_iter = nv_powerflow_cim.solve(system)
res.I = nv_powerflow_cim.calculateI(system, res.V)
res.Iinj = nv_powerflow_cim.calculateInj(system, res.I)
res.S1 = nv_powerflow_cim.calculateS1(system, res.V, res.I)
res.S2 = nv_powerflow_cim.calculateS2(system, res.V, res.I)
res.Sinj = nv_powerflow_cim.calculateSinj(res.V, res.Iinj)
res, num_iter = nv_powerflow_cim.solve(system)
# Show numerical comparison
print("res.V==V? " + str(not np.any(res.V-V)))
print("res.I==I? " + str(not np.any(res.I-I)))
print("res.Iinj==Iinj? " + str(not np.any(res.Iinj-Iinj)))
print("res.S1==S1? " + str(not np.any(res.S1-S1)))
print("res.S2==S2? " + str(not np.any(res.S2-S2)))
print("res.Sinj==Sinj? " + str(not np.any(res.Sinj-Sinj)))
\ No newline at end of file
print("res.V==V? " + str(not np.any(res.get_voltages()-V)))
print("res.I==I? " + str(not np.any(res.getI()-I)))
print("res.Iinj==Iinj? " + str(not np.any(res.get_Iinj()-Iinj)))
print("res.S1==S1? " + str(not np.any(res.get_S1()-S1)))
print("res.S2==S2? " + str(not np.any(res.get_S2()-S2)))
print("res.Sinj==Sinj? " + str(not np.any(res.get_Sinj()-Sinj)))
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment