Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions ditto/constant.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@

# Units
# The associated string must be Pint-parsable:
# >>> 1.0 * ureg.parse_expression(KVA)
# 1 kilowatt
#
# Power
VA = "watt" # Pint uses watts
KVA = "kilowatt"
W = "watt"
KW = "kilowatt"

# Voltage
V = "volt"
KV = "kilovolt"

# Current
A = "amps"
OHM = "ohm"
KOHM = "kiloohm"

# Capacitance
F = "farad"
NF = "nanofarad"

# Susceptance
SIEMENS = "siemens"

# Energy
J = "joule"
KJ = "kilojoule"
WH = "watthour"
KWH = "kilowatthour"

# Distances
M = "meter"
CM = "centimeter"
MM = "milimeter"
KM = "kilometer"
FT = "feet"
KFT = "kilofeet"
MI = "mile"
IN = "inch"

# Mass
KG = "kilogram"
G = "gram"
MG = "milligram"

# Angles
DEG = "degree"
RAD = "radian"

# Temperature
K = "kelvin"

# Time
MS = "millisecond"
S = "second"
MIN = "minute"
H = "hour"
DAY = "day"
MONTH = "month"
YEAR = "year"
8 changes: 3 additions & 5 deletions ditto/metrics/network_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,8 +771,8 @@ def analyze_object(self, obj, feeder_name):
# then we add the points to the list of points for the feeder
if hasattr(obj, "positions") and obj.positions is not None:
for position in obj.positions:
X = position.long
Y = position.lat
X = position.longitude
Y = position.latitude
if X is not None and Y is not None:
if feeder_name in self.points:
self.points[feeder_name].append([X, Y])
Expand Down Expand Up @@ -1330,9 +1330,7 @@ def analyze_object(self, obj, feeder_name):
):
self.results[feeder_name][
"sum_distribution_transformer_mva"
] += (
obj.windings[0].rated_power * 10 ** -6
) # DiTTo in va
] += (obj.windings[0].rated_power * 10 ** -6) # DiTTo in va

if (
hasattr(obj.windings[0], "phase_windings")
Expand Down
45 changes: 37 additions & 8 deletions ditto/models/capacitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,85 +6,111 @@
from .position import Position
from .phase_capacitor import PhaseCapacitor

from ..constant import V, S, OHM, SIEMENS


class Capacitor(DiTToHasTraits):

name = Unicode(help="""Name of the capacitor object""", default_value="")
name = Unicode(help="""Name of the capacitor object""", default_value="", unit=None)
nominal_voltage = Float(
help="""The nominal voltage of the capacitor""", default_value=None
help="""The nominal voltage of the capacitor""", default_value=None, unit=V
)
connection_type = Unicode(
help="""This is the type of connection that the capacitor connects to on the high side. The strings may be one of the following Delta (D), Wye (Y), Zigzap (Z) or autotransformer (A).""",
default_value=None,
unit=None,
)
delay = Float(
help="""The time that the capacitor need to connect or disconnect by automatic voltage regulation""",
default_value=None,
unit=S,
)
mode = Unicode(
help="""What control mode is used. A string from one of the options: {voltage, activePower, reactivePower, currentFlow, admittance, timeScheduled, none}""",
default_value=None,
unit=None,
)
low = Float(
help="""This is the low value of the range that is being controlled by the capacitor (e.g. voltage).""",
default_value=None,
unit=None, # PROBLEM HERE....
)
high = Float(
help="""This is the high value of the range that is being controlled by the capacitor (e.g. voltage).""",
default_value=None,
unit=None, # PROBLEM HERE...
)
resistance = Float(
help="""The total series resistance of the capacitor""", default_value=None
help="""The total series resistance of the capacitor""",
default_value=None,
unit=OHM,
)
resistance0 = Float(
help="""The total series zero-sequence resistance of the capacitor""",
default_value=None,
unit=OHM,
)
reactance = Float(
help="""The total series reactance of the capacitor""", default_value=None
help="""The total series reactance of the capacitor""",
default_value=None,
unit=OHM,
)
reactance0 = Float(
help="""The total series zero-sereactance of the capacitor""",
default_value=None,
unit=OHM,
)
susceptance = Float(
help="""The total shunt susceptance of the capacitor section. Note that if the var value of the capacitor is provided this should follow the formula susceptance = -1*p.var/(nominal_voltage)**2""",
default_value=None,
unit=SIEMENS,
)
susceptance0 = Float(
help="""The total zero sequence shunt susceptance of the capacitor""",
default_value=None,
unit=SIEMENS,
)
conductance = Float(
help="""This is the shunt conductance of the capacitor """, default_value=None
help="""This is the shunt conductance of the capacitor """,
default_value=None,
unit=SIEMENS,
)
conductance0 = Float(
help="""This is the zero sequence shunt conductance of the capacitor per section""",
default_value=None,
unit=SIEMENS,
)
pt_ratio = Float(
help="""The voltage (potential) transformer ratio used to step down the voltage for controller.""",
default_value=None,
unit=None,
)
ct_ratio = Float(
help="""The current transformer ratio used to define the current ratio for a controller.""",
default_value=None,
unit=None,
)
pt_phase = Unicode(
help="""The phase that the controller is connected to.""", default_value=None
help="""The phase that the controller is connected to.""",
default_value=None,
unit=None,
)
connecting_element = Unicode(
help="""The bus which the capacitor is connected to""", default_value=None
help="""The bus which the capacitor is connected to""",
default_value=None,
unit=None,
)
positions = List(
Instance(Position),
help="""This parameter is a list of positional points describing the capacitor (typically just one). The positions are objects containing elements of long, lat and elevation (See Position object documentation).""",
default_value=None,
unit=None,
)
phase_capacitors = List(
Instance(PhaseCapacitor),
help="""A list of phase capacitors which contain phase, var and switch values. The total var of the capacitor is defined through the phasecapacitors.""",
default_value=None,
unit=None,
)

# Modification: Nicolas (August 2017)
Expand All @@ -93,6 +119,7 @@ class Capacitor(DiTToHasTraits):
measuring_element = Unicode(
help="""Name of the circuit element, typically a line or transformer, to which the capacitor control's PT and/or CT are connected""",
default_value=None,
unit=None,
)

# Modification: Nicolas (December 2017)
Expand All @@ -102,15 +129,17 @@ class Capacitor(DiTToHasTraits):
substation_name = Unicode(
help="""The name of the substation to which the object is connected.""",
default=None,
unit=None,
)
feeder_name = Unicode(
help="""The name of the feeder the object is on.""", default=None
help="""The name of the feeder the object is on.""", default=None, unit=None
)

# Modification: Nicolas (May 2018)
is_substation = Int(
help="""Flag that indicates wheter the element is inside a substation or not.""",
default_value=0,
unit=None,
)

def build(self, model):
Expand Down
26 changes: 19 additions & 7 deletions ditto/models/feeder_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,53 +13,65 @@
Instance,
)

