Removing package directories.
[PyCIM.git] / CIM14 / IEC61970 / Meas / AccumulatorLimitSet.py
blob92ae2ac69166cbf6c6a599924bcd5aa372d3ddbf
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.Meas.LimitSet import LimitSet
19 class AccumulatorLimitSet(LimitSet):
20 """An AccumulatorLimitSet specifies a set of Limits that are associated with an Accumulator measurement.
21 """
23 def __init__(self, Measurements=None, Limits=None, *args, **kw_args):
24 """Initialises a new 'AccumulatorLimitSet' instance.
26 @param Measurements: The Measurements using the LimitSet.
27 @param Limits: The limit values used for supervision of Measurements.
28 """
29 self._Measurements = []
30 self.Measurements = [] if Measurements is None else Measurements
32 self._Limits = []
33 self.Limits = [] if Limits is None else Limits
35 super(AccumulatorLimitSet, self).__init__(*args, **kw_args)
37 _attrs = []
38 _attr_types = {}
39 _defaults = {}
40 _enums = {}
41 _refs = ["Measurements", "Limits"]
42 _many_refs = ["Measurements", "Limits"]
44 def getMeasurements(self):
45 """The Measurements using the LimitSet.
46 """
47 return self._Measurements
49 def setMeasurements(self, value):
50 for p in self._Measurements:
51 filtered = [q for q in p.LimitSets if q != self]
52 self._Measurements._LimitSets = filtered
53 for r in value:
54 if self not in r._LimitSets:
55 r._LimitSets.append(self)
56 self._Measurements = value
58 Measurements = property(getMeasurements, setMeasurements)
60 def addMeasurements(self, *Measurements):
61 for obj in Measurements:
62 if self not in obj._LimitSets:
63 obj._LimitSets.append(self)
64 self._Measurements.append(obj)
66 def removeMeasurements(self, *Measurements):
67 for obj in Measurements:
68 if self in obj._LimitSets:
69 obj._LimitSets.remove(self)
70 self._Measurements.remove(obj)
72 def getLimits(self):
73 """The limit values used for supervision of Measurements.
74 """
75 return self._Limits
77 def setLimits(self, value):
78 for x in self._Limits:
79 x._LimitSet = None
80 for y in value:
81 y._LimitSet = self
82 self._Limits = value
84 Limits = property(getLimits, setLimits)
86 def addLimits(self, *Limits):
87 for obj in Limits:
88 obj._LimitSet = self
89 self._Limits.append(obj)
91 def removeLimits(self, *Limits):
92 for obj in Limits:
93 obj._LimitSet = None
94 self._Limits.remove(obj)