PowerUtility#
- class PowerUtility(consumption=0.0, production=0.0)[source]#
Create an PowerUtility object that stores data on consumption and production of electricity.
Notes
The default price is 0.0782 USD/kWhr as suggested in [1].
References
Examples
Create a PowerUtility object:
>>> pu = PowerUtility() >>> pu PowerUtility(consumption=0.0, production=0.0)
PowerUtility objects have consumption and production attributes which are updated when setting the power with the assumption that a positive power means no production (only consumption) and a negative power means no consumption (only production).
>>> pu(power=-500) >>> pu.consumption, pu.production (0.0, 500.0)
>>> pu(power=500.) >>> pu.consumption, pu.production (500.0, 0.0)
It is possible to have both consumption and production by setting these attributes individually (instead of setting power)
>>> pu.production = 100. >>> pu.power 400.0
Notice how the power is equal to the consumption minus the production.
The cost is available as a property:
>>> pu.cost # USD/hr 31.28
It may be useful to print results in different units of measure:
>>> pu.show(power='BTU/s') PowerUtility: consumption: 474 BTU/s production: 94.8 BTU/s power: 379 BTU/s cost: 31.3 USD/hr
-
characterization_factors:
dict
[tuple
[str
,str
],float
] = {}# Characterization factors for life cycle assessment [impact/kWhr] by impact key and kind (None, ‘consumption’, or ‘production’).
-
display_units:
DisplayUnits
= DisplayUnits(power='kW', cost='USD/hr')# Units of measure for IPython display
- classmethod get_CF(key, consumption=True, production=True, basis=None, units=None)[source]#
Return the life-cycle characterization factor for consumption and production on a kWhr basis given the impact key.
- Parameters:
key (
str
) – Name of impact indicator.consumption (
bool
, optional) – Whether to return impact indicator for electricity consumption.production (
bool
, optional) – Whether to return impact indicator for electricity production.basis (
str
, optional) – Basis of characterization factor. Energy is the only valid dimension. Defaults to ‘kWhr’.units (
str
, optional) – Units of impact indicator. Before using this argument, the default units of the impact indicator should be defined withsettings.define_impact_indicator
. Units must also be dimensionally consistent with the default units.
- classmethod set_CF(key, consumption=None, production=None, basis=None, units=None)[source]#
Set the life-cycle characterization factors for consumption and production on a kWhr basis given the impact key.
- Parameters:
key (
str
) – Name of impact indicator.consumption (
float
, optional) – Impact indicator for electricity consumption.production (
float
, optional) – Impact indicator for electricity production.basis (
str
, optional) – Basis of characterization factor. Energy is the only valid dimension. Defaults to ‘kWhr’.units (
str
, optional) – Units of impact indicator. Before using this argument, the default units of the impact indicator should be defined withsettings.define_impact_indicator
. Units must also be dimensionally consistent with the default units.
- get_impact(key)[source]#
Return the impact [impact/hr] given characterization factor keys for consumption and production. If no production key given, it defaults to the consumption key.
- mix_from(power_utilities)[source]#
Mix in requirements of power utilities.
Examples
>>> pus = [PowerUtility(production=100), ... PowerUtility(consumption=50), ... PowerUtility(production=20)] >>> pu = PowerUtility() >>> pu.mix_from(pus) >>> print(pu) PowerUtility(consumption=50.0, production=120.0)
- classmethod sum(power_utilities)[source]#
Return a PowerUtility object that represents the sum of power utilities.
Examples
>>> pus = [PowerUtility(production=100), ... PowerUtility(consumption=50), ... PowerUtility(production=20)] >>> pu = PowerUtility.sum(pus) >>> print(pu) PowerUtility(consumption=50.0, production=120.0)
- get_property(name, units=None)#
Return property in requested units.
-
characterization_factors: