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
.ConductingEquipment
import ConductingEquipment
23 class EnergyConsumer(ConductingEquipment
):
24 """Generic user of energy - a point of consumption on the power system model
27 def __init__(self
, customerCount
=0, qfixedPct
=0.0, pfixed
=0.0, pfixedPct
=0.0, qfixed
=0.0, aggregateLoad0
=None, PowerCutZone
=None, ServiceDeliveryPoints
=None, LoadResponse
=None, *args
, **kw_args
):
28 """Initialises a new 'EnergyConsumer' instance.
30 @param customerCount: Number of individual customers represented by this Demand
31 @param qfixedPct: Fixed reactive power as per cent of load group fixed reactive power.
32 @param pfixed: Active power of the load that is a fixed quantity.
33 @param pfixedPct: Fixed active power as per cent of load group fixed active power
34 @param qfixed: Reactive power of the load that is a fixed quantity.
35 @param aggregateLoad0:
36 @param PowerCutZone: An energy consumer is assigned to a power cut zone
37 @param ServiceDeliveryPoints:
38 @param LoadResponse: The load response characteristic of this load.
40 #: Number of individual customers represented by this Demand
41 self
.customerCount
= customerCount
43 #: Fixed reactive power as per cent of load group fixed reactive power.
44 self
.qfixedPct
= qfixedPct
46 #: Active power of the load that is a fixed quantity.
49 #: Fixed active power as per cent of load group fixed active power
50 self
.pfixedPct
= pfixedPct
52 #: Reactive power of the load that is a fixed quantity.
55 self
._aggregateLoad
0 = []
56 self
.aggregateLoad0
= [] if aggregateLoad0
is None else aggregateLoad0
58 self
._PowerCutZone
= None
59 self
.PowerCutZone
= PowerCutZone
61 self
._ServiceDeliveryPoints
= []
62 self
.ServiceDeliveryPoints
= [] if ServiceDeliveryPoints
is None else ServiceDeliveryPoints
64 self
._LoadResponse
= None
65 self
.LoadResponse
= LoadResponse
67 super(EnergyConsumer
, self
).__init
__(*args
, **kw_args
)
69 _attrs
= ["customerCount", "qfixedPct", "pfixed", "pfixedPct", "qfixed"]
70 _attr_types
= {"customerCount": int, "qfixedPct": float, "pfixed": float, "pfixedPct": float, "qfixed": float}
71 _defaults
= {"customerCount": 0, "qfixedPct": 0.0, "pfixed": 0.0, "pfixedPct": 0.0, "qfixed": 0.0}
73 _refs
= ["aggregateLoad0", "PowerCutZone", "ServiceDeliveryPoints", "LoadResponse"]
74 _many_refs
= ["aggregateLoad0", "ServiceDeliveryPoints"]
76 def getaggregateLoad0(self
):
78 return self
._aggregateLoad
0
80 def setaggregateLoad0(self
, value
):
81 for p
in self
._aggregateLoad
0:
82 filtered
= [q
for q
in p
.energyConsumer0
if q
!= self
]
83 self
._aggregateLoad
0._energyConsumer
0 = filtered
85 if self
not in r
._energyConsumer
0:
86 r
._energyConsumer
0.append(self
)
87 self
._aggregateLoad
0 = value
89 aggregateLoad0
= property(getaggregateLoad0
, setaggregateLoad0
)
91 def addaggregateLoad0(self
, *aggregateLoad0
):
92 for obj
in aggregateLoad0
:
93 if self
not in obj
._energyConsumer
0:
94 obj
._energyConsumer
0.append(self
)
95 self
._aggregateLoad
0.append(obj
)
97 def removeaggregateLoad0(self
, *aggregateLoad0
):
98 for obj
in aggregateLoad0
:
99 if self
in obj
._energyConsumer
0:
100 obj
._energyConsumer
0.remove(self
)
101 self
._aggregateLoad
0.remove(obj
)
103 def getPowerCutZone(self
):
104 """An energy consumer is assigned to a power cut zone
106 return self
._PowerCutZone
108 def setPowerCutZone(self
, value
):
109 if self
._PowerCutZone
is not None:
110 filtered
= [x
for x
in self
.PowerCutZone
.EnergyConsumers
if x
!= self
]
111 self
._PowerCutZone
._EnergyConsumers
= filtered
113 self
._PowerCutZone
= value
114 if self
._PowerCutZone
is not None:
115 if self
not in self
._PowerCutZone
._EnergyConsumers
:
116 self
._PowerCutZone
._EnergyConsumers
.append(self
)
118 PowerCutZone
= property(getPowerCutZone
, setPowerCutZone
)
120 def getServiceDeliveryPoints(self
):
122 return self
._ServiceDeliveryPoints
124 def setServiceDeliveryPoints(self
, value
):
125 for x
in self
._ServiceDeliveryPoints
:
126 x
.EnergyConsumer
= None
128 y
._EnergyConsumer
= self
129 self
._ServiceDeliveryPoints
= value
131 ServiceDeliveryPoints
= property(getServiceDeliveryPoints
, setServiceDeliveryPoints
)
133 def addServiceDeliveryPoints(self
, *ServiceDeliveryPoints
):
134 for obj
in ServiceDeliveryPoints
:
135 obj
.EnergyConsumer
= self
137 def removeServiceDeliveryPoints(self
, *ServiceDeliveryPoints
):
138 for obj
in ServiceDeliveryPoints
:
139 obj
.EnergyConsumer
= None
141 def getLoadResponse(self
):
142 """The load response characteristic of this load.
144 return self
._LoadResponse
146 def setLoadResponse(self
, value
):
147 if self
._LoadResponse
is not None:
148 filtered
= [x
for x
in self
.LoadResponse
.EnergyConsumer
if x
!= self
]
149 self
._LoadResponse
._EnergyConsumer
= filtered
151 self
._LoadResponse
= value
152 if self
._LoadResponse
is not None:
153 if self
not in self
._LoadResponse
._EnergyConsumer
:
154 self
._LoadResponse
._EnergyConsumer
.append(self
)
156 LoadResponse
= property(getLoadResponse
, setLoadResponse
)