Fixing website and API documentation links
[PyCIM.git] / CIM14 / IEC61970 / Meas / Analog.py
bloba2853049df99f2f5034ad549368d8273569ae7ef
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.Measurement import Measurement
23 class Analog(Measurement):
24 """Analog represents an analog Measurement.
25 """
27 def __init__(self, positiveFlowIn=False, minValue=0.0, maxValue=0.0, normalValue=0.0, LimitSets=None, SetPoint=None, AnalogValues=None, *args, **kw_args):
28 """Initialises a new 'Analog' instance.
30 @param positiveFlowIn: If true then this measurement is an active power, reactive power or current with the convention that a positive value measured at the Terminal means power is flowing into the related PowerSystemResource.
31 @param minValue: Normal value range minimum for any of the MeasurementValue.values. Used for scaling, e.g. in bar graphs or of telemetered raw values
32 @param maxValue: Normal value range maximum for any of the MeasurementValue.values. Used for scaling, e.g. in bar graphs or of telemetered raw values.
33 @param normalValue: Normal measurement value, e.g., used for percentage calculations.
34 @param LimitSets: A measurement may have zero or more limit ranges defined for it.
35 @param SetPoint: The Control variable associated with the Measurement
36 @param AnalogValues: The values connected to this measurement.
37 """
38 #: If true then this measurement is an active power, reactive power or current with the convention that a positive value measured at the Terminal means power is flowing into the related PowerSystemResource.
39 self.positiveFlowIn = positiveFlowIn
41 #: Normal value range minimum for any of the MeasurementValue.values. Used for scaling, e.g. in bar graphs or of telemetered raw values
42 self.minValue = minValue
44 #: Normal value range maximum for any of the MeasurementValue.values. Used for scaling, e.g. in bar graphs or of telemetered raw values.
45 self.maxValue = maxValue
47 #: Normal measurement value, e.g., used for percentage calculations.
48 self.normalValue = normalValue
50 self._LimitSets = []
51 self.LimitSets = [] if LimitSets is None else LimitSets
53 self._SetPoint = None
54 self.SetPoint = SetPoint
56 self._AnalogValues = []
57 self.AnalogValues = [] if AnalogValues is None else AnalogValues
59 super(Analog, self).__init__(*args, **kw_args)
61 _attrs = ["positiveFlowIn", "minValue", "maxValue", "normalValue"]
62 _attr_types = {"positiveFlowIn": bool, "minValue": float, "maxValue": float, "normalValue": float}
63 _defaults = {"positiveFlowIn": False, "minValue": 0.0, "maxValue": 0.0, "normalValue": 0.0}
64 _enums = {}
65 _refs = ["LimitSets", "SetPoint", "AnalogValues"]
66 _many_refs = ["LimitSets", "AnalogValues"]
68 def getLimitSets(self):
69 """A measurement may have zero or more limit ranges defined for it.
70 """
71 return self._LimitSets
73 def setLimitSets(self, value):
74 for p in self._LimitSets:
75 filtered = [q for q in p.Measurements if q != self]
76 self._LimitSets._Measurements = filtered
77 for r in value:
78 if self not in r._Measurements:
79 r._Measurements.append(self)
80 self._LimitSets = value
82 LimitSets = property(getLimitSets, setLimitSets)
84 def addLimitSets(self, *LimitSets):
85 for obj in LimitSets:
86 if self not in obj._Measurements:
87 obj._Measurements.append(self)
88 self._LimitSets.append(obj)
90 def removeLimitSets(self, *LimitSets):
91 for obj in LimitSets:
92 if self in obj._Measurements:
93 obj._Measurements.remove(self)
94 self._LimitSets.remove(obj)
96 def getSetPoint(self):
97 """The Control variable associated with the Measurement
98 """
99 return self._SetPoint
101 def setSetPoint(self, value):
102 if self._SetPoint is not None:
103 self._SetPoint._Analog = None
105 self._SetPoint = value
106 if self._SetPoint is not None:
107 self._SetPoint.Analog = None
108 self._SetPoint._Analog = self
110 SetPoint = property(getSetPoint, setSetPoint)
112 def getAnalogValues(self):
113 """The values connected to this measurement.
115 return self._AnalogValues
117 def setAnalogValues(self, value):
118 for x in self._AnalogValues:
119 x.Analog = None
120 for y in value:
121 y._Analog = self
122 self._AnalogValues = value
124 AnalogValues = property(getAnalogValues, setAnalogValues)
126 def addAnalogValues(self, *AnalogValues):
127 for obj in AnalogValues:
128 obj.Analog = self
130 def removeAnalogValues(self, *AnalogValues):
131 for obj in AnalogValues:
132 obj.Analog = None