Fixing website and API documentation links
[PyCIM.git] / CIM14 / IEC61970 / ControlArea / ControlAreaGeneratingUnit.py
blob4a5bbc50a08f3faa57fca031b895d182766f6fa6
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 ControlAreaGeneratingUnit(Element):
24 """A control area generating unit. This class is needed so that alternate control area definitions may include the same generating unit. Note only one instance within a control area should reference a specific generating unit.
25 """
27 def __init__(self, AltGeneratingUnitMeas=None, ControlArea=None, GeneratingUnit=None, *args, **kw_args):
28 """Initialises a new 'ControlAreaGeneratingUnit' instance.
30 @param AltGeneratingUnitMeas: The link to prioritized measurements for this GeneratingUnit.
31 @param ControlArea: The parent control area for the generating unit specifications.
32 @param GeneratingUnit: The generating unit specified for this control area. Note that a control area should include a GeneratingUnit only once.
33 """
34 self._AltGeneratingUnitMeas = []
35 self.AltGeneratingUnitMeas = [] if AltGeneratingUnitMeas is None else AltGeneratingUnitMeas
37 self._ControlArea = None
38 self.ControlArea = ControlArea
40 self._GeneratingUnit = None
41 self.GeneratingUnit = GeneratingUnit
43 super(ControlAreaGeneratingUnit, self).__init__(*args, **kw_args)
45 _attrs = []
46 _attr_types = {}
47 _defaults = {}
48 _enums = {}
49 _refs = ["AltGeneratingUnitMeas", "ControlArea", "GeneratingUnit"]
50 _many_refs = ["AltGeneratingUnitMeas"]
52 def getAltGeneratingUnitMeas(self):
53 """The link to prioritized measurements for this GeneratingUnit.
54 """
55 return self._AltGeneratingUnitMeas
57 def setAltGeneratingUnitMeas(self, value):
58 for x in self._AltGeneratingUnitMeas:
59 x.ControlAreaGeneratingUnit = None
60 for y in value:
61 y._ControlAreaGeneratingUnit = self
62 self._AltGeneratingUnitMeas = value
64 AltGeneratingUnitMeas = property(getAltGeneratingUnitMeas, setAltGeneratingUnitMeas)
66 def addAltGeneratingUnitMeas(self, *AltGeneratingUnitMeas):
67 for obj in AltGeneratingUnitMeas:
68 obj.ControlAreaGeneratingUnit = self
70 def removeAltGeneratingUnitMeas(self, *AltGeneratingUnitMeas):
71 for obj in AltGeneratingUnitMeas:
72 obj.ControlAreaGeneratingUnit = None
74 def getControlArea(self):
75 """The parent control area for the generating unit specifications.
76 """
77 return self._ControlArea
79 def setControlArea(self, value):
80 if self._ControlArea is not None:
81 filtered = [x for x in self.ControlArea.ControlAreaGeneratingUnit if x != self]
82 self._ControlArea._ControlAreaGeneratingUnit = filtered
84 self._ControlArea = value
85 if self._ControlArea is not None:
86 if self not in self._ControlArea._ControlAreaGeneratingUnit:
87 self._ControlArea._ControlAreaGeneratingUnit.append(self)
89 ControlArea = property(getControlArea, setControlArea)
91 def getGeneratingUnit(self):
92 """The generating unit specified for this control area. Note that a control area should include a GeneratingUnit only once.
93 """
94 return self._GeneratingUnit
96 def setGeneratingUnit(self, value):
97 if self._GeneratingUnit is not None:
98 filtered = [x for x in self.GeneratingUnit.ControlAreaGeneratingUnit if x != self]
99 self._GeneratingUnit._ControlAreaGeneratingUnit = filtered
101 self._GeneratingUnit = value
102 if self._GeneratingUnit is not None:
103 if self not in self._GeneratingUnit._ControlAreaGeneratingUnit:
104 self._GeneratingUnit._ControlAreaGeneratingUnit.append(self)
106 GeneratingUnit = property(getGeneratingUnit, setGeneratingUnit)