Implementing RDF/XML serialisation using meta-data attributes.
[PyCIM.git] / schemata / CIM14 / IEC61970 / Meas / MeasurementValue.py
blob0048d497cef86eeec25636b4be05476ca07a479f
1 # Copyright (C) 2010 Richard Lincoln
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA, USA
17 from CIM14.IEC61970.Core.IdentifiedObject import IdentifiedObject
19 class MeasurementValue(IdentifiedObject):
20 """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.
21 """
23 def __init__(self, sensorAccuracy=0.0, timeStamp='', MeasurementValueSource=None, RemoteSource=None, MeasurementValueQuality=None, *args, **kw_args):
24 """Initialises a new 'MeasurementValue' instance.
26 @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.
27 @param timeStamp: The time when the value was last updated
28 @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.
29 @param RemoteSource: Link to the physical telemetered point associated with this measurement.
30 @param MeasurementValueQuality: A MeasurementValue has a MeasurementValueQuality associated with it.
31 """
32 #: The limit, expressed as a percentage of the sensor maximum, that errors will not exceed when the sensor is used under reference conditions.
33 self.sensorAccuracy = sensorAccuracy
35 #: The time when the value was last updated
36 self.timeStamp = timeStamp
38 self._MeasurementValueSource = None
39 self.MeasurementValueSource = MeasurementValueSource
41 self._RemoteSource = None
42 self.RemoteSource = RemoteSource
44 self._MeasurementValueQuality = None
45 self.MeasurementValueQuality = MeasurementValueQuality
47 super(MeasurementValue, self).__init__(*args, **kw_args)
49 _attrs = ["sensorAccuracy", "timeStamp"]
50 _attr_types = {"sensorAccuracy": float, "timeStamp": str}
51 _defaults = {"sensorAccuracy": 0.0, "timeStamp": ''}
52 _enums = {}
53 _refs = ["MeasurementValueSource", "RemoteSource", "MeasurementValueQuality"]
54 _many_refs = []
56 def getMeasurementValueSource(self):
57 """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.
58 """
59 return self._MeasurementValueSource
61 def setMeasurementValueSource(self, value):
62 if self._MeasurementValueSource is not None:
63 filtered = [x for x in self.MeasurementValueSource.MeasurementValues if x != self]
64 self._MeasurementValueSource._MeasurementValues = filtered
66 self._MeasurementValueSource = value
67 if self._MeasurementValueSource is not None:
68 self._MeasurementValueSource._MeasurementValues.append(self)
70 MeasurementValueSource = property(getMeasurementValueSource, setMeasurementValueSource)
72 def getRemoteSource(self):
73 """Link to the physical telemetered point associated with this measurement.
74 """
75 return self._RemoteSource
77 def setRemoteSource(self, value):
78 if self._RemoteSource is not None:
79 self._RemoteSource._MeasurementValue = None
81 self._RemoteSource = value
82 if self._RemoteSource is not None:
83 self._RemoteSource._MeasurementValue = self
85 RemoteSource = property(getRemoteSource, setRemoteSource)
87 def getMeasurementValueQuality(self):
88 """A MeasurementValue has a MeasurementValueQuality associated with it.
89 """
90 return self._MeasurementValueQuality
92 def setMeasurementValueQuality(self, value):
93 if self._MeasurementValueQuality is not None:
94 self._MeasurementValueQuality._MeasurementValue = None
96 self._MeasurementValueQuality = value
97 if self._MeasurementValueQuality is not None:
98 self._MeasurementValueQuality._MeasurementValue = self
100 MeasurementValueQuality = property(getMeasurementValueQuality, setMeasurementValueQuality)