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.
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.
29 self
._Measurements
= []
30 self
.Measurements
= [] if Measurements
is None else Measurements
33 self
.Limits
= [] if Limits
is None else Limits
35 super(AccumulatorLimitSet
, self
).__init
__(*args
, **kw_args
)
41 _refs
= ["Measurements", "Limits"]
42 _many_refs
= ["Measurements", "Limits"]
44 def getMeasurements(self
):
45 """The Measurements using the LimitSet.
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
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
)
73 """The limit values used for supervision of Measurements.
77 def setLimits(self
, value
):
78 for x
in self
._Limits
:
84 Limits
= property(getLimits
, setLimits
)
86 def addLimits(self
, *Limits
):
89 self
._Limits
.append(obj
)
91 def removeLimits(self
, *Limits
):
94 self
._Limits
.remove(obj
)