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 SubGeographicalRegion(IdentifiedObject
):
20 """A subset of a geographical region of a power system network model.
23 def __init__(self
, Region
=None, Substations
=None, Lines
=None, *args
, **kw_args
):
24 """Initialises a new 'SubGeographicalRegion' instance.
26 @param Region: The association is used in the naming hierarchy.
27 @param Substations: The association is used in the naming hierarchy.
28 @param Lines: A Line can be contained by a SubGeographical Region.
33 self
._Substations
= []
34 self
.Substations
= [] if Substations
is None else Substations
37 self
.Lines
= [] if Lines
is None else Lines
39 super(SubGeographicalRegion
, self
).__init
__(*args
, **kw_args
)
45 _refs
= ["Region", "Substations", "Lines"]
46 _many_refs
= ["Substations", "Lines"]
49 """The association is used in the naming hierarchy.
53 def setRegion(self
, value
):
54 if self
._Region
is not None:
55 filtered
= [x
for x
in self
.Region
.Regions
if x
!= self
]
56 self
._Region
._Regions
= filtered
59 if self
._Region
is not None:
60 self
._Region
._Regions
.append(self
)
62 Region
= property(getRegion
, setRegion
)
64 def getSubstations(self
):
65 """The association is used in the naming hierarchy.
67 return self
._Substations
69 def setSubstations(self
, value
):
70 for x
in self
._Substations
:
74 self
._Substations
= value
76 Substations
= property(getSubstations
, setSubstations
)
78 def addSubstations(self
, *Substations
):
79 for obj
in Substations
:
81 self
._Substations
.append(obj
)
83 def removeSubstations(self
, *Substations
):
84 for obj
in Substations
:
86 self
._Substations
.remove(obj
)
89 """A Line can be contained by a SubGeographical Region.
93 def setLines(self
, value
):
100 Lines
= property(getLines
, setLines
)
102 def addLines(self
, *Lines
):
105 self
._Lines
.append(obj
)
107 def removeLines(self
, *Lines
):
110 self
._Lines
.remove(obj
)