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
.Contingency
.ContingencyElement
import ContingencyElement
23 class ContingencyEquipment(ContingencyElement
):
24 """A equipment to which the in service status is to change such as a power transformer or AC line segment.
27 def __init__(self
, contingentStatus
="outOfService", Equipment
=None, *args
, **kw_args
):
28 """Initialises a new 'ContingencyEquipment' instance.
30 @param contingentStatus: The status for the associated equipment when in the contingency state. This status is independent of the case to which the contingency is originally applied, but defines the equipment status when the contingency is applied. Values are: "outOfService", "inService"
31 @param Equipment: The single piece of equipment to which to apply the contingency.
33 #: The status for the associated equipment when in the contingency state. This status is independent of the case to which the contingency is originally applied, but defines the equipment status when the contingency is applied. Values are: "outOfService", "inService"
34 self
.contingentStatus
= contingentStatus
36 self
._Equipment
= None
37 self
.Equipment
= Equipment
39 super(ContingencyEquipment
, self
).__init
__(*args
, **kw_args
)
41 _attrs
= ["contingentStatus"]
42 _attr_types
= {"contingentStatus": str}
43 _defaults
= {"contingentStatus": "outOfService"}
44 _enums
= {"contingentStatus": "ContingencyEquipmentStatusKind"}
48 def getEquipment(self
):
49 """The single piece of equipment to which to apply the contingency.
51 return self
._Equipment
53 def setEquipment(self
, value
):
54 if self
._Equipment
is not None:
55 filtered
= [x
for x
in self
.Equipment
.ContingencyEquipment
if x
!= self
]
56 self
._Equipment
._ContingencyEquipment
= filtered
58 self
._Equipment
= value
59 if self
._Equipment
is not None:
60 if self
not in self
._Equipment
._ContingencyEquipment
:
61 self
._Equipment
._ContingencyEquipment
.append(self
)
63 Equipment
= property(getEquipment
, setEquipment
)