Implementing RDF/XML serialisation using meta-data attributes.
[PyCIM.git] / schemata / CIM14 / IEC61970 / Core / ReportingGroup.py
blobc7de76b6b60f44b9b7f3c697cdb126601d118733
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 self._ReportingSuperGroup._ReportingGroup.append(self)
66 ReportingSuperGroup = property(getReportingSuperGroup, setReportingSuperGroup)
68 def getTopologicalNode(self):
69 """The topological nodes that belong to the reporting group.
70 """
71 return self._TopologicalNode
73 def setTopologicalNode(self, value):
74 for x in self._TopologicalNode:
75 x._ReportingGroup = None
76 for y in value:
77 y._ReportingGroup = self
78 self._TopologicalNode = value
80 TopologicalNode = property(getTopologicalNode, setTopologicalNode)
82 def addTopologicalNode(self, *TopologicalNode):
83 for obj in TopologicalNode:
84 obj._ReportingGroup = self
85 self._TopologicalNode.append(obj)
87 def removeTopologicalNode(self, *TopologicalNode):
88 for obj in TopologicalNode:
89 obj._ReportingGroup = None
90 self._TopologicalNode.remove(obj)
92 def getBusNameMarker(self):
93 """The BusNameMarkers that belong to this reporting group.
94 """
95 return self._BusNameMarker
97 def setBusNameMarker(self, value):
98 for x in self._BusNameMarker:
99 x._ReportingGroup = None
100 for y in value:
101 y._ReportingGroup = self
102 self._BusNameMarker = value
104 BusNameMarker = property(getBusNameMarker, setBusNameMarker)
106 def addBusNameMarker(self, *BusNameMarker):
107 for obj in BusNameMarker:
108 obj._ReportingGroup = self
109 self._BusNameMarker.append(obj)
111 def removeBusNameMarker(self, *BusNameMarker):
112 for obj in BusNameMarker:
113 obj._ReportingGroup = None
114 self._BusNameMarker.remove(obj)
116 def getPowerSystemResource(self):
117 """PSR's which belong to this reporting group.
119 return self._PowerSystemResource
121 def setPowerSystemResource(self, value):
122 for p in self._PowerSystemResource:
123 filtered = [q for q in p.ReportingGroup if q != self]
124 self._PowerSystemResource._ReportingGroup = filtered
125 for r in value:
126 if self not in r._ReportingGroup:
127 r._ReportingGroup.append(self)
128 self._PowerSystemResource = value
130 PowerSystemResource = property(getPowerSystemResource, setPowerSystemResource)
132 def addPowerSystemResource(self, *PowerSystemResource):
133 for obj in PowerSystemResource:
134 if self not in obj._ReportingGroup:
135 obj._ReportingGroup.append(self)
136 self._PowerSystemResource.append(obj)
138 def removePowerSystemResource(self, *PowerSystemResource):
139 for obj in PowerSystemResource:
140 if self in obj._ReportingGroup:
141 obj._ReportingGroup.remove(self)
142 self._PowerSystemResource.remove(obj)