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
.Curve
import Curve
23 class EmissionAccount(Curve
):
24 """Accounts for tracking emissions usage and credits for thermal generating units. A unit may have zero or more emission accounts, and will typically have one for tracking usage and one for tracking credits.
27 def __init__(self
, emissionType
="chlorine", emissionValueSource
="measured", ThermalGeneratingUnit
=None, *args
, **kw_args
):
28 """Initialises a new 'EmissionAccount' instance.
30 @param emissionType: The type of emission, for example sulfur dioxide (SO2). The y1AxisUnits of the curve contains the unit of measure (e.g. kg) and the emissionType is the type of emission (e.g. sulfer dioxide). Values are: "chlorine", "carbonDioxide", "hydrogenSulfide", "nitrogenOxide", "sulfurDioxide", "carbonDisulfide"
31 @param emissionValueSource: The source of the emission value. Values are: "measured", "calculated"
32 @param ThermalGeneratingUnit: A thermal generating unit may have one or more emission allowance accounts
34 #: The type of emission, for example sulfur dioxide (SO2). The y1AxisUnits of the curve contains the unit of measure (e.g. kg) and the emissionType is the type of emission (e.g. sulfer dioxide). Values are: "chlorine", "carbonDioxide", "hydrogenSulfide", "nitrogenOxide", "sulfurDioxide", "carbonDisulfide"
35 self
.emissionType
= emissionType
37 #: The source of the emission value. Values are: "measured", "calculated"
38 self
.emissionValueSource
= emissionValueSource
40 self
._ThermalGeneratingUnit
= None
41 self
.ThermalGeneratingUnit
= ThermalGeneratingUnit
43 super(EmissionAccount
, self
).__init
__(*args
, **kw_args
)
45 _attrs
= ["emissionType", "emissionValueSource"]
46 _attr_types
= {"emissionType": str, "emissionValueSource": str}
47 _defaults
= {"emissionType": "chlorine", "emissionValueSource": "measured"}
48 _enums
= {"emissionType": "EmissionType", "emissionValueSource": "EmissionValueSource"}
49 _refs
= ["ThermalGeneratingUnit"]
52 def getThermalGeneratingUnit(self
):
53 """A thermal generating unit may have one or more emission allowance accounts
55 return self
._ThermalGeneratingUnit
57 def setThermalGeneratingUnit(self
, value
):
58 if self
._ThermalGeneratingUnit
is not None:
59 filtered
= [x
for x
in self
.ThermalGeneratingUnit
.EmmissionAccounts
if x
!= self
]
60 self
._ThermalGeneratingUnit
._EmmissionAccounts
= filtered
62 self
._ThermalGeneratingUnit
= value
63 if self
._ThermalGeneratingUnit
is not None:
64 if self
not in self
._ThermalGeneratingUnit
._EmmissionAccounts
:
65 self
._ThermalGeneratingUnit
._EmmissionAccounts
.append(self
)
67 ThermalGeneratingUnit
= property(getThermalGeneratingUnit
, setThermalGeneratingUnit
)