1 # Copyright (C) 2010 Richard Lincoln
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA, USA
17 from CIM14
.IEC61970
.Core
.Equipment
import Equipment
19 class DistributionTransformer(Equipment
):
20 """An assembly of two or more coupled windings that transform electrical power between voltage levels. Supports both balanced and unbalanced winding connections. This class differs from Wires::PowerTransformer as follows: - it is part of a TransformerBank - it draws parameters exclusively from TransformerInfo and its associated classes.
23 def __init__(self
, Windings
=None, ServiceDeliveryPoints
=None, TransformerBank
=None, TransformerInfo
=None, *args
, **kw_args
):
24 """Initialises a new 'DistributionTransformer' instance.
26 @param Windings: All windings of this transformer.
27 @param ServiceDeliveryPoints: All service delivery points supplied by this transformer.
28 @param TransformerBank: Bank this transformer belongs to.
29 @param TransformerInfo: Transformer data.
32 self
.Windings
= [] if Windings
is None else Windings
34 self
._ServiceDeliveryPoints
= []
35 self
.ServiceDeliveryPoints
= [] if ServiceDeliveryPoints
is None else ServiceDeliveryPoints
37 self
._TransformerBank
= None
38 self
.TransformerBank
= TransformerBank
40 self
._TransformerInfo
= None
41 self
.TransformerInfo
= TransformerInfo
43 super(DistributionTransformer
, self
).__init
__(*args
, **kw_args
)
49 _refs
= ["Windings", "ServiceDeliveryPoints", "TransformerBank", "TransformerInfo"]
50 _many_refs
= ["Windings", "ServiceDeliveryPoints"]
52 def getWindings(self
):
53 """All windings of this transformer.
57 def setWindings(self
, value
):
58 for x
in self
._Windings
:
62 self
._Windings
= value
64 Windings
= property(getWindings
, setWindings
)
66 def addWindings(self
, *Windings
):
68 obj
._Transformer
= self
69 self
._Windings
.append(obj
)
71 def removeWindings(self
, *Windings
):
73 obj
._Transformer
= None
74 self
._Windings
.remove(obj
)
76 def getServiceDeliveryPoints(self
):
77 """All service delivery points supplied by this transformer.
79 return self
._ServiceDeliveryPoints
81 def setServiceDeliveryPoints(self
, value
):
82 for x
in self
._ServiceDeliveryPoints
:
86 self
._ServiceDeliveryPoints
= value
88 ServiceDeliveryPoints
= property(getServiceDeliveryPoints
, setServiceDeliveryPoints
)
90 def addServiceDeliveryPoints(self
, *ServiceDeliveryPoints
):
91 for obj
in ServiceDeliveryPoints
:
92 obj
._Transformer
= self
93 self
._ServiceDeliveryPoints
.append(obj
)
95 def removeServiceDeliveryPoints(self
, *ServiceDeliveryPoints
):
96 for obj
in ServiceDeliveryPoints
:
97 obj
._Transformer
= None
98 self
._ServiceDeliveryPoints
.remove(obj
)
100 def getTransformerBank(self
):
101 """Bank this transformer belongs to.
103 return self
._TransformerBank
105 def setTransformerBank(self
, value
):
106 if self
._TransformerBank
is not None:
107 filtered
= [x
for x
in self
.TransformerBank
.Transformers
if x
!= self
]
108 self
._TransformerBank
._Transformers
= filtered
110 self
._TransformerBank
= value
111 if self
._TransformerBank
is not None:
112 self
._TransformerBank
._Transformers
.append(self
)
114 TransformerBank
= property(getTransformerBank
, setTransformerBank
)
116 def getTransformerInfo(self
):
119 return self
._TransformerInfo
121 def setTransformerInfo(self
, value
):
122 if self
._TransformerInfo
is not None:
123 filtered
= [x
for x
in self
.TransformerInfo
.Transformers
if x
!= self
]
124 self
._TransformerInfo
._Transformers
= filtered
126 self
._TransformerInfo
= value
127 if self
._TransformerInfo
is not None:
128 self
._TransformerInfo
._Transformers
.append(self
)
130 TransformerInfo
= property(getTransformerInfo
, setTransformerInfo
)