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 PowerSystemResource(IdentifiedObject
):
20 """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.
23 def __init__(self
, Location
=None, Assets
=None, PsrLists
=None, Measurements
=None, OperatingShare
=None, OutageSchedule
=None, ReportingGroup
=None, Block
=None, PSRType
=None, *args
, **kw_args
):
24 """Initialises a new 'PowerSystemResource' instance.
26 @param Location: Location of this power system resource.
27 @param Assets: All assets represented by this power system resource. For example, multiple conductor assets are electrically modelled as a single AC line segment.
29 @param Measurements: The Measurements that are included in the naming hierarchy where the PSR is the containing object
30 @param OperatingShare: The linkage to any number of operating share objects.
31 @param OutageSchedule: A power system resource may have an outage schedule
32 @param ReportingGroup: Reporting groups to which this PSR belongs.
33 @param Block: The dynamics block associated to the power system resource.
34 @param PSRType: PSRType (custom classification) for this PowerSystemResource.
37 self
.Location
= Location
40 self
.Assets
= [] if Assets
is None else Assets
43 self
.PsrLists
= [] if PsrLists
is None else PsrLists
45 self
._Measurements
= []
46 self
.Measurements
= [] if Measurements
is None else Measurements
48 self
._OperatingShare
= []
49 self
.OperatingShare
= [] if OperatingShare
is None else OperatingShare
51 self
._OutageSchedule
= None
52 self
.OutageSchedule
= OutageSchedule
54 self
._ReportingGroup
= []
55 self
.ReportingGroup
= [] if ReportingGroup
is None else ReportingGroup
58 self
.Block
= [] if Block
is None else Block
61 self
.PSRType
= PSRType
63 super(PowerSystemResource
, self
).__init
__(*args
, **kw_args
)
69 _refs
= ["Location", "Assets", "PsrLists", "Measurements", "OperatingShare", "OutageSchedule", "ReportingGroup", "Block", "PSRType"]
70 _many_refs
= ["Assets", "PsrLists", "Measurements", "OperatingShare", "ReportingGroup", "Block"]
72 def getLocation(self
):
73 """Location of this power system resource.
77 def setLocation(self
, value
):
78 if self
._Location
is not None:
79 filtered
= [x
for x
in self
.Location
.PowerSystemResources
if x
!= self
]
80 self
._Location
._PowerSystemResources
= filtered
82 self
._Location
= value
83 if self
._Location
is not None:
84 self
._Location
._PowerSystemResources
.append(self
)
86 Location
= property(getLocation
, setLocation
)
89 """All assets represented by this power system resource. For example, multiple conductor assets are electrically modelled as a single AC line segment.
93 def setAssets(self
, value
):
94 for p
in self
._Assets
:
95 filtered
= [q
for q
in p
.PowerSystemResources
if q
!= self
]
96 self
._Assets
._PowerSystemResources
= filtered
98 if self
not in r
._PowerSystemResources
:
99 r
._PowerSystemResources
.append(self
)
102 Assets
= property(getAssets
, setAssets
)
104 def addAssets(self
, *Assets
):
106 if self
not in obj
._PowerSystemResources
:
107 obj
._PowerSystemResources
.append(self
)
108 self
._Assets
.append(obj
)
110 def removeAssets(self
, *Assets
):
112 if self
in obj
._PowerSystemResources
:
113 obj
._PowerSystemResources
.remove(self
)
114 self
._Assets
.remove(obj
)
116 def getPsrLists(self
):
118 return self
._PsrLists
120 def setPsrLists(self
, value
):
121 for p
in self
._PsrLists
:
122 filtered
= [q
for q
in p
.PowerSystemResources
if q
!= self
]
123 self
._PsrLists
._PowerSystemResources
= filtered
125 if self
not in r
._PowerSystemResources
:
126 r
._PowerSystemResources
.append(self
)
127 self
._PsrLists
= value
129 PsrLists
= property(getPsrLists
, setPsrLists
)
131 def addPsrLists(self
, *PsrLists
):
133 if self
not in obj
._PowerSystemResources
:
134 obj
._PowerSystemResources
.append(self
)
135 self
._PsrLists
.append(obj
)
137 def removePsrLists(self
, *PsrLists
):
139 if self
in obj
._PowerSystemResources
:
140 obj
._PowerSystemResources
.remove(self
)
141 self
._PsrLists
.remove(obj
)
143 def getMeasurements(self
):
144 """The Measurements that are included in the naming hierarchy where the PSR is the containing object
146 return self
._Measurements
148 def setMeasurements(self
, value
):
149 for x
in self
._Measurements
:
150 x
._PowerSystemResource
= None
152 y
._PowerSystemResource
= self
153 self
._Measurements
= value
155 Measurements
= property(getMeasurements
, setMeasurements
)
157 def addMeasurements(self
, *Measurements
):
158 for obj
in Measurements
:
159 obj
._PowerSystemResource
= self
160 self
._Measurements
.append(obj
)
162 def removeMeasurements(self
, *Measurements
):
163 for obj
in Measurements
:
164 obj
._PowerSystemResource
= None
165 self
._Measurements
.remove(obj
)
167 def getOperatingShare(self
):
168 """The linkage to any number of operating share objects.
170 return self
._OperatingShare
172 def setOperatingShare(self
, value
):
173 for x
in self
._OperatingShare
:
174 x
._PowerSystemResource
= None
176 y
._PowerSystemResource
= self
177 self
._OperatingShare
= value
179 OperatingShare
= property(getOperatingShare
, setOperatingShare
)
181 def addOperatingShare(self
, *OperatingShare
):
182 for obj
in OperatingShare
:
183 obj
._PowerSystemResource
= self
184 self
._OperatingShare
.append(obj
)
186 def removeOperatingShare(self
, *OperatingShare
):
187 for obj
in OperatingShare
:
188 obj
._PowerSystemResource
= None
189 self
._OperatingShare
.remove(obj
)
191 def getOutageSchedule(self
):
192 """A power system resource may have an outage schedule
194 return self
._OutageSchedule
196 def setOutageSchedule(self
, value
):
197 if self
._OutageSchedule
is not None:
198 self
._OutageSchedule
._PowerSystemResource
= None
200 self
._OutageSchedule
= value
201 if self
._OutageSchedule
is not None:
202 self
._OutageSchedule
._PowerSystemResource
= self
204 OutageSchedule
= property(getOutageSchedule
, setOutageSchedule
)
206 def getReportingGroup(self
):
207 """Reporting groups to which this PSR belongs.
209 return self
._ReportingGroup
211 def setReportingGroup(self
, value
):
212 for p
in self
._ReportingGroup
:
213 filtered
= [q
for q
in p
.PowerSystemResource
if q
!= self
]
214 self
._ReportingGroup
._PowerSystemResource
= filtered
216 if self
not in r
._PowerSystemResource
:
217 r
._PowerSystemResource
.append(self
)
218 self
._ReportingGroup
= value
220 ReportingGroup
= property(getReportingGroup
, setReportingGroup
)
222 def addReportingGroup(self
, *ReportingGroup
):
223 for obj
in ReportingGroup
:
224 if self
not in obj
._PowerSystemResource
:
225 obj
._PowerSystemResource
.append(self
)
226 self
._ReportingGroup
.append(obj
)
228 def removeReportingGroup(self
, *ReportingGroup
):
229 for obj
in ReportingGroup
:
230 if self
in obj
._PowerSystemResource
:
231 obj
._PowerSystemResource
.remove(self
)
232 self
._ReportingGroup
.remove(obj
)
235 """The dynamics block associated to the power system resource.
239 def setBlock(self
, value
):
240 for x
in self
._Block
:
241 x
._PowerSystemResource
= None
243 y
._PowerSystemResource
= self
246 Block
= property(getBlock
, setBlock
)
248 def addBlock(self
, *Block
):
250 obj
._PowerSystemResource
= self
251 self
._Block
.append(obj
)
253 def removeBlock(self
, *Block
):
255 obj
._PowerSystemResource
= None
256 self
._Block
.remove(obj
)
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 self
._PSRType
._PowerSystemResources
.append(self
)
272 PSRType
= property(getPSRType
, setPSRType
)