Skip to content

Commit

Permalink
Removed calls of the deprecated np.complex128
Browse files Browse the repository at this point in the history
Signed-off-by: SystemsPurge <[email protected]>
  • Loading branch information
SystemsPurge committed Oct 15, 2024
1 parent 787c04f commit 2ce1484
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# ide folders
.idea
.vscode
.venv

# python folders
*.egg-info/
Expand All @@ -9,4 +10,4 @@ build
dist

# log files
*.log
*.log
8 changes: 4 additions & 4 deletions pyvolt/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ def __init__(self):
self.nodes = []
self.branches = []
self.breakers = []
self.Ymatrix = np.zeros([], dtype=np.complex)
self.Bmatrix = np.zeros([], dtype=np.complex)
self.Ymatrix = np.zeros([], dtype=np.complex128)
self.Bmatrix = np.zeros([], dtype=np.complex128)

def get_node_by_uuid(self, node_uuid):
for node in self.nodes:
Expand Down Expand Up @@ -344,8 +344,8 @@ def _setNodeType(self, list_Terminals):
def Ymatrix_calc(self):
self.reindex_nodes_list()
nodes_num = self.get_nodes_num()
self.Ymatrix = np.zeros((nodes_num, nodes_num), dtype=np.complex)
self.Bmatrix = np.zeros((nodes_num, nodes_num), dtype=np.complex)
self.Ymatrix = np.zeros((nodes_num, nodes_num), dtype=np.complex128)
self.Bmatrix = np.zeros((nodes_num, nodes_num), dtype=np.complex128)
for branch in self.branches:
fr = branch.start_node.index
to = branch.end_node.index
Expand Down
13 changes: 6 additions & 7 deletions pyvolt/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def get_voltages(self, pu=True):
get node voltages
- if pu==True --> voltages are expressed as per-unit
"""
voltages = np.zeros(len(self.nodes), dtype=np.complex_)
voltages = np.zeros(len(self.nodes), dtype=np.complex128)
if pu == True:
for node in self.nodes:
voltages[node.topology_node.index] = node.voltage_pu
Expand All @@ -273,7 +273,6 @@ def get_branch_powers(self, pu=True):
get branch powers
- if pu==True --> branch powers are expressed as per-unit
"""
#branch_powers = np.zeros(len(self.branches), dtype=np.complex_)
branch_powers = []
if pu == True:
for branch in self.branches:
Expand All @@ -289,7 +288,7 @@ def get_Iinj(self, pu=True):
get node currents
- if pu==True --> voltages are expressed as per-unit
"""
Iinj = np.zeros(len(self.nodes), dtype=np.complex_)
Iinj = np.zeros(len(self.nodes), dtype=np.complex128)
if pu == True:
for node in self.nodes:
Iinj[node.topology_node.index] = node.current_pu
Expand All @@ -304,7 +303,7 @@ def get_Sinj(self, pu=True):
get node power
- if pu==True --> voltages are expressed as per-unit
"""
Sinj = np.zeros(len(self.nodes), dtype=np.complex_)
Sinj = np.zeros(len(self.nodes), dtype=np.complex128)
if pu == True:
for node in self.nodes:
Sinj[node.topology_node.index] = node.power_pu
Expand All @@ -319,7 +318,7 @@ def getI(self, pu=True):
get branch currents
- if pu==True --> voltages are expressed as per-unit
"""
I = np.zeros(len(self.branches), dtype=np.complex_)
I = np.zeros(len(self.branches), dtype=np.complex128)
if pu == True:
for branch_idx in range(len(self.branches)):
I[branch_idx] = self.branches[branch_idx].current_pu
Expand All @@ -334,7 +333,7 @@ def get_S1(self, pu=True):
get complex Power flow at branch, measured at initial node
- if pu==True --> voltages are expressed as per-unit
"""
S1 = np.zeros(len(self.branches), dtype=np.complex_)
S1 = np.zeros(len(self.branches), dtype=np.complex128)
if pu == True:
for branch_idx in range(len(self.branches)):
S1[branch_idx] = self.branches[branch_idx].power_pu
Expand All @@ -349,7 +348,7 @@ def get_S2(self, pu=True):
get complex Power flow at branch, measured at final node
- if pu==True --> voltages are expressed as per-unit
"""
S2 = np.zeros(len(self.branches), dtype=np.complex_)
S2 = np.zeros(len(self.branches), dtype=np.complex128)
if pu == True:
for branch_idx in range(len(self.branches)):
S2[branch_idx] = self.branches[branch_idx].power2_pu
Expand Down

0 comments on commit 2ce1484

Please sign in to comment.