Adding CIM15 package.
[PyCIM.git] / CIM15 / IEC61970 / Wires / RegulationSchedule.py
blobbb89057660367f30ed0160b385b96849185b93ed
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 CIM15.IEC61970.LoadModel.SeasonDayTypeSchedule import SeasonDayTypeSchedule
23 class RegulationSchedule(SeasonDayTypeSchedule):
24 """A pre-established pattern over time for a controlled variable, e.g., busbar voltage.A pre-established pattern over time for a controlled variable, e.g., busbar voltage.
25 """
27 def __init__(self, RegulatingControl=None, VoltageControlZones=None, *args, **kw_args):
28 """Initialises a new 'RegulationSchedule' instance.
30 @param RegulatingControl: Regulating controls that have this Schedule.
31 @param VoltageControlZones: A VoltageControlZone may have a voltage regulation schedule.
32 """
33 self._RegulatingControl = None
34 self.RegulatingControl = RegulatingControl
36 self._VoltageControlZones = []
37 self.VoltageControlZones = [] if VoltageControlZones is None else VoltageControlZones
39 super(RegulationSchedule, self).__init__(*args, **kw_args)
41 _attrs = []
42 _attr_types = {}
43 _defaults = {}
44 _enums = {}
45 _refs = ["RegulatingControl", "VoltageControlZones"]
46 _many_refs = ["VoltageControlZones"]
48 def getRegulatingControl(self):
49 """Regulating controls that have this Schedule.
50 """
51 return self._RegulatingControl
53 def setRegulatingControl(self, value):
54 if self._RegulatingControl is not None:
55 filtered = [x for x in self.RegulatingControl.RegulationSchedule if x != self]
56 self._RegulatingControl._RegulationSchedule = filtered
58 self._RegulatingControl = value
59 if self._RegulatingControl is not None:
60 if self not in self._RegulatingControl._RegulationSchedule:
61 self._RegulatingControl._RegulationSchedule.append(self)
63 RegulatingControl = property(getRegulatingControl, setRegulatingControl)
65 def getVoltageControlZones(self):
66 """A VoltageControlZone may have a voltage regulation schedule.
67 """
68 return self._VoltageControlZones
70 def setVoltageControlZones(self, value):
71 for x in self._VoltageControlZones:
72 x.RegulationSchedule = None
73 for y in value:
74 y._RegulationSchedule = self
75 self._VoltageControlZones = value
77 VoltageControlZones = property(getVoltageControlZones, setVoltageControlZones)
79 def addVoltageControlZones(self, *VoltageControlZones):
80 for obj in VoltageControlZones:
81 obj.RegulationSchedule = self
83 def removeVoltageControlZones(self, *VoltageControlZones):
84 for obj in VoltageControlZones:
85 obj.RegulationSchedule = None