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
.ENTSOE
.Equipment
.Element
import Element
23 class ControlAreaGeneratingUnit(Element
):
24 """A control area generating unit. This class is needed so that alternate control area definitions may include the same generating unit. Note only one instance within a control area should reference a specific generating unit.
27 def __init__(self
, ControlArea
=None, GeneratingUnit
=None, *args
, **kw_args
):
28 """Initialises a new 'ControlAreaGeneratingUnit' instance.
30 @param ControlArea: The parent control area for the generating unit specifications.
31 @param GeneratingUnit: The generating unit specified for this control area. Note that a control area should include a GeneratingUnit only once.
33 self
._ControlArea
= None
34 self
.ControlArea
= ControlArea
36 self
._GeneratingUnit
= None
37 self
.GeneratingUnit
= GeneratingUnit
39 super(ControlAreaGeneratingUnit
, self
).__init
__(*args
, **kw_args
)
45 _refs
= ["ControlArea", "GeneratingUnit"]
48 def getControlArea(self
):
49 """The parent control area for the generating unit specifications.
51 return self
._ControlArea
53 def setControlArea(self
, value
):
54 if self
._ControlArea
is not None:
55 filtered
= [x
for x
in self
.ControlArea
.ControlAreaGeneratingUnit
if x
!= self
]
56 self
._ControlArea
._ControlAreaGeneratingUnit
= filtered
58 self
._ControlArea
= value
59 if self
._ControlArea
is not None:
60 if self
not in self
._ControlArea
._ControlAreaGeneratingUnit
:
61 self
._ControlArea
._ControlAreaGeneratingUnit
.append(self
)
63 ControlArea
= property(getControlArea
, setControlArea
)
65 def getGeneratingUnit(self
):
66 """The generating unit specified for this control area. Note that a control area should include a GeneratingUnit only once.
68 return self
._GeneratingUnit
70 def setGeneratingUnit(self
, value
):
71 if self
._GeneratingUnit
is not None:
72 filtered
= [x
for x
in self
.GeneratingUnit
.ControlAreaGeneratingUnit
if x
!= self
]
73 self
._GeneratingUnit
._ControlAreaGeneratingUnit
= filtered
75 self
._GeneratingUnit
= value
76 if self
._GeneratingUnit
is not None:
77 if self
not in self
._GeneratingUnit
._ControlAreaGeneratingUnit
:
78 self
._GeneratingUnit
._ControlAreaGeneratingUnit
.append(self
)
80 GeneratingUnit
= property(getGeneratingUnit
, setGeneratingUnit
)