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
.CPSM
.Equipment
.Core
.ConductingEquipment
import ConductingEquipment
23 class EnergyConsumer(ConductingEquipment
):
24 """Generic user of energy - a point of consumption on the power system model- [R8.2] is satisfied by navigation to ConnectivityNode and Substation - The definition of the real and reactive power injections for an EnergyConsumer can be done using different sets of attributes. In the simplest case, the injections can be defined directly using only the attributes “pfixed” and “qfixed”. - To specify conforming and nonconforming loads, the classes ConformLoad, NonConformLoad, or their subtypes should be used. - The attributes defining the affect of voltage and frequency on the injection defined by an associated LoadResponseCharacteristic should be supplied, if they are available, but are not required.
27 def __init__(self
, pfixed
=0.0, pfixedPct
=0.0, qfixedPct
=0.0, qfixed
=0.0, LoadResponse
=None, *args
, **kw_args
):
28 """Initialises a new 'EnergyConsumer' instance.
30 @param pfixed: Active power of the load that is a fixed quantity.
31 @param pfixedPct: Fixed active power as per cent of load group fixed active power
32 @param qfixedPct: Fixed reactive power as per cent of load group fixed reactive power.
33 @param qfixed: Reactive power of the load that is a fixed quantity.
34 @param LoadResponse: The load response characteristic of this load.
36 #: Active power of the load that is a fixed quantity.
39 #: Fixed active power as per cent of load group fixed active power
40 self
.pfixedPct
= pfixedPct
42 #: Fixed reactive power as per cent of load group fixed reactive power.
43 self
.qfixedPct
= qfixedPct
45 #: Reactive power of the load that is a fixed quantity.
48 self
._LoadResponse
= None
49 self
.LoadResponse
= LoadResponse
51 super(EnergyConsumer
, self
).__init
__(*args
, **kw_args
)
53 _attrs
= ["pfixed", "pfixedPct", "qfixedPct", "qfixed"]
54 _attr_types
= {"pfixed": float, "pfixedPct": float, "qfixedPct": float, "qfixed": float}
55 _defaults
= {"pfixed": 0.0, "pfixedPct": 0.0, "qfixedPct": 0.0, "qfixed": 0.0}
57 _refs
= ["LoadResponse"]
60 def getLoadResponse(self
):
61 """The load response characteristic of this load.
63 return self
._LoadResponse
65 def setLoadResponse(self
, value
):
66 if self
._LoadResponse
is not None:
67 filtered
= [x
for x
in self
.LoadResponse
.EnergyConsumer
if x
!= self
]
68 self
._LoadResponse
._EnergyConsumer
= filtered
70 self
._LoadResponse
= value
71 if self
._LoadResponse
is not None:
72 if self
not in self
._LoadResponse
._EnergyConsumer
:
73 self
._LoadResponse
._EnergyConsumer
.append(self
)
75 LoadResponse
= property(getLoadResponse
, setLoadResponse
)