Adding CDPSM package.
[PyCIM.git] / CIM14 / IEC61970 / Core / ReportingGroup.py
blobe01f4b0ce8803c1b42768acc630acc1996e5681f
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.IEC61970.Core.IdentifiedObject import IdentifiedObject
19 class ReportingGroup(IdentifiedObject):
20 """A reporting group is used for various ad-hoc groupings used for reporting.
21 """
23 def __init__(self, ReportingSuperGroup=None, TopologicalNode=None, BusNameMarker=None, PowerSystemResource=None, *args, **kw_args):
24 """Initialises a new 'ReportingGroup' instance.
26 @param ReportingSuperGroup: Reporting super group to which this reporting group belongs.
27 @param TopologicalNode: The topological nodes that belong to the reporting group.
28 @param BusNameMarker: The BusNameMarkers that belong to this reporting group.
29 @param PowerSystemResource: PSR's which belong to this reporting group.
30 """
31 self._ReportingSuperGroup = None
32 self.ReportingSuperGroup = ReportingSuperGroup
34 self._TopologicalNode = []
35 self.TopologicalNode = [] if TopologicalNode is None else TopologicalNode
37 self._BusNameMarker = []
38 self.BusNameMarker = [] if BusNameMarker is None else BusNameMarker
40 self._PowerSystemResource = []
41 self.PowerSystemResource = [] if PowerSystemResource is None else PowerSystemResource
43 super(ReportingGroup, self).__init__(*args, **kw_args)
45 _attrs = []
46 _attr_types = {}
47 _defaults = {}
48 _enums = {}
49 _refs = ["ReportingSuperGroup", "TopologicalNode", "BusNameMarker", "PowerSystemResource"]
50 _many_refs = ["TopologicalNode", "BusNameMarker", "PowerSystemResource"]
52 def getReportingSuperGroup(self):
53 """Reporting super group to which this reporting group belongs.
54 """
55 return self._ReportingSuperGroup
57 def setReportingSuperGroup(self, value):
58 if self._ReportingSuperGroup is not None:
59 filtered = [x for x in self.ReportingSuperGroup.ReportingGroup if x != self]
60 self._ReportingSuperGroup._ReportingGroup = filtered
62 self._ReportingSuperGroup = value
63 if self._ReportingSuperGroup is not None:
64 if self not in self._ReportingSuperGroup._ReportingGroup:
65 self._ReportingSuperGroup._ReportingGroup.append(self)
67 ReportingSuperGroup = property(getReportingSuperGroup, setReportingSuperGroup)
69 def getTopologicalNode(self):
70 """The topological nodes that belong to the reporting group.
71 """
72 return self._TopologicalNode
74 def setTopologicalNode(self, value):
75 for x in self._TopologicalNode:
76 x.ReportingGroup = None
77 for y in value:
78 y._ReportingGroup = self
79 self._TopologicalNode = value
81 TopologicalNode = property(getTopologicalNode, setTopologicalNode)
83 def addTopologicalNode(self, *TopologicalNode):
84 for obj in TopologicalNode:
85 obj.ReportingGroup = self
87 def removeTopologicalNode(self, *TopologicalNode):
88 for obj in TopologicalNode:
89 obj.ReportingGroup = None
91 def getBusNameMarker(self):
92 """The BusNameMarkers that belong to this reporting group.
93 """
94 return self._BusNameMarker
96 def setBusNameMarker(self, value):
97 for x in self._BusNameMarker:
98 x.ReportingGroup = None
99 for y in value:
100 y._ReportingGroup = self
101 self._BusNameMarker = value
103 BusNameMarker = property(getBusNameMarker, setBusNameMarker)
105 def addBusNameMarker(self, *BusNameMarker):
106 for obj in BusNameMarker:
107 obj.ReportingGroup = self
109 def removeBusNameMarker(self, *BusNameMarker):
110 for obj in BusNameMarker:
111 obj.ReportingGroup = None
113 def getPowerSystemResource(self):
114 """PSR's which belong to this reporting group.
116 return self._PowerSystemResource
118 def setPowerSystemResource(self, value):
119 for p in self._PowerSystemResource:
120 filtered = [q for q in p.ReportingGroup if q != self]
121 self._PowerSystemResource._ReportingGroup = filtered
122 for r in value:
123 if self not in r._ReportingGroup:
124 r._ReportingGroup.append(self)
125 self._PowerSystemResource = value
127 PowerSystemResource = property(getPowerSystemResource, setPowerSystemResource)
129 def addPowerSystemResource(self, *PowerSystemResource):
130 for obj in PowerSystemResource:
131 if self not in obj._ReportingGroup:
132 obj._ReportingGroup.append(self)
133 self._PowerSystemResource.append(obj)
135 def removePowerSystemResource(self, *PowerSystemResource):
136 for obj in PowerSystemResource:
137 if self in obj._ReportingGroup:
138 obj._ReportingGroup.remove(self)
139 self._PowerSystemResource.remove(obj)