Skip to content

Commit

Permalink
add dtrans
Browse files Browse the repository at this point in the history
  • Loading branch information
wwang2 committed Jan 23, 2024
1 parent b2dbb9f commit f34c764
Show file tree
Hide file tree
Showing 6 changed files with 470 additions and 80 deletions.
128 changes: 128 additions & 0 deletions ditto/models/distribution_transformer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from builtins import super, range, zip, round, map

from .base import (
DiTToHasTraits,
Float,
Unicode,
Any,
Int,
List,
Bool,
observe,
Instance,
)

from .position import Position
from .winding import Winding


class DistributionTransformer(DiTToHasTraits):

name = Unicode(help="""Name of the transformer object""", default_value="")

# Modification: Nicolas (August 2017)
# Moved the rated_power from the transformer down to the windings
# rated_power = Float(help='''The rated power of the entire transformer''', default_value=None)

install_type = Unicode(
help="""The mounting type of the transformer: one of {POLETOP, PADMOUNT, VAULT}""",
default_value=None,
)
noload_loss = Float(
help="""The no-load loss for a zero sequence short-circuit test on the entire transformer""",
default_value=None,
)
phase_shift = Float(
help="""The degree phase shift that the transformer causes.""",
default_value=None,
)
from_element = Any(
help="""Name of the node which connects to the 'from' end of the transformer""",
default_value=None,
)
to_element = Any(
help="""'Name of the node which connects to the 'to' end of the transformer""",
default_value=None,
)
from_element_connection_index = Int(
help="""Index of the position in the node that the 'from' end of the line connects to (e.g. for a long bus)""",
default_value=None,
)
to_element_connection_index = Int(
help="""Index of the position in the node that the 'to' end of the line connects to (e.g. for a long bus)""",
default_value=None,
)
connecting_element = Any(
help="""Name of the node which connects to the transformer""",
default_value=None,
)
phase_loads = Any(
help="""phase_loads which connects to the transformer""",
default_value=None,
)

reactances = List(
Float(),
help="""Reactances are described between all the windings. There are n*(n-1)/2 reactances (where n is the number of windings). For two a winding transformer this gives one value, and for a 3 winding transformer it gives 3.""",
default_value=None,
)

windings = List(
Instance(Winding),
help="""A list of the windings that the transformer contains. Most will have two windings but center tap transformers have three.""",
default_value=None,
)
positions = List(
Instance(Position),
help="""This parameter is a list of positional points describing the transformer - it should contain just one. The positions are objects containing elements of long, lat and elevation.""",
default_value=None,
)

# Modification: Nicolas (August 2017)
loadloss = Float(help="Percent Losses at rated load", default_value=None)
normhkva = Float(help="Normal maximum kVA rating for H winding", default_value=None)

# Modification: Nicolas (November 2017)
is_center_tap = Bool(
help="""Set to 1 if the transformer is a center tap transformer"""
)

# Modification: Nicolas (December 2017)
is_substation = Bool(
help="""Set to 1 if the transformer is a substation or is inside a substation""",
)

# Modification: Wenbo (Nov. 2023)
is_threephaseunit = Int(
help="""Set to 1 if the transformer is a three phase unit, otherwise it is a bank of 1-3 single phase transformers""",
)
ConnKvaPh = List(help="ConnKvaPh1, ConnKvaPh2, ConnKvaPh3", default_value=None)

nominal_voltage = Any(help=""" voltage can be primary only or pri - sec """, default_value=None)

xhl = Float(help="xhl for dtransformer", default_value=None)
pct_loadloss = Float(help="pct_loadloss", default_value=None)
bus1 = Unicode(help="Primary node", default_value=None)
bus2 = Unicode(help="Secondary node", default_value=None)
conn = List(help="conn1, conn2", default_value=None)

kvas = List(help="kva1, kva2", default_value=None)


# Modification: Nicolas (December 2017)
# Multiple feeder support. Each element keeps track of the name of the substation it is connected to, as well as the name of the feeder.
# I think we need both since a substation might have multiple feeders attached to it.
# These attributes are filled once the DiTTo model has been created using the Network module
substation_name = Unicode(
help="""The name of the substation to which the object is connected.""",
)
feeder_name = Unicode(help="""The name of the feeder the object is on.""",)

def build(self, model):
"""
The high and low properties are used to creat windings which are added to the windings list
Winding data (e.g. high_ground_reactance) should be referenced thorugh the windings list
"""
self._model = model
1 change: 1 addition & 0 deletions ditto/models/powertransformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class PowerTransformer(DiTToHasTraits):
is_threephaseunit = Int(
help="""Set to 1 if the transformer is a three phase unit, otherwise it is a bank of 1-3 single phase transformers""",
)
ConnKvaPh = List(help="ConnKvaPh1, ConnKvaPh2, ConnKvaPh3", default_value=None)

# Modification: Nicolas (December 2017)
# Multiple feeder support. Each element keeps track of the name of the substation it is connected to, as well as the name of the feeder.
Expand Down
13 changes: 13 additions & 0 deletions ditto/modify/system_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ def set_nominal_voltages_recur(self, *args):
previous = self.source
else:
node, voltage, previous = args

if (previous, node) in self.edge_equipment and self.edge_equipment[
(previous, node)
] == "PowerTransformer":
Expand All @@ -235,6 +236,13 @@ def set_nominal_voltages_recur(self, *args):
if w.nominal_voltage is not None
]
)
num_phases = len(self.model[trans_name].windings[0].phase_windings)
if num_phases!=3:
new_value = new_value *1.732
print(f"1num_phases={num_phases}")
print(f"1trans_name={trans_name}")
print(f"1new_value={new_value}")

elif (node, previous) in self.edge_equipment and self.edge_equipment[
(node, previous)
] == "PowerTransformer":
Expand All @@ -246,6 +254,11 @@ def set_nominal_voltages_recur(self, *args):
if w.nominal_voltage is not None
]
)
num_phases = len(self.model[trans_name].windings[0].phase_windings)
if num_phases!=3:
new_value = new_value *1.732
print(f"2trans_name={trans_name}")
print(f"2new_value={new_value}")
else:
new_value = voltage
if hasattr(self.model[node], "nominal_voltage"):
Expand Down
1 change: 0 additions & 1 deletion ditto/readers/synergi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from __future__ import absolute_import, division, print_function
from builtins import super, range, zip, round, map

from .read import Reader as SynergiReader

from .utils import download_mdbtools, URL
Expand Down
Loading

0 comments on commit f34c764

Please sign in to comment.