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
21 from CIM14
.IEC61970
.LoadModel
.SeasonDayTypeSchedule
import SeasonDayTypeSchedule
23 class RegulationSchedule(SeasonDayTypeSchedule
):
24 """A pre-established pattern over time for a controlled variable, e.g., busbar voltage.
27 def __init__(self
, lineDropX
=0.0, lineDropR
=0.0, lineDropCompensation
=False, RegulatingControl
=None, VoltageControlZones
=None, *args
, **kw_args
):
28 """Initialises a new 'RegulationSchedule' instance.
30 @param lineDropX: Line drop reactance.
31 @param lineDropR: Line drop resistance.
32 @param lineDropCompensation: Flag to indicate that line drop compensation is to be applied
33 @param RegulatingControl: Regulating controls that have this Schedule.
34 @param VoltageControlZones: A VoltageControlZone may have a voltage regulation schedule.
36 #: Line drop reactance.
37 self
.lineDropX
= lineDropX
39 #: Line drop resistance.
40 self
.lineDropR
= lineDropR
42 #: Flag to indicate that line drop compensation is to be applied
43 self
.lineDropCompensation
= lineDropCompensation
45 self
._RegulatingControl
= None
46 self
.RegulatingControl
= RegulatingControl
48 self
._VoltageControlZones
= []
49 self
.VoltageControlZones
= [] if VoltageControlZones
is None else VoltageControlZones
51 super(RegulationSchedule
, self
).__init
__(*args
, **kw_args
)
53 _attrs
= ["lineDropX", "lineDropR", "lineDropCompensation"]
54 _attr_types
= {"lineDropX": float, "lineDropR": float, "lineDropCompensation": bool}
55 _defaults
= {"lineDropX": 0.0, "lineDropR": 0.0, "lineDropCompensation": False}
57 _refs
= ["RegulatingControl", "VoltageControlZones"]
58 _many_refs
= ["VoltageControlZones"]
60 def getRegulatingControl(self
):
61 """Regulating controls that have this Schedule.
63 return self
._RegulatingControl
65 def setRegulatingControl(self
, value
):
66 if self
._RegulatingControl
is not None:
67 filtered
= [x
for x
in self
.RegulatingControl
.RegulationSchedule
if x
!= self
]
68 self
._RegulatingControl
._RegulationSchedule
= filtered
70 self
._RegulatingControl
= value
71 if self
._RegulatingControl
is not None:
72 if self
not in self
._RegulatingControl
._RegulationSchedule
:
73 self
._RegulatingControl
._RegulationSchedule
.append(self
)
75 RegulatingControl
= property(getRegulatingControl
, setRegulatingControl
)
77 def getVoltageControlZones(self
):
78 """A VoltageControlZone may have a voltage regulation schedule.
80 return self
._VoltageControlZones
82 def setVoltageControlZones(self
, value
):
83 for x
in self
._VoltageControlZones
:
84 x
.RegulationSchedule
= None
86 y
._RegulationSchedule
= self
87 self
._VoltageControlZones
= value
89 VoltageControlZones
= property(getVoltageControlZones
, setVoltageControlZones
)
91 def addVoltageControlZones(self
, *VoltageControlZones
):
92 for obj
in VoltageControlZones
:
93 obj
.RegulationSchedule
= self
95 def removeVoltageControlZones(self
, *VoltageControlZones
):
96 for obj
in VoltageControlZones
:
97 obj
.RegulationSchedule
= None