Update README.rst
[PyCIM.git] / CIM14 / IEC61968 / WiresExt / PhaseImpedanceData.py
blobec82102f90970e71ed34abdee21970f92f8ed002
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.Element import Element
23 class PhaseImpedanceData(Element):
24 """Triplet of resistance, reactance, and susceptance matrix element values.
25 """
27 def __init__(self, r=0.0, x=0.0, sequenceNumber=0, b=0.0, PhaseImpedance=None, *args, **kw_args):
28 """Initialises a new 'PhaseImpedanceData' instance.
30 @param r: Resistance matrix element value, per length of unit.
31 @param x: Reactance matrix element value, per length of unit.
32 @param sequenceNumber: Column-wise element index, assuming a symmetrical matrix. Ranges from 1 to N + N*(N-1)/2.
33 @param b: Susceptance matrix element value, per length of unit.
34 @param PhaseImpedance: Conductor phase impedance to which this data belongs.
35 """
36 #: Resistance matrix element value, per length of unit.
37 self.r = r
39 #: Reactance matrix element value, per length of unit.
40 self.x = x
42 #: Column-wise element index, assuming a symmetrical matrix. Ranges from 1 to N + N*(N-1)/2.
43 self.sequenceNumber = sequenceNumber
45 #: Susceptance matrix element value, per length of unit.
46 self.b = b
48 self._PhaseImpedance = None
49 self.PhaseImpedance = PhaseImpedance
51 super(PhaseImpedanceData, self).__init__(*args, **kw_args)
53 _attrs = ["r", "x", "sequenceNumber", "b"]
54 _attr_types = {"r": float, "x": float, "sequenceNumber": int, "b": float}
55 _defaults = {"r": 0.0, "x": 0.0, "sequenceNumber": 0, "b": 0.0}
56 _enums = {}
57 _refs = ["PhaseImpedance"]
58 _many_refs = []
60 def getPhaseImpedance(self):
61 """Conductor phase impedance to which this data belongs.
62 """
63 return self._PhaseImpedance
65 def setPhaseImpedance(self, value):
66 if self._PhaseImpedance is not None:
67 filtered = [x for x in self.PhaseImpedance.PhaseImpedanceData if x != self]
68 self._PhaseImpedance._PhaseImpedanceData = filtered
70 self._PhaseImpedance = value
71 if self._PhaseImpedance is not None:
72 if self not in self._PhaseImpedance._PhaseImpedanceData:
73 self._PhaseImpedance._PhaseImpedanceData.append(self)
75 PhaseImpedance = property(getPhaseImpedance, setPhaseImpedance)