from ..constant import V, DEG, OHM


class Feeder_metadata(DiTToHasTraits):
"""TODO

"""
name = Unicode(help="""Name of the feeder object""")
name = Unicode(help="""Name of the feeder object""", unit=None)
nominal_voltage = Float(
help="""Nominal voltage at the feeder head.""", default_value=None
help="""Nominal voltage at the feeder head.""", default_value=None, unit=V
)
headnode = Unicode(
help="""Name of the headnode/FEEDERHEAD.""", default_value=None, unit=None
)
headnode = Unicode(help="""Name of the headnode/FEEDERHEAD.""", default_value=None)
transformer = Unicode(
help="""Name of the transformer representing the substation.""",
default_value=None,
unit=None,
)
substation = Unicode(
help="""Name of the object representing the substation in the feeder files (often a bus downstream of the transformer).""",
default_value=None,
unit=None,
)
operating_voltage = Float(
help="""Operating voltage at the feeder head.""", default_value=None
help="""Operating voltage at the feeder head.""", default_value=None, unit=V
)
operating_angle1 = Float(help="""Angle 1.""", default_value=None)
operating_angle2 = Float(help="""Angle 2.""", default_value=None)
operating_angle3 = Float(help="""Angle 3.""", default_value=None)
operating_angle1 = Float(help="""Angle 1.""", default_value=None, unit=DEG)
operating_angle2 = Float(help="""Angle 2.""", default_value=None, unit=DEG)
operating_angle3 = Float(help="""Angle 3.""", default_value=None, unit=DEG)
positive_sequence_resistance = Float(
help="""Positive sequence resistance for the source equivalent.""",
default_value=None,
unit=OHM,
)
positive_sequence_reactance = Float(
help="""Positive sequence reactance for the source equivalent.""",
default_value=None,
unit=OHM,
)
zero_sequence_resistance = Float(
help="""Zero sequence resistance for the source equivalent.""",
default_value=None,
unit=OHM,
)
zero_sequence_reactance = Float(
help="""Zero sequence reactance for the source equivalent.""",
default_value=None,
unit=OHM,
)
negative_sequence_resistance = Float(
help="""Negative sequence resistance for the source equivalent.""",
default_value=None,
unit=OHM,
)
negative_sequence_reactance = Float(
help="""Negative sequence reactance for the source equivalent.""",
default_value=None,
unit=OHM,
)

def build(self, model, Asset=None, ConnectivityNode=None, Location=None):
Expand Down
Loading