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 TieFlow(Element
):
20 """A flow specification in terms of location and direction for a control area.
23 def __init__(self
, positiveFlowIn
=False, ControlArea
=None, AltTieMeas
=None, Terminal
=None, *args
, **kw_args
):
24 """Initialises a new 'TieFlow' instance.
26 @param positiveFlowIn: The flow is positive into the terminal. A flow is positive if it is an import into the control area.
27 @param ControlArea: The control area of the tie flows.
28 @param AltTieMeas: The primary and alternate tie flow measurements associated with the tie flow.
29 @param Terminal: The terminal to which this tie flow belongs.
31 #: The flow is positive into the terminal. A flow is positive if it is an import into the control area.
32 self
.positiveFlowIn
= positiveFlowIn
34 self
._ControlArea
= None
35 self
.ControlArea
= ControlArea
38 self
.AltTieMeas
= [] if AltTieMeas
is None else AltTieMeas
41 self
.Terminal
= Terminal
43 super(TieFlow
, self
).__init
__(*args
, **kw_args
)
45 _attrs
= ["positiveFlowIn"]
46 _attr_types
= {"positiveFlowIn": bool}
47 _defaults
= {"positiveFlowIn": False}
49 _refs
= ["ControlArea", "AltTieMeas", "Terminal"]
50 _many_refs
= ["AltTieMeas"]
52 def getControlArea(self
):
53 """The control area of the tie flows.
55 return self
._ControlArea
57 def setControlArea(self
, value
):
58 if self
._ControlArea
is not None:
59 filtered
= [x
for x
in self
.ControlArea
.TieFlow
if x
!= self
]
60 self
._ControlArea
._TieFlow
= filtered
62 self
._ControlArea
= value
63 if self
._ControlArea
is not None:
64 self
._ControlArea
._TieFlow
.append(self
)
66 ControlArea
= property(getControlArea
, setControlArea
)
68 def getAltTieMeas(self
):
69 """The primary and alternate tie flow measurements associated with the tie flow.
71 return self
._AltTieMeas
73 def setAltTieMeas(self
, value
):
74 for x
in self
._AltTieMeas
:
78 self
._AltTieMeas
= value
80 AltTieMeas
= property(getAltTieMeas
, setAltTieMeas
)
82 def addAltTieMeas(self
, *AltTieMeas
):
83 for obj
in AltTieMeas
:
85 self
._AltTieMeas
.append(obj
)
87 def removeAltTieMeas(self
, *AltTieMeas
):
88 for obj
in AltTieMeas
:
90 self
._AltTieMeas
.remove(obj
)
92 def getTerminal(self
):
93 """The terminal to which this tie flow belongs.
97 def setTerminal(self
, value
):
98 if self
._Terminal
is not None:
99 filtered
= [x
for x
in self
.Terminal
.TieFlow
if x
!= self
]
100 self
._Terminal
._TieFlow
= filtered
102 self
._Terminal
= value
103 if self
._Terminal
is not None:
104 self
._Terminal
._TieFlow
.append(self
)
106 Terminal
= property(getTerminal
, setTerminal
)