Adding class meta-data attributes.
[PyCIM.git] / schemata / CIM14 / IEC61970 / LoadModel / PowerCutZone.py
blob228d6eeada76fb450267932b8506ceb87eefdac6
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.PowerSystemResource import PowerSystemResource
19 class PowerCutZone(PowerSystemResource):
20 """An area or zone of the power system which is used for load shedding purposes.
21 """
23 def __init__(self, cutLevel1=0.0, cutLevel2=0.0, EnergyConsumers=None, *args, **kw_args):
24 """Initialises a new 'PowerCutZone' instance.
26 @param cutLevel1: First level (amount) of load to cut as a percentage of total zone load
27 @param cutLevel2: Second level (amount) of load to cut as a percentage of total zone load
28 @param EnergyConsumers: An energy consumer is assigned to a power cut zone
29 """
30 #: First level (amount) of load to cut as a percentage of total zone load
31 self.cutLevel1 = cutLevel1
33 #: Second level (amount) of load to cut as a percentage of total zone load
34 self.cutLevel2 = cutLevel2
36 self._EnergyConsumers = []
37 self.EnergyConsumers = [] if EnergyConsumers is None else EnergyConsumers
39 super(PowerCutZone, self).__init__(*args, **kw_args)
41 _attrs = ["cutLevel1", "cutLevel2"]
42 _attr_types = {"cutLevel1": float, "cutLevel2": float}
43 _defaults = {"cutLevel1": 0.0, "cutLevel2": 0.0}
44 _enums = {}
45 _refs = ["EnergyConsumers"]
46 _many_refs = ["EnergyConsumers"]
48 def getEnergyConsumers(self):
49 """An energy consumer is assigned to a power cut zone
50 """
51 return self._EnergyConsumers
53 def setEnergyConsumers(self, value):
54 for x in self._EnergyConsumers:
55 x._PowerCutZone = None
56 for y in value:
57 y._PowerCutZone = self
58 self._EnergyConsumers = value
60 EnergyConsumers = property(getEnergyConsumers, setEnergyConsumers)
62 def addEnergyConsumers(self, *EnergyConsumers):
63 for obj in EnergyConsumers:
64 obj._PowerCutZone = self
65 self._EnergyConsumers.append(obj)
67 def removeEnergyConsumers(self, *EnergyConsumers):
68 for obj in EnergyConsumers:
69 obj._PowerCutZone = None
70 self._EnergyConsumers.remove(obj)