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
21 from CIM14
.IEC61970
.Core
.IdentifiedObject
import IdentifiedObject
23 class ReportingGroup(IdentifiedObject
):
24 """A reporting group is used for various ad-hoc groupings used for reporting.
27 def __init__(self
, ReportingSuperGroup
=None, TopologicalNode
=None, BusNameMarker
=None, PowerSystemResource
=None, *args
, **kw_args
):
28 """Initialises a new 'ReportingGroup' instance.
30 @param ReportingSuperGroup: Reporting super group to which this reporting group belongs.
31 @param TopologicalNode: The topological nodes that belong to the reporting group.
32 @param BusNameMarker: The BusNameMarkers that belong to this reporting group.
33 @param PowerSystemResource: PSR's which belong to this reporting group.
35 self
._ReportingSuperGroup
= None
36 self
.ReportingSuperGroup
= ReportingSuperGroup
38 self
._TopologicalNode
= []
39 self
.TopologicalNode
= [] if TopologicalNode
is None else TopologicalNode
41 self
._BusNameMarker
= []
42 self
.BusNameMarker
= [] if BusNameMarker
is None else BusNameMarker
44 self
._PowerSystemResource
= []
45 self
.PowerSystemResource
= [] if PowerSystemResource
is None else PowerSystemResource
47 super(ReportingGroup
, self
).__init
__(*args
, **kw_args
)
53 _refs
= ["ReportingSuperGroup", "TopologicalNode", "BusNameMarker", "PowerSystemResource"]
54 _many_refs
= ["TopologicalNode", "BusNameMarker", "PowerSystemResource"]
56 def getReportingSuperGroup(self
):
57 """Reporting super group to which this reporting group belongs.
59 return self
._ReportingSuperGroup
61 def setReportingSuperGroup(self
, value
):
62 if self
._ReportingSuperGroup
is not None:
63 filtered
= [x
for x
in self
.ReportingSuperGroup
.ReportingGroup
if x
!= self
]
64 self
._ReportingSuperGroup
._ReportingGroup
= filtered
66 self
._ReportingSuperGroup
= value
67 if self
._ReportingSuperGroup
is not None:
68 if self
not in self
._ReportingSuperGroup
._ReportingGroup
:
69 self
._ReportingSuperGroup
._ReportingGroup
.append(self
)
71 ReportingSuperGroup
= property(getReportingSuperGroup
, setReportingSuperGroup
)
73 def getTopologicalNode(self
):
74 """The topological nodes that belong to the reporting group.
76 return self
._TopologicalNode
78 def setTopologicalNode(self
, value
):
79 for x
in self
._TopologicalNode
:
80 x
.ReportingGroup
= None
82 y
._ReportingGroup
= self
83 self
._TopologicalNode
= value
85 TopologicalNode
= property(getTopologicalNode
, setTopologicalNode
)
87 def addTopologicalNode(self
, *TopologicalNode
):
88 for obj
in TopologicalNode
:
89 obj
.ReportingGroup
= self
91 def removeTopologicalNode(self
, *TopologicalNode
):
92 for obj
in TopologicalNode
:
93 obj
.ReportingGroup
= None
95 def getBusNameMarker(self
):
96 """The BusNameMarkers that belong to this reporting group.
98 return self
._BusNameMarker
100 def setBusNameMarker(self
, value
):
101 for x
in self
._BusNameMarker
:
102 x
.ReportingGroup
= None
104 y
._ReportingGroup
= self
105 self
._BusNameMarker
= value
107 BusNameMarker
= property(getBusNameMarker
, setBusNameMarker
)
109 def addBusNameMarker(self
, *BusNameMarker
):
110 for obj
in BusNameMarker
:
111 obj
.ReportingGroup
= self
113 def removeBusNameMarker(self
, *BusNameMarker
):
114 for obj
in BusNameMarker
:
115 obj
.ReportingGroup
= None
117 def getPowerSystemResource(self
):
118 """PSR's which belong to this reporting group.
120 return self
._PowerSystemResource
122 def setPowerSystemResource(self
, value
):
123 for p
in self
._PowerSystemResource
:
124 filtered
= [q
for q
in p
.ReportingGroup
if q
!= self
]
125 self
._PowerSystemResource
._ReportingGroup
= filtered
127 if self
not in r
._ReportingGroup
:
128 r
._ReportingGroup
.append(self
)
129 self
._PowerSystemResource
= value
131 PowerSystemResource
= property(getPowerSystemResource
, setPowerSystemResource
)
133 def addPowerSystemResource(self
, *PowerSystemResource
):
134 for obj
in PowerSystemResource
:
135 if self
not in obj
._ReportingGroup
:
136 obj
._ReportingGroup
.append(self
)
137 self
._PowerSystemResource
.append(obj
)
139 def removePowerSystemResource(self
, *PowerSystemResource
):
140 for obj
in PowerSystemResource
:
141 if self
in obj
._ReportingGroup
:
142 obj
._ReportingGroup
.remove(self
)
143 self
._PowerSystemResource
.remove(obj
)