Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/199_finalize_cgmes_import' into …
Browse files Browse the repository at this point in the history
…199_finalize_cgmes_import

# Conflicts:
#	.idea/workspace.xml
  • Loading branch information
SanPen committed Oct 7, 2024
2 parents ac30dd5 + 5c99e02 commit 6de127d
Show file tree
Hide file tree
Showing 7 changed files with 322 additions and 119 deletions.
11 changes: 6 additions & 5 deletions src/GridCalEngine/Devices/Branches/tap_changer.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,21 +331,22 @@ def init_from_cgmes(self,
"""
Import TapChanger object from CGMES
:param asymmetry_angle:
:param low:
:param high:
:param normal:
:param neutral:
:param stepVoltageIncrement:
:param step:
:param asymmetry_angle:
:param tc_type:
:return:
"""

self._negative_low = low < 0

if self._negative_low:
self.asymmetry_angle = float(asymmetry_angle) # assymetry angle (Theta)
self._total_positions = int(high-low) # total number of positions
self._total_positions = int(high-low+1) # total number of positions
self.dV = float(stepVoltageIncrement / 100) # voltage increment in p.u.
self.neutral_position = int(neutral - low + 1) # neutral position
self.normal_position = int(normal - low + 1) # normal position
Expand All @@ -354,7 +355,7 @@ def init_from_cgmes(self,

else:
self.asymmetry_angle = float(asymmetry_angle) # assymetry angle (Theta)
self._total_positions = int(high-low) # total number of positions
self._total_positions = int(high-low+1) # total number of positions
self.dV = float(stepVoltageIncrement / 100) # voltage increment in p.u.
self.neutral_position = int(neutral) # neutral position
self.normal_position = int(normal) # normal position
Expand All @@ -377,14 +378,14 @@ def get_cgmes_values(self):

if self._negative_low:
low = -self.neutral_position + 1
high = self.total_positions - self.neutral_position + 1
high = self.total_positions - self.neutral_position
normal = self.normal_position + low - 1
neutral = self.neutral_position + low - 1
sVI = self.dV * 100
step = self.tap_position + low - 1
else:
low = 0
high = self.total_positions
high = self.total_positions-1
normal = self.normal_position
neutral = self.neutral_position
sVI = self.dV * 100
Expand Down
9 changes: 6 additions & 3 deletions src/GridCalEngine/Devices/Branches/transformer3w.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ def __init__(self, idtag: Union[str, None] = None,
name: str = 'Branch',
bus0: Union[None, Bus] = None,
bus1: Bus = None, bus2: Bus = None, bus3: Bus = None,
w1_idtag: Union[str, None] = None,
w2_idtag: Union[str, None] = None,
w3_idtag: Union[str, None] = None,
V1=10.0, V2=10.0, V3=10.0, active=True,
r12=0.0, r23=0.0, r31=0.0, x12=0.0, x23=0.0, x31=0.0,
rate12=0.0, rate23=0.0, rate31=0.0,
Expand Down Expand Up @@ -113,9 +116,9 @@ def __init__(self, idtag: Union[str, None] = None,
self._rate23 = float(rate23)
self._rate31 = float(rate31)

self.winding1 = Winding(bus_from=self.bus0, bus_to=bus1, HV=V1, LV=1.0, name=name + "_W1")
self.winding2 = Winding(bus_from=self.bus0, bus_to=bus2, HV=V2, LV=1.0, name=name + "_W2")
self.winding3 = Winding(bus_from=self.bus0, bus_to=bus3, HV=V3, LV=1.0, name=name + "_W3")
self.winding1 = Winding(bus_from=self.bus0, idtag=w1_idtag, bus_to=bus1, HV=V1, LV=1.0, name=name + "_W1")
self.winding2 = Winding(bus_from=self.bus0, idtag=w2_idtag, bus_to=bus2, HV=V2, LV=1.0, name=name + "_W2")
self.winding3 = Winding(bus_from=self.bus0, idtag=w3_idtag, bus_to=bus3, HV=V3, LV=1.0, name=name + "_W3")

self.x = float(x)
self.y = float(y)
Expand Down
Loading

0 comments on commit 6de127d

Please sign in to comment.