Update README.rst
[PyCIM.git] / CIM14 / CDPSM / Balanced / IEC61968 / AssetModels / ToWindingSpec.py
blob239896b1e5709513e2868f5bdadd5d4d79486890
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.IdentifiedObject import IdentifiedObject
23 class ToWindingSpec(IdentifiedObject):
24 """For short-circuit tests, specifies the winding and tap for all short-circuited windings. For open-circuit tests, specifies the winding, tap, induced voltage, and induced angle for any non-excited windings that were measured during the test. This won't apply if only the exciting current and no-load losses were measured.
25 """
27 def __init__(self, toTapStep=0, voltage=0.0, phaseShift=0.0, OpenCircuitTests=None, ShortCircuitTests=None, ToWinding=None, *args, **kw_args):
28 """Initialises a new 'ToWindingSpec' instance.
30 @param toTapStep: Tap step number for the 'to' winding of the test pair.
31 @param voltage: (if open-circuit test) Voltage measured at the open-circuited 'to' winding, with the 'from' winding set to the 'from' winding's rated voltage and all other windings open-circuited.
32 @param phaseShift: (if open-circuit test) Phase shift measured at the open-circuited 'to' winding, with the 'from' winding set to the 'from' winding's rated voltage and all other windings open-circuited.
33 @param OpenCircuitTests: All open-circuit tests in which this winding was measured.
34 @param ShortCircuitTests: All short-circuit tests in which this winding was short-circuited.
35 @param ToWinding: Winding short-circuited in a short-circuit test, or measured for induced voltage and angle in an open-circuit test.
36 """
37 #: Tap step number for the 'to' winding of the test pair.
38 self.toTapStep = toTapStep
40 #: (if open-circuit test) Voltage measured at the open-circuited 'to' winding, with the 'from' winding set to the 'from' winding's rated voltage and all other windings open-circuited.
41 self.voltage = voltage
43 #: (if open-circuit test) Phase shift measured at the open-circuited 'to' winding, with the 'from' winding set to the 'from' winding's rated voltage and all other windings open-circuited.
44 self.phaseShift = phaseShift
46 self._OpenCircuitTests = []
47 self.OpenCircuitTests = [] if OpenCircuitTests is None else OpenCircuitTests
49 self._ShortCircuitTests = []
50 self.ShortCircuitTests = [] if ShortCircuitTests is None else ShortCircuitTests
52 self._ToWinding = None
53 self.ToWinding = ToWinding
55 super(ToWindingSpec, self).__init__(*args, **kw_args)
57 _attrs = ["toTapStep", "voltage", "phaseShift"]
58 _attr_types = {"toTapStep": int, "voltage": float, "phaseShift": float}
59 _defaults = {"toTapStep": 0, "voltage": 0.0, "phaseShift": 0.0}
60 _enums = {}
61 _refs = ["OpenCircuitTests", "ShortCircuitTests", "ToWinding"]
62 _many_refs = ["OpenCircuitTests", "ShortCircuitTests"]
64 def getOpenCircuitTests(self):
65 """All open-circuit tests in which this winding was measured.
66 """
67 return self._OpenCircuitTests
69 def setOpenCircuitTests(self, value):
70 for p in self._OpenCircuitTests:
71 filtered = [q for q in p.MeasuredWindingSpecs if q != self]
72 self._OpenCircuitTests._MeasuredWindingSpecs = filtered
73 for r in value:
74 if self not in r._MeasuredWindingSpecs:
75 r._MeasuredWindingSpecs.append(self)
76 self._OpenCircuitTests = value
78 OpenCircuitTests = property(getOpenCircuitTests, setOpenCircuitTests)
80 def addOpenCircuitTests(self, *OpenCircuitTests):
81 for obj in OpenCircuitTests:
82 if self not in obj._MeasuredWindingSpecs:
83 obj._MeasuredWindingSpecs.append(self)
84 self._OpenCircuitTests.append(obj)
86 def removeOpenCircuitTests(self, *OpenCircuitTests):
87 for obj in OpenCircuitTests:
88 if self in obj._MeasuredWindingSpecs:
89 obj._MeasuredWindingSpecs.remove(self)
90 self._OpenCircuitTests.remove(obj)
92 def getShortCircuitTests(self):
93 """All short-circuit tests in which this winding was short-circuited.
94 """
95 return self._ShortCircuitTests
97 def setShortCircuitTests(self, value):
98 for p in self._ShortCircuitTests:
99 filtered = [q for q in p.ShortedWindingSpecs if q != self]
100 self._ShortCircuitTests._ShortedWindingSpecs = filtered
101 for r in value:
102 if self not in r._ShortedWindingSpecs:
103 r._ShortedWindingSpecs.append(self)
104 self._ShortCircuitTests = value
106 ShortCircuitTests = property(getShortCircuitTests, setShortCircuitTests)
108 def addShortCircuitTests(self, *ShortCircuitTests):
109 for obj in ShortCircuitTests:
110 if self not in obj._ShortedWindingSpecs:
111 obj._ShortedWindingSpecs.append(self)
112 self._ShortCircuitTests.append(obj)
114 def removeShortCircuitTests(self, *ShortCircuitTests):
115 for obj in ShortCircuitTests:
116 if self in obj._ShortedWindingSpecs:
117 obj._ShortedWindingSpecs.remove(self)
118 self._ShortCircuitTests.remove(obj)
120 def getToWinding(self):
121 """Winding short-circuited in a short-circuit test, or measured for induced voltage and angle in an open-circuit test.
123 return self._ToWinding
125 def setToWinding(self, value):
126 if self._ToWinding is not None:
127 filtered = [x for x in self.ToWinding.ToWindingSpecs if x != self]
128 self._ToWinding._ToWindingSpecs = filtered
130 self._ToWinding = value
131 if self._ToWinding is not None:
132 if self not in self._ToWinding._ToWindingSpecs:
133 self._ToWinding._ToWindingSpecs.append(self)
135 ToWinding = property(getToWinding, setToWinding)