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