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 AltTieMeas(Element
):
20 """A prioritized measurement to be used for the tie flow as part of the control area specification.
23 def __init__(self
, priority
=0, AnalogValue
=None, TieFlow
=None, *args
, **kw_args
):
24 """Initialises a new 'AltTieMeas' instance.
26 @param priority: Priority of a measurement usage. Lower numbers have first priority.
27 @param AnalogValue: The specific analog value used as a source.
28 @param TieFlow: The tie flow of the alternate measurements.
30 #: Priority of a measurement usage. Lower numbers have first priority.
31 self
.priority
= priority
33 self
._AnalogValue
= None
34 self
.AnalogValue
= AnalogValue
37 self
.TieFlow
= TieFlow
39 super(AltTieMeas
, self
).__init
__(*args
, **kw_args
)
42 _attr_types
= {"priority": int}
43 _defaults
= {"priority": 0}
45 _refs
= ["AnalogValue", "TieFlow"]
48 def getAnalogValue(self
):
49 """The specific analog value used as a source.
51 return self
._AnalogValue
53 def setAnalogValue(self
, value
):
54 if self
._AnalogValue
is not None:
55 filtered
= [x
for x
in self
.AnalogValue
.AltTieMeas
if x
!= self
]
56 self
._AnalogValue
._AltTieMeas
= filtered
58 self
._AnalogValue
= value
59 if self
._AnalogValue
is not None:
60 if self
not in self
._AnalogValue
._AltTieMeas
:
61 self
._AnalogValue
._AltTieMeas
.append(self
)
63 AnalogValue
= property(getAnalogValue
, setAnalogValue
)
66 """The tie flow of the alternate measurements.
70 def setTieFlow(self
, value
):
71 if self
._TieFlow
is not None:
72 filtered
= [x
for x
in self
.TieFlow
.AltTieMeas
if x
!= self
]
73 self
._TieFlow
._AltTieMeas
= filtered
76 if self
._TieFlow
is not None:
77 if self
not in self
._TieFlow
._AltTieMeas
:
78 self
._TieFlow
._AltTieMeas
.append(self
)
80 TieFlow
= property(getTieFlow
, setTieFlow
)