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
.Element
import Element
23 class AltGeneratingUnitMeas(Element
):
24 """A prioritized measurement to be used for the generating unit in the control area specificaiton.
27 def __init__(self
, priority
=0, ControlAreaGeneratingUnit
=None, AnalogValue
=None, *args
, **kw_args
):
28 """Initialises a new 'AltGeneratingUnitMeas' instance.
30 @param priority: Priority of a measurement usage. Lower numbers have first priority.
31 @param ControlAreaGeneratingUnit: The control aread generating unit to which the prioritized measurement assignment is applied.
32 @param AnalogValue: The specific analog value used as a source.
34 #: Priority of a measurement usage. Lower numbers have first priority.
35 self
.priority
= priority
37 self
._ControlAreaGeneratingUnit
= None
38 self
.ControlAreaGeneratingUnit
= ControlAreaGeneratingUnit
40 self
._AnalogValue
= None
41 self
.AnalogValue
= AnalogValue
43 super(AltGeneratingUnitMeas
, self
).__init
__(*args
, **kw_args
)
46 _attr_types
= {"priority": int}
47 _defaults
= {"priority": 0}
49 _refs
= ["ControlAreaGeneratingUnit", "AnalogValue"]
52 def getControlAreaGeneratingUnit(self
):
53 """The control aread generating unit to which the prioritized measurement assignment is applied.
55 return self
._ControlAreaGeneratingUnit
57 def setControlAreaGeneratingUnit(self
, value
):
58 if self
._ControlAreaGeneratingUnit
is not None:
59 filtered
= [x
for x
in self
.ControlAreaGeneratingUnit
.AltGeneratingUnitMeas
if x
!= self
]
60 self
._ControlAreaGeneratingUnit
._AltGeneratingUnitMeas
= filtered
62 self
._ControlAreaGeneratingUnit
= value
63 if self
._ControlAreaGeneratingUnit
is not None:
64 if self
not in self
._ControlAreaGeneratingUnit
._AltGeneratingUnitMeas
:
65 self
._ControlAreaGeneratingUnit
._AltGeneratingUnitMeas
.append(self
)
67 ControlAreaGeneratingUnit
= property(getControlAreaGeneratingUnit
, setControlAreaGeneratingUnit
)
69 def getAnalogValue(self
):
70 """The specific analog value used as a source.
72 return self
._AnalogValue
74 def setAnalogValue(self
, value
):
75 if self
._AnalogValue
is not None:
76 filtered
= [x
for x
in self
.AnalogValue
.AltGeneratingUnit
if x
!= self
]
77 self
._AnalogValue
._AltGeneratingUnit
= filtered
79 self
._AnalogValue
= value
80 if self
._AnalogValue
is not None:
81 if self
not in self
._AnalogValue
._AltGeneratingUnit
:
82 self
._AnalogValue
._AltGeneratingUnit
.append(self
)
84 AnalogValue
= property(getAnalogValue
, setAnalogValue
)