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 PowerSystemResource(IdentifiedObject
):
24 """A power system resource can be an item of equipment such as a Switch, an EquipmentContainer containing many individual items of equipment such as a Substation, or an organisational entity such as Company or SubControlArea. This provides for the nesting of collections of PowerSystemResources within other PowerSystemResources. For example, a Switch could be a member of a Substation and a Substation could be a member of a division of a Company.
27 def __init__(self
, Location
=None, Assets
=None, PsrLists
=None, Measurements
=None, OperatingShare
=None, OutageSchedule
=None, ReportingGroup
=None, Block
=None, PSRType
=None, *args
, **kw_args
):
28 """Initialises a new 'PowerSystemResource' instance.
30 @param Location: Location of this power system resource.
31 @param Assets: All assets represented by this power system resource. For example, multiple conductor assets are electrically modelled as a single AC line segment.
33 @param Measurements: The Measurements that are included in the naming hierarchy where the PSR is the containing object
34 @param OperatingShare: The linkage to any number of operating share objects.
35 @param OutageSchedule: A power system resource may have an outage schedule
36 @param ReportingGroup: Reporting groups to which this PSR belongs.
37 @param Block: The dynamics block associated to the power system resource.
38 @param PSRType: PSRType (custom classification) for this PowerSystemResource.
41 self
.Location
= Location
44 self
.Assets
= [] if Assets
is None else Assets
47 self
.PsrLists
= [] if PsrLists
is None else PsrLists
49 self
._Measurements
= []
50 self
.Measurements
= [] if Measurements
is None else Measurements
52 self
._OperatingShare
= []
53 self
.OperatingShare
= [] if OperatingShare
is None else OperatingShare
55 self
._OutageSchedule
= None
56 self
.OutageSchedule
= OutageSchedule
58 self
._ReportingGroup
= []
59 self
.ReportingGroup
= [] if ReportingGroup
is None else ReportingGroup
62 self
.Block
= [] if Block
is None else Block
65 self
.PSRType
= PSRType
67 super(PowerSystemResource
, self
).__init
__(*args
, **kw_args
)
73 _refs
= ["Location", "Assets", "PsrLists", "Measurements", "OperatingShare", "OutageSchedule", "ReportingGroup", "Block", "PSRType"]
74 _many_refs
= ["Assets", "PsrLists", "Measurements", "OperatingShare", "ReportingGroup", "Block"]
76 def getLocation(self
):
77 """Location of this power system resource.
81 def setLocation(self
, value
):
82 if self
._Location
is not None:
83 filtered
= [x
for x
in self
.Location
.PowerSystemResources
if x
!= self
]
84 self
._Location
._PowerSystemResources
= filtered
86 self
._Location
= value
87 if self
._Location
is not None:
88 if self
not in self
._Location
._PowerSystemResources
:
89 self
._Location
._PowerSystemResources
.append(self
)
91 Location
= property(getLocation
, setLocation
)
94 """All assets represented by this power system resource. For example, multiple conductor assets are electrically modelled as a single AC line segment.
98 def setAssets(self
, value
):
99 for p
in self
._Assets
:
100 filtered
= [q
for q
in p
.PowerSystemResources
if q
!= self
]
101 self
._Assets
._PowerSystemResources
= filtered
103 if self
not in r
._PowerSystemResources
:
104 r
._PowerSystemResources
.append(self
)
107 Assets
= property(getAssets
, setAssets
)
109 def addAssets(self
, *Assets
):
111 if self
not in obj
._PowerSystemResources
:
112 obj
._PowerSystemResources
.append(self
)
113 self
._Assets
.append(obj
)
115 def removeAssets(self
, *Assets
):
117 if self
in obj
._PowerSystemResources
:
118 obj
._PowerSystemResources
.remove(self
)
119 self
._Assets
.remove(obj
)
121 def getPsrLists(self
):
123 return self
._PsrLists
125 def setPsrLists(self
, value
):
126 for p
in self
._PsrLists
:
127 filtered
= [q
for q
in p
.PowerSystemResources
if q
!= self
]
128 self
._PsrLists
._PowerSystemResources
= filtered
130 if self
not in r
._PowerSystemResources
:
131 r
._PowerSystemResources
.append(self
)
132 self
._PsrLists
= value
134 PsrLists
= property(getPsrLists
, setPsrLists
)
136 def addPsrLists(self
, *PsrLists
):
138 if self
not in obj
._PowerSystemResources
:
139 obj
._PowerSystemResources
.append(self
)
140 self
._PsrLists
.append(obj
)
142 def removePsrLists(self
, *PsrLists
):
144 if self
in obj
._PowerSystemResources
:
145 obj
._PowerSystemResources
.remove(self
)
146 self
._PsrLists
.remove(obj
)
148 def getMeasurements(self
):
149 """The Measurements that are included in the naming hierarchy where the PSR is the containing object
151 return self
._Measurements
153 def setMeasurements(self
, value
):
154 for x
in self
._Measurements
:
155 x
.PowerSystemResource
= None
157 y
._PowerSystemResource
= self
158 self
._Measurements
= value
160 Measurements
= property(getMeasurements
, setMeasurements
)
162 def addMeasurements(self
, *Measurements
):
163 for obj
in Measurements
:
164 obj
.PowerSystemResource
= self
166 def removeMeasurements(self
, *Measurements
):
167 for obj
in Measurements
:
168 obj
.PowerSystemResource
= None
170 def getOperatingShare(self
):
171 """The linkage to any number of operating share objects.
173 return self
._OperatingShare
175 def setOperatingShare(self
, value
):
176 for x
in self
._OperatingShare
:
177 x
.PowerSystemResource
= None
179 y
._PowerSystemResource
= self
180 self
._OperatingShare
= value
182 OperatingShare
= property(getOperatingShare
, setOperatingShare
)
184 def addOperatingShare(self
, *OperatingShare
):
185 for obj
in OperatingShare
:
186 obj
.PowerSystemResource
= self
188 def removeOperatingShare(self
, *OperatingShare
):
189 for obj
in OperatingShare
:
190 obj
.PowerSystemResource
= None
192 def getOutageSchedule(self
):
193 """A power system resource may have an outage schedule
195 return self
._OutageSchedule
197 def setOutageSchedule(self
, value
):
198 if self
._OutageSchedule
is not None:
199 self
._OutageSchedule
._PowerSystemResource
= None
201 self
._OutageSchedule
= value
202 if self
._OutageSchedule
is not None:
203 self
._OutageSchedule
.PowerSystemResource
= None
204 self
._OutageSchedule
._PowerSystemResource
= self
206 OutageSchedule
= property(getOutageSchedule
, setOutageSchedule
)
208 def getReportingGroup(self
):
209 """Reporting groups to which this PSR belongs.
211 return self
._ReportingGroup
213 def setReportingGroup(self
, value
):
214 for p
in self
._ReportingGroup
:
215 filtered
= [q
for q
in p
.PowerSystemResource
if q
!= self
]
216 self
._ReportingGroup
._PowerSystemResource
= filtered
218 if self
not in r
._PowerSystemResource
:
219 r
._PowerSystemResource
.append(self
)
220 self
._ReportingGroup
= value
222 ReportingGroup
= property(getReportingGroup
, setReportingGroup
)
224 def addReportingGroup(self
, *ReportingGroup
):
225 for obj
in ReportingGroup
:
226 if self
not in obj
._PowerSystemResource
:
227 obj
._PowerSystemResource
.append(self
)
228 self
._ReportingGroup
.append(obj
)
230 def removeReportingGroup(self
, *ReportingGroup
):
231 for obj
in ReportingGroup
:
232 if self
in obj
._PowerSystemResource
:
233 obj
._PowerSystemResource
.remove(self
)
234 self
._ReportingGroup
.remove(obj
)
237 """The dynamics block associated to the power system resource.
241 def setBlock(self
, value
):
242 for x
in self
._Block
:
243 x
.PowerSystemResource
= None
245 y
._PowerSystemResource
= self
248 Block
= property(getBlock
, setBlock
)
250 def addBlock(self
, *Block
):
252 obj
.PowerSystemResource
= self
254 def removeBlock(self
, *Block
):
256 obj
.PowerSystemResource
= None
258 def getPSRType(self
):
259 """PSRType (custom classification) for this PowerSystemResource.
263 def setPSRType(self
, value
):
264 if self
._PSRType
is not None:
265 filtered
= [x
for x
in self
.PSRType
.PowerSystemResources
if x
!= self
]
266 self
._PSRType
._PowerSystemResources
= filtered
268 self
._PSRType
= value
269 if self
._PSRType
is not None:
270 if self
not in self
._PSRType
._PowerSystemResources
:
271 self
._PSRType
._PowerSystemResources
.append(self
)
273 PSRType
= property(getPSRType
, setPSRType
)