Skip to content
Snippets Groups Projects
Commit f8b03b7b authored by Ubuntu's avatar Ubuntu
Browse files

adding connectibity matrix finder

parent c986db6d
No related branches found
No related tags found
No related merge requests found
......@@ -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 BusbarSection created : 13 times
INFO:cimpy.cimimport:CIM object TopologicalIsland created : 2 times
INFO:cimpy.cimimport:Created totally 275 CIM objects in 0.019738435745239258s
INFO:cimpy.cimimport:Created totally 275 CIM objects in 0.024729490280151367s
......@@ -37,6 +37,8 @@ c = a.parseBranch()
d = a.createLoads()
e = a.createGens()
f = a.makeConnectivity(b,c)
# Print node voltages
print("Powerflow converged in " + str(num_iter) + " iterations.\n")
print("Results: \n")
......
......@@ -142,3 +142,23 @@ class PPexporter(Exporter):
load_index, index, power, power_pu, power_real, power_imag, power_pu_real, power_pu_imag
]
return df
def makeConnectivity(self, df_node, df_branch ):
df = pd.DataFrame(columns = [])
node = df_node
branch = df_branch
connectivity_map=np.zeros((len(node),len(node))) #create node x node matrix for connectivity map
for k in range(len(branch)): #iterate through index of each line
br_start_node = branch.loc[k].start_node
br_end_node = branch.loc[k].end_node
#from node : rows, to node: columlns
connectivity_map[br_start_node, br_end_node] = 1 #if connection exist, it mark as 1
connectivity_map[br_end_node, br_start_node] = 1
df = pd.DataFrame(connectivity_map)
return df
\ No newline at end of file
......@@ -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 BusbarSection created : 13 times
INFO:cimpy.cimimport:CIM object TopologicalIsland created : 2 times
INFO:cimpy.cimimport:Created totally 275 CIM objects in 0.042603254318237305s
INFO:cimpy.cimimport:Created totally 275 CIM objects in 0.038852691650390625s
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment