Update README.rst
[PyCIM.git] / CIM14 / CDPSM / Unbalanced / IEC61970 / Wires / EnergyConsumer.py
blob59932ab8e295742ca07280e2785e6635d67c8759
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
19 # IN THE SOFTWARE.
21 from CIM14.CDPSM.Unbalanced.IEC61970.Core.ConductingEquipment import ConductingEquipment
23 class EnergyConsumer(ConductingEquipment):
24 """Generic user of energy - a point of consumption on the power system model
25 """
27 def __init__(self, pfixed=0.0, pfixedPct=0.0, qfixedPct=0.0, qfixed=0.0, customerCount=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 customerCount: Number of individual customers represented by this Demand
35 @param LoadResponse: The load response characteristic of this load.
36 """
37 #: Active power of the load that is a fixed quantity.
38 self.pfixed = pfixed
40 #: Fixed active power as per cent of load group fixed active power
41 self.pfixedPct = pfixedPct
43 #: Fixed reactive power as per cent of load group fixed reactive power.
44 self.qfixedPct = qfixedPct
46 #: Reactive power of the load that is a fixed quantity.
47 self.qfixed = qfixed
49 #: Number of individual customers represented by this Demand
50 self.customerCount = customerCount
52 self._LoadResponse = None
53 self.LoadResponse = LoadResponse
55 super(EnergyConsumer, self).__init__(*args, **kw_args)
57 _attrs = ["pfixed", "pfixedPct", "qfixedPct", "qfixed", "customerCount"]
58 _attr_types = {"pfixed": float, "pfixedPct": float, "qfixedPct": float, "qfixed": float, "customerCount": int}
59 _defaults = {"pfixed": 0.0, "pfixedPct": 0.0, "qfixedPct": 0.0, "qfixed": 0.0, "customerCount": 0}
60 _enums = {}
61 _refs = ["LoadResponse"]
62 _many_refs = []
64 def getLoadResponse(self):
65 """The load response characteristic of this load.
66 """
67 return self._LoadResponse
69 def setLoadResponse(self, value):
70 if self._LoadResponse is not None:
71 filtered = [x for x in self.LoadResponse.EnergyConsumer if x != self]
72 self._LoadResponse._EnergyConsumer = filtered
74 self._LoadResponse = value
75 if self._LoadResponse is not None:
76 if self not in self._LoadResponse._EnergyConsumer:
77 self._LoadResponse._EnergyConsumer.append(self)
79 LoadResponse = property(getLoadResponse, setLoadResponse)