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
.EquipmentContainer
import EquipmentContainer
19 class Substation(EquipmentContainer
):
20 """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.
23 def __init__(self
, VoltageLevels
=None, Bays
=None, Region
=None, *args
, **kw_args
):
24 """Initialises a new 'Substation' instance.
26 @param VoltageLevels: The association is used in the naming hierarchy.
27 @param Bays: The association is used in the naming hierarchy.
28 @param Region: The association is used in the naming hierarchy.
30 self
._VoltageLevels
= []
31 self
.VoltageLevels
= [] if VoltageLevels
is None else VoltageLevels
34 self
.Bays
= [] if Bays
is None else Bays
39 super(Substation
, self
).__init
__(*args
, **kw_args
)
45 _refs
= ["VoltageLevels", "Bays", "Region"]
46 _many_refs
= ["VoltageLevels", "Bays"]
48 def getVoltageLevels(self
):
49 """The association is used in the naming hierarchy.
51 return self
._VoltageLevels
53 def setVoltageLevels(self
, value
):
54 for x
in self
._VoltageLevels
:
58 self
._VoltageLevels
= value
60 VoltageLevels
= property(getVoltageLevels
, setVoltageLevels
)
62 def addVoltageLevels(self
, *VoltageLevels
):
63 for obj
in VoltageLevels
:
66 def removeVoltageLevels(self
, *VoltageLevels
):
67 for obj
in VoltageLevels
:
71 """The association is used in the naming hierarchy.
75 def setBays(self
, value
):
82 Bays
= property(getBays
, setBays
)
84 def addBays(self
, *Bays
):
88 def removeBays(self
, *Bays
):
93 """The association is used in the naming hierarchy.
97 def setRegion(self
, value
):
98 if self
._Region
is not None:
99 filtered
= [x
for x
in self
.Region
.Substations
if x
!= self
]
100 self
._Region
._Substations
= filtered
103 if self
._Region
is not None:
104 if self
not in self
._Region
._Substations
:
105 self
._Region
._Substations
.append(self
)
107 Region
= property(getRegion
, setRegion
)