Bumping version for release.
[PyCIM.git] / CIM14 / IEC61968 / WiresExt / DistributionTransformer.py
blob57110610c461f9c99a6b28b2394f6f29c2c22500
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.
21 """
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.
30 """
31 self._Windings = []
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)
45 _attrs = []
46 _attr_types = {}
47 _defaults = {}
48 _enums = {}
49 _refs = ["Windings", "ServiceDeliveryPoints", "TransformerBank", "TransformerInfo"]
50 _many_refs = ["Windings", "ServiceDeliveryPoints"]
52 def getWindings(self):
53 """All windings of this transformer.
54 """
55 return self._Windings
57 def setWindings(self, value):
58 for x in self._Windings:
59 x.Transformer = None
60 for y in value:
61 y._Transformer = self
62 self._Windings = value
64 Windings = property(getWindings, setWindings)
66 def addWindings(self, *Windings):
67 for obj in Windings:
68 obj.Transformer = self
70 def removeWindings(self, *Windings):
71 for obj in Windings:
72 obj.Transformer = None
74 def getServiceDeliveryPoints(self):
75 """All service delivery points supplied by this transformer.
76 """
77 return self._ServiceDeliveryPoints
79 def setServiceDeliveryPoints(self, value):
80 for x in self._ServiceDeliveryPoints:
81 x.Transformer = None
82 for y in value:
83 y._Transformer = self
84 self._ServiceDeliveryPoints = value
86 ServiceDeliveryPoints = property(getServiceDeliveryPoints, setServiceDeliveryPoints)
88 def addServiceDeliveryPoints(self, *ServiceDeliveryPoints):
89 for obj in ServiceDeliveryPoints:
90 obj.Transformer = self
92 def removeServiceDeliveryPoints(self, *ServiceDeliveryPoints):
93 for obj in ServiceDeliveryPoints:
94 obj.Transformer = None
96 def getTransformerBank(self):
97 """Bank this transformer belongs to.
98 """
99 return self._TransformerBank
101 def setTransformerBank(self, value):
102 if self._TransformerBank is not None:
103 filtered = [x for x in self.TransformerBank.Transformers if x != self]
104 self._TransformerBank._Transformers = filtered
106 self._TransformerBank = value
107 if self._TransformerBank is not None:
108 if self not in self._TransformerBank._Transformers:
109 self._TransformerBank._Transformers.append(self)
111 TransformerBank = property(getTransformerBank, setTransformerBank)
113 def getTransformerInfo(self):
114 """Transformer data.
116 return self._TransformerInfo
118 def setTransformerInfo(self, value):
119 if self._TransformerInfo is not None:
120 filtered = [x for x in self.TransformerInfo.Transformers if x != self]
121 self._TransformerInfo._Transformers = filtered
123 self._TransformerInfo = value
124 if self._TransformerInfo is not None:
125 if self not in self._TransformerInfo._Transformers:
126 self._TransformerInfo._Transformers.append(self)
128 TransformerInfo = property(getTransformerInfo, setTransformerInfo)