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
.BasicIntervalSchedule
import BasicIntervalSchedule
19 class RegularIntervalSchedule(BasicIntervalSchedule
):
20 """The schedule has TimePoints where the time between them is constant.
23 def __init__(self
, endTime
='', timeStep
=0.0, TimePoints
=None, *args
, **kw_args
):
24 """Initialises a new 'RegularIntervalSchedule' instance.
26 @param endTime: The time for the last time point.
27 @param timeStep: The time between each pair of subsequent RegularTimePoints.
28 @param TimePoints: The point data values that define a curve
30 #: The time for the last time point.
31 self
.endTime
= endTime
33 #: The time between each pair of subsequent RegularTimePoints.
34 self
.timeStep
= timeStep
37 self
.TimePoints
= [] if TimePoints
is None else TimePoints
39 super(RegularIntervalSchedule
, self
).__init
__(*args
, **kw_args
)
41 _attrs
= ["endTime", "timeStep"]
42 _attr_types
= {"endTime": str, "timeStep": float}
43 _defaults
= {"endTime": '', "timeStep": 0.0}
45 _refs
= ["TimePoints"]
46 _many_refs
= ["TimePoints"]
48 def getTimePoints(self
):
49 """The point data values that define a curve
51 return self
._TimePoints
53 def setTimePoints(self
, value
):
54 for x
in self
._TimePoints
:
55 x
.IntervalSchedule
= None
57 y
._IntervalSchedule
= self
58 self
._TimePoints
= value
60 TimePoints
= property(getTimePoints
, setTimePoints
)
62 def addTimePoints(self
, *TimePoints
):
63 for obj
in TimePoints
:
64 obj
.IntervalSchedule
= self
66 def removeTimePoints(self
, *TimePoints
):
67 for obj
in TimePoints
:
68 obj
.IntervalSchedule
= None