Fixing website and API documentation links
[PyCIM.git] / CIM14 / IEC61970 / Meas / AnalogValue.py
blob46e8171dd9c7e0d9181331376d3af9f08e4487ec
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.IEC61970.Meas.MeasurementValue import MeasurementValue
23 class AnalogValue(MeasurementValue):
24 """AnalogValue represents an analog MeasurementValue.
25 """
27 def __init__(self, value=0.0, AltTieMeas=None, Analog=None, AltGeneratingUnit=None, *args, **kw_args):
28 """Initialises a new 'AnalogValue' instance.
30 @param value: The value to supervise.
31 @param AltTieMeas: The usage of the measurement within the control area specification.
32 @param Analog: Measurement to which this value is connected.
33 @param AltGeneratingUnit: The alternate generating unit for which this measurement value applies.
34 """
35 #: The value to supervise.
36 self.value = value
38 self._AltTieMeas = []
39 self.AltTieMeas = [] if AltTieMeas is None else AltTieMeas
41 self._Analog = None
42 self.Analog = Analog
44 self._AltGeneratingUnit = []
45 self.AltGeneratingUnit = [] if AltGeneratingUnit is None else AltGeneratingUnit
47 super(AnalogValue, self).__init__(*args, **kw_args)
49 _attrs = ["value"]
50 _attr_types = {"value": float}
51 _defaults = {"value": 0.0}
52 _enums = {}
53 _refs = ["AltTieMeas", "Analog", "AltGeneratingUnit"]
54 _many_refs = ["AltTieMeas", "AltGeneratingUnit"]
56 def getAltTieMeas(self):
57 """The usage of the measurement within the control area specification.
58 """
59 return self._AltTieMeas
61 def setAltTieMeas(self, value):
62 for x in self._AltTieMeas:
63 x.AnalogValue = None
64 for y in value:
65 y._AnalogValue = self
66 self._AltTieMeas = value
68 AltTieMeas = property(getAltTieMeas, setAltTieMeas)
70 def addAltTieMeas(self, *AltTieMeas):
71 for obj in AltTieMeas:
72 obj.AnalogValue = self
74 def removeAltTieMeas(self, *AltTieMeas):
75 for obj in AltTieMeas:
76 obj.AnalogValue = None
78 def getAnalog(self):
79 """Measurement to which this value is connected.
80 """
81 return self._Analog
83 def setAnalog(self, value):
84 if self._Analog is not None:
85 filtered = [x for x in self.Analog.AnalogValues if x != self]
86 self._Analog._AnalogValues = filtered
88 self._Analog = value
89 if self._Analog is not None:
90 if self not in self._Analog._AnalogValues:
91 self._Analog._AnalogValues.append(self)
93 Analog = property(getAnalog, setAnalog)
95 def getAltGeneratingUnit(self):
96 """The alternate generating unit for which this measurement value applies.
97 """
98 return self._AltGeneratingUnit
100 def setAltGeneratingUnit(self, value):
101 for x in self._AltGeneratingUnit:
102 x.AnalogValue = None
103 for y in value:
104 y._AnalogValue = self
105 self._AltGeneratingUnit = value
107 AltGeneratingUnit = property(getAltGeneratingUnit, setAltGeneratingUnit)
109 def addAltGeneratingUnit(self, *AltGeneratingUnit):
110 for obj in AltGeneratingUnit:
111 obj.AnalogValue = self
113 def removeAltGeneratingUnit(self, *AltGeneratingUnit):
114 for obj in AltGeneratingUnit:
115 obj.AnalogValue = None