Fixing website and API documentation links
[PyCIM.git] / CIM14 / IEC61970 / Meas / MeasurementValue.py
blobda613864d21bebb764181b229d75738dbc2960a5
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.Core.IdentifiedObject import IdentifiedObject
23 class MeasurementValue(IdentifiedObject):
24 """The current state for a measurement. A state value is an instance of a measurement from a specific source. Measurements can be associated with many state values, each representing a different source for the measurement.
25 """
27 def __init__(self, sensorAccuracy=0.0, timeStamp='', MeasurementValueSource=None, RemoteSource=None, MeasurementValueQuality=None, *args, **kw_args):
28 """Initialises a new 'MeasurementValue' instance.
30 @param sensorAccuracy: The limit, expressed as a percentage of the sensor maximum, that errors will not exceed when the sensor is used under reference conditions.
31 @param timeStamp: The time when the value was last updated
32 @param MeasurementValueSource: A reference to the type of source that updates the MeasurementValue, e.g. SCADA, CCLink, manual, etc. User conventions for the names of sources are contained in the introduction to IEC 61970-301.
33 @param RemoteSource: Link to the physical telemetered point associated with this measurement.
34 @param MeasurementValueQuality: A MeasurementValue has a MeasurementValueQuality associated with it.
35 """
36 #: The limit, expressed as a percentage of the sensor maximum, that errors will not exceed when the sensor is used under reference conditions.
37 self.sensorAccuracy = sensorAccuracy
39 #: The time when the value was last updated
40 self.timeStamp = timeStamp
42 self._MeasurementValueSource = None
43 self.MeasurementValueSource = MeasurementValueSource
45 self._RemoteSource = None
46 self.RemoteSource = RemoteSource
48 self._MeasurementValueQuality = None
49 self.MeasurementValueQuality = MeasurementValueQuality
51 super(MeasurementValue, self).__init__(*args, **kw_args)
53 _attrs = ["sensorAccuracy", "timeStamp"]
54 _attr_types = {"sensorAccuracy": float, "timeStamp": str}
55 _defaults = {"sensorAccuracy": 0.0, "timeStamp": ''}
56 _enums = {}
57 _refs = ["MeasurementValueSource", "RemoteSource", "MeasurementValueQuality"]
58 _many_refs = []
60 def getMeasurementValueSource(self):
61 """A reference to the type of source that updates the MeasurementValue, e.g. SCADA, CCLink, manual, etc. User conventions for the names of sources are contained in the introduction to IEC 61970-301.
62 """
63 return self._MeasurementValueSource
65 def setMeasurementValueSource(self, value):
66 if self._MeasurementValueSource is not None:
67 filtered = [x for x in self.MeasurementValueSource.MeasurementValues if x != self]
68 self._MeasurementValueSource._MeasurementValues = filtered
70 self._MeasurementValueSource = value
71 if self._MeasurementValueSource is not None:
72 if self not in self._MeasurementValueSource._MeasurementValues:
73 self._MeasurementValueSource._MeasurementValues.append(self)
75 MeasurementValueSource = property(getMeasurementValueSource, setMeasurementValueSource)
77 def getRemoteSource(self):
78 """Link to the physical telemetered point associated with this measurement.
79 """
80 return self._RemoteSource
82 def setRemoteSource(self, value):
83 if self._RemoteSource is not None:
84 self._RemoteSource._MeasurementValue = None
86 self._RemoteSource = value
87 if self._RemoteSource is not None:
88 self._RemoteSource.MeasurementValue = None
89 self._RemoteSource._MeasurementValue = self
91 RemoteSource = property(getRemoteSource, setRemoteSource)
93 def getMeasurementValueQuality(self):
94 """A MeasurementValue has a MeasurementValueQuality associated with it.
95 """
96 return self._MeasurementValueQuality
98 def setMeasurementValueQuality(self, value):
99 if self._MeasurementValueQuality is not None:
100 self._MeasurementValueQuality._MeasurementValue = None
102 self._MeasurementValueQuality = value
103 if self._MeasurementValueQuality is not None:
104 self._MeasurementValueQuality.MeasurementValue = None
105 self._MeasurementValueQuality._MeasurementValue = self
107 MeasurementValueQuality = property(getMeasurementValueQuality, setMeasurementValueQuality)