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
.CDPSM
.Balanced
.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
, rground
=0.0, xground
=0.0, grounded
=False, WindingInfo
=None, Transformer
=None, RatioTapChanger
=None, PiImpedance
=None, *args
, **kw_args
):
28 """Initialises a new 'DistributionTransformerWinding' instance.
30 @param rground: (for Yn and Zn connections) Resistance part of neutral impedance where 'grounded' is true.
31 @param xground: (for Yn and Zn connections) Reactive part of neutral impedance where 'grounded' is true.
32 @param grounded: (for Yn and Zn connections) True if the neutral is solidly grounded.
33 @param WindingInfo: Data for this winding.
34 @param Transformer: Transformer this winding belongs to.
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.
38 #: (for Yn and Zn connections) Resistance part of neutral impedance where 'grounded' is true.
39 self
.rground
= rground
41 #: (for Yn and Zn connections) Reactive part of neutral impedance where 'grounded' is true.
42 self
.xground
= xground
44 #: (for Yn and Zn connections) True if the neutral is solidly grounded.
45 self
.grounded
= grounded
47 self
._WindingInfo
= None
48 self
.WindingInfo
= WindingInfo
50 self
._Transformer
= None
51 self
.Transformer
= Transformer
53 self
._RatioTapChanger
= None
54 self
.RatioTapChanger
= RatioTapChanger
56 self
._PiImpedance
= None
57 self
.PiImpedance
= PiImpedance
59 super(DistributionTransformerWinding
, self
).__init
__(*args
, **kw_args
)
61 _attrs
= ["rground", "xground", "grounded"]
62 _attr_types
= {"rground": float, "xground": float, "grounded": bool}
63 _defaults
= {"rground": 0.0, "xground": 0.0, "grounded": False}
65 _refs
= ["WindingInfo", "Transformer", "RatioTapChanger", "PiImpedance"]
68 def getWindingInfo(self
):
69 """Data for this winding.
71 return self
._WindingInfo
73 def setWindingInfo(self
, value
):
74 if self
._WindingInfo
is not None:
75 filtered
= [x
for x
in self
.WindingInfo
.Windings
if x
!= self
]
76 self
._WindingInfo
._Windings
= filtered
78 self
._WindingInfo
= value
79 if self
._WindingInfo
is not None:
80 if self
not in self
._WindingInfo
._Windings
:
81 self
._WindingInfo
._Windings
.append(self
)
83 WindingInfo
= property(getWindingInfo
, setWindingInfo
)
85 def getTransformer(self
):
86 """Transformer this winding belongs to.
88 return self
._Transformer
90 def setTransformer(self
, value
):
91 if self
._Transformer
is not None:
92 filtered
= [x
for x
in self
.Transformer
.Windings
if x
!= self
]
93 self
._Transformer
._Windings
= filtered
95 self
._Transformer
= value
96 if self
._Transformer
is not None:
97 if self
not in self
._Transformer
._Windings
:
98 self
._Transformer
._Windings
.append(self
)
100 Transformer
= property(getTransformer
, setTransformer
)
102 def getRatioTapChanger(self
):
103 """Ratio tap changer associated with this winding.
105 return self
._RatioTapChanger
107 def setRatioTapChanger(self
, value
):
108 if self
._RatioTapChanger
is not None:
109 self
._RatioTapChanger
._Winding
= None
111 self
._RatioTapChanger
= value
112 if self
._RatioTapChanger
is not None:
113 self
._RatioTapChanger
.Winding
= None
114 self
._RatioTapChanger
._Winding
= self
116 RatioTapChanger
= property(getRatioTapChanger
, setRatioTapChanger
)
118 def getPiImpedance(self
):
119 """(accurate for 2- or 3-winding transformers only) Pi-model impedances of this winding.
121 return self
._PiImpedance
123 def setPiImpedance(self
, value
):
124 if self
._PiImpedance
is not None:
125 filtered
= [x
for x
in self
.PiImpedance
.Windings
if x
!= self
]
126 self
._PiImpedance
._Windings
= filtered
128 self
._PiImpedance
= value
129 if self
._PiImpedance
is not None:
130 if self
not in self
._PiImpedance
._Windings
:
131 self
._PiImpedance
._Windings
.append(self
)
133 PiImpedance
= property(getPiImpedance
, setPiImpedance
)