Fixing website and API documentation links
[PyCIM.git] / CIM14 / IEC61970 / ControlArea / TieFlow.py
blob77dad7c4b84aa0344db55bda75a4649fc00f0980
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
19 # IN THE SOFTWARE.
21 from CIM14.Element import Element
23 class TieFlow(Element):
24 """A flow specification in terms of location and direction for a control area.
25 """
27 def __init__(self, positiveFlowIn=False, ControlArea=None, AltTieMeas=None, Terminal=None, *args, **kw_args):
28 """Initialises a new 'TieFlow' instance.
30 @param positiveFlowIn: The flow is positive into the terminal. A flow is positive if it is an import into the control area.
31 @param ControlArea: The control area of the tie flows.
32 @param AltTieMeas: The primary and alternate tie flow measurements associated with the tie flow.
33 @param Terminal: The terminal to which this tie flow belongs.
34 """
35 #: The flow is positive into the terminal. A flow is positive if it is an import into the control area.
36 self.positiveFlowIn = positiveFlowIn
38 self._ControlArea = None
39 self.ControlArea = ControlArea
41 self._AltTieMeas = []
42 self.AltTieMeas = [] if AltTieMeas is None else AltTieMeas
44 self._Terminal = None
45 self.Terminal = Terminal
47 super(TieFlow, self).__init__(*args, **kw_args)
49 _attrs = ["positiveFlowIn"]
50 _attr_types = {"positiveFlowIn": bool}
51 _defaults = {"positiveFlowIn": False}
52 _enums = {}
53 _refs = ["ControlArea", "AltTieMeas", "Terminal"]
54 _many_refs = ["AltTieMeas"]
56 def getControlArea(self):
57 """The control area of the tie flows.
58 """
59 return self._ControlArea
61 def setControlArea(self, value):
62 if self._ControlArea is not None:
63 filtered = [x for x in self.ControlArea.TieFlow if x != self]
64 self._ControlArea._TieFlow = filtered
66 self._ControlArea = value
67 if self._ControlArea is not None:
68 if self not in self._ControlArea._TieFlow:
69 self._ControlArea._TieFlow.append(self)
71 ControlArea = property(getControlArea, setControlArea)
73 def getAltTieMeas(self):
74 """The primary and alternate tie flow measurements associated with the tie flow.
75 """
76 return self._AltTieMeas
78 def setAltTieMeas(self, value):
79 for x in self._AltTieMeas:
80 x.TieFlow = None
81 for y in value:
82 y._TieFlow = self
83 self._AltTieMeas = value
85 AltTieMeas = property(getAltTieMeas, setAltTieMeas)
87 def addAltTieMeas(self, *AltTieMeas):
88 for obj in AltTieMeas:
89 obj.TieFlow = self
91 def removeAltTieMeas(self, *AltTieMeas):
92 for obj in AltTieMeas:
93 obj.TieFlow = None
95 def getTerminal(self):
96 """The terminal to which this tie flow belongs.
97 """
98 return self._Terminal
100 def setTerminal(self, value):
101 if self._Terminal is not None:
102 filtered = [x for x in self.Terminal.TieFlow if x != self]
103 self._Terminal._TieFlow = filtered
105 self._Terminal = value
106 if self._Terminal is not None:
107 if self not in self._Terminal._TieFlow:
108 self._Terminal._TieFlow.append(self)
110 Terminal = property(getTerminal, setTerminal)