1 # Copyright (C) 2010-2011 Richard Lincoln
3 # Permission is hereby granted, free of charge, to any person obtaining a copy
4 # of this software and associated documentation files (the "Software"), to
5 # deal in the Software without restriction, including without limitation the
6 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 # sell copies of the Software, and to permit persons to whom the Software is
8 # furnished to do so, subject to the following conditions:
10 # The above copyright notice and this permission notice shall be included in
11 # all copies or substantial portions of the Software.
13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 from CIM14
.IEC61970
.Core
.ConductingEquipment
import ConductingEquipment
23 class DistributionTransformerWinding(ConductingEquipment
):
24 """Conducting connection point of a distribution / unbalanced transformer winding instance. This class differs from Wires::TransformerWinding as follows: - the eight Pi model attributes are moved into separate class, that can be optionally referred to from several winding instances. - the three grounding attributes can differ per winding instance, even for windings that use the same TransformerInfo, so they are kept on DistributionTransformerWinding. - 'windingType' attribute is replaced by 'sequenceNumber' attribute on WindingInfo class. - all the other attributes come from the WindingInfo (and its relationships). TransformerInfo is associated to the DistributionTransformer as referenceable data, so it can be defined once and referred to from instances, instead of being specified with each instance.
27 def __init__(self
, grounded
=False, xground
=0.0, rground
=0.0, Transformer
=None, WindingInfo
=None, RatioTapChanger
=None, PiImpedance
=None, PhaseTapChanger
=None, *args
, **kw_args
):
28 """Initialises a new 'DistributionTransformerWinding' instance.
30 @param grounded: (for Yn and Zn connections) True if the neutral is solidly grounded.
31 @param xground: (for Yn and Zn connections) Reactive part of neutral impedance where 'grounded' is true.
32 @param rground: (for Yn and Zn connections) Resistance part of neutral impedance where 'grounded' is true.
33 @param Transformer: Transformer this winding belongs to.
34 @param WindingInfo: Data for this winding.
35 @param RatioTapChanger: Ratio tap changer associated with this winding.
36 @param PiImpedance: (accurate for 2- or 3-winding transformers only) Pi-model impedances of this winding.
37 @param PhaseTapChanger: Phase tap changer associated with this winding.
39 #: (for Yn and Zn connections) True if the neutral is solidly grounded.
40 self
.grounded
= grounded
42 #: (for Yn and Zn connections) Reactive part of neutral impedance where 'grounded' is true.
43 self
.xground
= xground
45 #: (for Yn and Zn connections) Resistance part of neutral impedance where 'grounded' is true.
46 self
.rground
= rground
48 self
._Transformer
= None
49 self
.Transformer
= Transformer
51 self
._WindingInfo
= None
52 self
.WindingInfo
= WindingInfo
54 self
._RatioTapChanger
= None
55 self
.RatioTapChanger
= RatioTapChanger
57 self
._PiImpedance
= None
58 self
.PiImpedance
= PiImpedance
60 self
._PhaseTapChanger
= None
61 self
.PhaseTapChanger
= PhaseTapChanger
63 super(DistributionTransformerWinding
, self
).__init
__(*args
, **kw_args
)
65 _attrs
= ["grounded", "xground", "rground"]
66 _attr_types
= {"grounded": bool, "xground": float, "rground": float}
67 _defaults
= {"grounded": False, "xground": 0.0, "rground": 0.0}
69 _refs
= ["Transformer", "WindingInfo", "RatioTapChanger", "PiImpedance", "PhaseTapChanger"]
72 def getTransformer(self
):
73 """Transformer this winding belongs to.
75 return self
._Transformer
77 def setTransformer(self
, value
):
78 if self
._Transformer
is not None:
79 filtered
= [x
for x
in self
.Transformer
.Windings
if x
!= self
]
80 self
._Transformer
._Windings
= filtered
82 self
._Transformer
= value
83 if self
._Transformer
is not None:
84 if self
not in self
._Transformer
._Windings
:
85 self
._Transformer
._Windings
.append(self
)
87 Transformer
= property(getTransformer
, setTransformer
)
89 def getWindingInfo(self
):
90 """Data for this winding.
92 return self
._WindingInfo
94 def setWindingInfo(self
, value
):
95 if self
._WindingInfo
is not None:
96 filtered
= [x
for x
in self
.WindingInfo
.Windings
if x
!= self
]
97 self
._WindingInfo
._Windings
= filtered
99 self
._WindingInfo
= value
100 if self
._WindingInfo
is not None:
101 if self
not in self
._WindingInfo
._Windings
:
102 self
._WindingInfo
._Windings
.append(self
)
104 WindingInfo
= property(getWindingInfo
, setWindingInfo
)
106 def getRatioTapChanger(self
):
107 """Ratio tap changer associated with this winding.
109 return self
._RatioTapChanger
111 def setRatioTapChanger(self
, value
):
112 if self
._RatioTapChanger
is not None:
113 self
._RatioTapChanger
._Winding
= None
115 self
._RatioTapChanger
= value
116 if self
._RatioTapChanger
is not None:
117 self
._RatioTapChanger
.Winding
= None
118 self
._RatioTapChanger
._Winding
= self
120 RatioTapChanger
= property(getRatioTapChanger
, setRatioTapChanger
)
122 def getPiImpedance(self
):
123 """(accurate for 2- or 3-winding transformers only) Pi-model impedances of this winding.
125 return self
._PiImpedance
127 def setPiImpedance(self
, value
):
128 if self
._PiImpedance
is not None:
129 filtered
= [x
for x
in self
.PiImpedance
.Windings
if x
!= self
]
130 self
._PiImpedance
._Windings
= filtered
132 self
._PiImpedance
= value
133 if self
._PiImpedance
is not None:
134 if self
not in self
._PiImpedance
._Windings
:
135 self
._PiImpedance
._Windings
.append(self
)
137 PiImpedance
= property(getPiImpedance
, setPiImpedance
)
139 def getPhaseTapChanger(self
):
140 """Phase tap changer associated with this winding.
142 return self
._PhaseTapChanger
144 def setPhaseTapChanger(self
, value
):
145 if self
._PhaseTapChanger
is not None:
146 self
._PhaseTapChanger
._Winding
= None
148 self
._PhaseTapChanger
= value
149 if self
._PhaseTapChanger
is not None:
150 self
._PhaseTapChanger
.Winding
= None
151 self
._PhaseTapChanger
._Winding
= self
153 PhaseTapChanger
= property(getPhaseTapChanger
, setPhaseTapChanger
)