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
.EquipmentContainer
import EquipmentContainer
23 class Substation(EquipmentContainer
):
24 """A collection of equipment for purposes other than generation or utilization, through which electric energy in bulk is passed for the purposes of switching or modifying its characteristics.
27 def __init__(self
, VoltageLevels
=None, Bays
=None, Region
=None, *args
, **kw_args
):
28 """Initialises a new 'Substation' instance.
30 @param VoltageLevels: The association is used in the naming hierarchy.
31 @param Bays: The association is used in the naming hierarchy.
32 @param Region: The association is used in the naming hierarchy.
34 self
._VoltageLevels
= []
35 self
.VoltageLevels
= [] if VoltageLevels
is None else VoltageLevels
38 self
.Bays
= [] if Bays
is None else Bays
43 super(Substation
, self
).__init
__(*args
, **kw_args
)
49 _refs
= ["VoltageLevels", "Bays", "Region"]
50 _many_refs
= ["VoltageLevels", "Bays"]
52 def getVoltageLevels(self
):
53 """The association is used in the naming hierarchy.
55 return self
._VoltageLevels
57 def setVoltageLevels(self
, value
):
58 for x
in self
._VoltageLevels
:
62 self
._VoltageLevels
= value
64 VoltageLevels
= property(getVoltageLevels
, setVoltageLevels
)
66 def addVoltageLevels(self
, *VoltageLevels
):
67 for obj
in VoltageLevels
:
70 def removeVoltageLevels(self
, *VoltageLevels
):
71 for obj
in VoltageLevels
:
75 """The association is used in the naming hierarchy.
79 def setBays(self
, value
):
86 Bays
= property(getBays
, setBays
)
88 def addBays(self
, *Bays
):
92 def removeBays(self
, *Bays
):
97 """The association is used in the naming hierarchy.
101 def setRegion(self
, value
):
102 if self
._Region
is not None:
103 filtered
= [x
for x
in self
.Region
.Substations
if x
!= self
]
104 self
._Region
._Substations
= filtered
107 if self
._Region
is not None:
108 if self
not in self
._Region
._Substations
:
109 self
._Region
._Substations
.append(self
)
111 Region
= property(getRegion
, setRegion
)