Update README.rst
[PyCIM.git] / CIM14 / IEC61970 / ControlArea / AltTieMeas.py
blob00d81eb50e6526d66d75b7f51efb9fa526c8a429
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 AltTieMeas(Element):
24 """A prioritized measurement to be used for the tie flow as part of the control area specification.
25 """
27 def __init__(self, priority=0, AnalogValue=None, TieFlow=None, *args, **kw_args):
28 """Initialises a new 'AltTieMeas' instance.
30 @param priority: Priority of a measurement usage. Lower numbers have first priority.
31 @param AnalogValue: The specific analog value used as a source.
32 @param TieFlow: The tie flow of the alternate measurements.
33 """
34 #: Priority of a measurement usage. Lower numbers have first priority.
35 self.priority = priority
37 self._AnalogValue = None
38 self.AnalogValue = AnalogValue
40 self._TieFlow = None
41 self.TieFlow = TieFlow
43 super(AltTieMeas, self).__init__(*args, **kw_args)
45 _attrs = ["priority"]
46 _attr_types = {"priority": int}
47 _defaults = {"priority": 0}
48 _enums = {}
49 _refs = ["AnalogValue", "TieFlow"]
50 _many_refs = []
52 def getAnalogValue(self):
53 """The specific analog value used as a source.
54 """
55 return self._AnalogValue
57 def setAnalogValue(self, value):
58 if self._AnalogValue is not None:
59 filtered = [x for x in self.AnalogValue.AltTieMeas if x != self]
60 self._AnalogValue._AltTieMeas = filtered
62 self._AnalogValue = value
63 if self._AnalogValue is not None:
64 if self not in self._AnalogValue._AltTieMeas:
65 self._AnalogValue._AltTieMeas.append(self)
67 AnalogValue = property(getAnalogValue, setAnalogValue)
69 def getTieFlow(self):
70 """The tie flow of the alternate measurements.
71 """
72 return self._TieFlow
74 def setTieFlow(self, value):
75 if self._TieFlow is not None:
76 filtered = [x for x in self.TieFlow.AltTieMeas if x != self]
77 self._TieFlow._AltTieMeas = filtered
79 self._TieFlow = value
80 if self._TieFlow is not None:
81 if self not in self._TieFlow._AltTieMeas:
82 self._TieFlow._AltTieMeas.append(self)
84 TieFlow = property(getTieFlow, setTieFlow)