Skip to content
Snippets Groups Projects
Commit 29f5fc46 authored by Taeyoung Kim's avatar Taeyoung Kim
Browse files

somehow powrflow values are not met

parent d5851a95
No related branches found
No related tags found
No related merge requests found
...@@ -76,7 +76,7 @@ INFO:cimpy.cimimport:CIM object Line created : 11 times ...@@ -76,7 +76,7 @@ INFO:cimpy.cimimport:CIM object Line created : 11 times
INFO:cimpy.cimimport:CIM object SubGeographicalRegion created : 2 times INFO:cimpy.cimimport:CIM object SubGeographicalRegion created : 2 times
INFO:cimpy.cimimport:CIM object BusbarSection created : 13 times INFO:cimpy.cimimport:CIM object BusbarSection created : 13 times
INFO:cimpy.cimimport:CIM object TopologicalIsland created : 2 times INFO:cimpy.cimimport:CIM object TopologicalIsland created : 2 times
INFO:cimpy.cimimport:Created totally 275 CIM objects in 0.0252532958984375s INFO:cimpy.cimimport:Created totally 275 CIM objects in 0.02504444122314453s
WARNING:pandapower.auxiliary:numba cannot be imported and numba functions are disabled. WARNING:pandapower.auxiliary:numba cannot be imported and numba functions are disabled.
......
...@@ -2,7 +2,7 @@ import logging ...@@ -2,7 +2,7 @@ import logging
from pathlib import Path from pathlib import Path
from pyvolt import network from pyvolt import network
from pyvolt import nv_powerflow from pyvolt import nv_powerflow
import numpy import numpy as np
import cimpy import cimpy
import os import os
from pyvolt import export from pyvolt import export
...@@ -64,11 +64,15 @@ ccc = aaa.convertDFtoPP(dataframe = q) ...@@ -64,11 +64,15 @@ ccc = aaa.convertDFtoPP(dataframe = q)
print("Powerflow converged in " + str(num_iter) + " iterations.\n") print("Powerflow converged in " + str(num_iter) + " iterations.\n")
print("Results: \n") print("Results: \n")
voltages = [] voltages = []
powers=[]
for node in results_pf.nodes: for node in results_pf.nodes:
print('{}={}'.format(node.topology_node.type, node.voltage_pu)) print('{}={}'.format(node.topology_node.type, node.voltage_pu))
# print('{}={}'.format(node.topology_node.type, node.power_pu)) # print('{}={}'.format(node.topology_node.type, node.power_pu))
#print('{}={}'.format(node.topology_node.uuid, node.voltage)) #print('{}={}'.format(node.topology_node.uuid, node.voltage))
voltages.append(node.voltage_pu) voltages.append(node.voltage_pu)
powers.append(node.power_pu)
vol = np.abs(voltages)
# voltages_ref = [(1-7.970485900477431e-27j), (0.9521818868802214-0.11692768153747995j), # voltages_ref = [(1-7.970485900477431e-27j), (0.9521818868802214-0.11692768153747995j),
# (0.9642955926931457-0.09862127081290231j), (0.8796973782245792-0.15318580971335868j), # (0.9642955926931457-0.09862127081290231j), (0.8796973782245792-0.15318580971335868j),
......
...@@ -289,7 +289,7 @@ class CIMtoDataFrame(Exporter): ...@@ -289,7 +289,7 @@ class CIMtoDataFrame(Exporter):
def get_branch_capacitance(self, frequency=50): def get_branch_capacitance(self, frequency=50):
sys = self.system sys = self.system
y_mat = sys.Ymatrix y_mat = sys.Ymatrix_real
w = 2 * np.pi * frequency w = 2 * np.pi * frequency
cap = {} cap = {}
...@@ -597,7 +597,7 @@ class PandapowerWork(Exporter): ...@@ -597,7 +597,7 @@ class PandapowerWork(Exporter):
length_km= 1, length_km= 1,
r_ohm_per_km= branch['r'], r_ohm_per_km= branch['r'],
x_ohm_per_km=branch['x'], x_ohm_per_km=branch['x'],
c_nf_per_km= capacity*(10**6), c_nf_per_km= branch['c']*(1e6),
name= lcl_name, name= lcl_name,
max_i_ka = branch['base_current']) max_i_ka = branch['base_current'])
......
...@@ -99,6 +99,8 @@ class System(): ...@@ -99,6 +99,8 @@ class System():
self.breakers = [] self.breakers = []
self.Ymatrix = np.zeros([], dtype=complex) self.Ymatrix = np.zeros([], dtype=complex)
self.Bmatrix = np.zeros([], dtype=complex) self.Bmatrix = np.zeros([], dtype=complex)
self.Ymatrix_real = np.zeros([], dtype=complex)
self.Bmatrix_real = np.zeros([], dtype=complex)
def get_node_by_uuid(self, node_uuid): def get_node_by_uuid(self, node_uuid):
for node in self.nodes: for node in self.nodes:
...@@ -251,6 +253,7 @@ class System(): ...@@ -251,6 +253,7 @@ class System():
#calculate admitance matrix #calculate admitance matrix
self.Ymatrix_calc() self.Ymatrix_calc()
self.Ymatrix_calc_real()
def _get_nodes(self, list_Terminals, elem_uuid): def _get_nodes(self, list_Terminals, elem_uuid):
""" """
...@@ -356,6 +359,19 @@ class System(): ...@@ -356,6 +359,19 @@ class System():
self.Ymatrix[fr][fr] += branch.y_pu self.Ymatrix[fr][fr] += branch.y_pu
self.Ymatrix[to][to] += branch.y_pu self.Ymatrix[to][to] += branch.y_pu
def Ymatrix_calc_real(self):
self.reindex_nodes_list()
nodes_num = self.get_nodes_num()
self.Ymatrix_real = np.zeros((nodes_num, nodes_num), dtype=complex)
self.Bmatrix_real = np.zeros((nodes_num, nodes_num), dtype=complex)
for branch in self.branches:
fr = branch.start_node.index
to = branch.end_node.index
self.Ymatrix_real[fr][to] -= branch.y
self.Ymatrix_real[to][fr] -= branch.y
self.Ymatrix_real[fr][fr] += branch.y
self.Ymatrix_real[to][to] += branch.y
#testing functions #testing functions
def print_nodes_names(self): def print_nodes_names(self):
for node in self.nodes: for node in self.nodes:
......
...@@ -76,6 +76,6 @@ INFO:cimpy.cimimport:CIM object Line created : 11 times ...@@ -76,6 +76,6 @@ INFO:cimpy.cimimport:CIM object Line created : 11 times
INFO:cimpy.cimimport:CIM object SubGeographicalRegion created : 2 times INFO:cimpy.cimimport:CIM object SubGeographicalRegion created : 2 times
INFO:cimpy.cimimport:CIM object BusbarSection created : 13 times INFO:cimpy.cimimport:CIM object BusbarSection created : 13 times
INFO:cimpy.cimimport:CIM object TopologicalIsland created : 2 times INFO:cimpy.cimimport:CIM object TopologicalIsland created : 2 times
INFO:cimpy.cimimport:Created totally 275 CIM objects in 0.03760051727294922s INFO:cimpy.cimimport:Created totally 275 CIM objects in 0.04641366004943848s
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment