Update README.rst
[PyCIM.git] / CIM14 / CDPSM / Balanced / IEC61968 / WiresExt / DistributionTransformer.py
blobca7f652cbd836da813e7cf0848cbde7d59b2fa6b
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
19 # IN THE SOFTWARE.
21 from CIM14.CDPSM.Balanced.IEC61970.Core.Equipment import Equipment
23 class DistributionTransformer(Equipment):
24 """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.
25 """
27 def __init__(self, TransformerInfo=None, Windings=None, TransformerBank=None, *args, **kw_args):
28 """Initialises a new 'DistributionTransformer' instance.
30 @param TransformerInfo: Transformer data.
31 @param Windings: All windings of this transformer.
32 @param TransformerBank: Bank this transformer belongs to.
33 """
34 self._TransformerInfo = None
35 self.TransformerInfo = TransformerInfo
37 self._Windings = []
38 self.Windings = [] if Windings is None else Windings
40 self._TransformerBank = None
41 self.TransformerBank = TransformerBank
43 super(DistributionTransformer, self).__init__(*args, **kw_args)
45 _attrs = []
46 _attr_types = {}
47 _defaults = {}
48 _enums = {}
49 _refs = ["TransformerInfo", "Windings", "TransformerBank"]
50 _many_refs = ["Windings"]
52 def getTransformerInfo(self):
53 """Transformer data.
54 """
55 return self._TransformerInfo
57 def setTransformerInfo(self, value):
58 if self._TransformerInfo is not None:
59 filtered = [x for x in self.TransformerInfo.Transformers if x != self]
60 self._TransformerInfo._Transformers = filtered
62 self._TransformerInfo = value
63 if self._TransformerInfo is not None:
64 if self not in self._TransformerInfo._Transformers:
65 self._TransformerInfo._Transformers.append(self)
67 TransformerInfo = property(getTransformerInfo, setTransformerInfo)
69 def getWindings(self):
70 """All windings of this transformer.
71 """
72 return self._Windings
74 def setWindings(self, value):
75 for x in self._Windings:
76 x.Transformer = None
77 for y in value:
78 y._Transformer = self
79 self._Windings = value
81 Windings = property(getWindings, setWindings)
83 def addWindings(self, *Windings):
84 for obj in Windings:
85 obj.Transformer = self
87 def removeWindings(self, *Windings):
88 for obj in Windings:
89 obj.Transformer = None
91 def getTransformerBank(self):
92 """Bank this transformer belongs to.
93 """
94 return self._TransformerBank
96 def setTransformerBank(self, value):
97 if self._TransformerBank is not None:
98 filtered = [x for x in self.TransformerBank.Transformers if x != self]
99 self._TransformerBank._Transformers = filtered
101 self._TransformerBank = value
102 if self._TransformerBank is not None:
103 if self not in self._TransformerBank._Transformers:
104 self._TransformerBank._Transformers.append(self)
106 TransformerBank = property(getTransformerBank, setTransformerBank)