Adding CDPSM package.
[PyCIM.git] / CIM14 / IEC61970 / Core / Substation.py
blob8c948c238caed29af66aa3917a7f2c0127048098
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.
21 """
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.
29 """
30 self._VoltageLevels = []
31 self.VoltageLevels = [] if VoltageLevels is None else VoltageLevels
33 self._Bays = []
34 self.Bays = [] if Bays is None else Bays
36 self._Region = None
37 self.Region = Region
39 super(Substation, self).__init__(*args, **kw_args)
41 _attrs = []
42 _attr_types = {}
43 _defaults = {}
44 _enums = {}
45 _refs = ["VoltageLevels", "Bays", "Region"]
46 _many_refs = ["VoltageLevels", "Bays"]
48 def getVoltageLevels(self):
49 """The association is used in the naming hierarchy.
50 """
51 return self._VoltageLevels
53 def setVoltageLevels(self, value):
54 for x in self._VoltageLevels:
55 x.Substation = None
56 for y in value:
57 y._Substation = self
58 self._VoltageLevels = value
60 VoltageLevels = property(getVoltageLevels, setVoltageLevels)
62 def addVoltageLevels(self, *VoltageLevels):
63 for obj in VoltageLevels:
64 obj.Substation = self
66 def removeVoltageLevels(self, *VoltageLevels):
67 for obj in VoltageLevels:
68 obj.Substation = None
70 def getBays(self):
71 """The association is used in the naming hierarchy.
72 """
73 return self._Bays
75 def setBays(self, value):
76 for x in self._Bays:
77 x.Substation = None
78 for y in value:
79 y._Substation = self
80 self._Bays = value
82 Bays = property(getBays, setBays)
84 def addBays(self, *Bays):
85 for obj in Bays:
86 obj.Substation = self
88 def removeBays(self, *Bays):
89 for obj in Bays:
90 obj.Substation = None
92 def getRegion(self):
93 """The association is used in the naming hierarchy.
94 """
95 return self._Region
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
102 self._Region = value
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)