emissions
This module consists of code that computes Scope 2 emissions given an electricity consumption profile.
Functions to calculate emissions from electricity consumption data.
- electric_emission_cost.emissions.calculate_grid_emissions(carbon_intensity, consumption_data, emissions_units=<Unit('kilogram / megawatt_hour')>, consumption_units=<Unit('kilowatt')>, resolution='15m', model=None, varstr='')[source]
Calculates the emissions for the given consumption information as a cvxpy object carbon intensity of electricity generation structure as a DataFrame.
- Parameters:
carbon_intensity (array) – numpy array with kg of CO2 per kWh
consumption_data (numpy.Array, cvxpy.Variable, or pyomo.environ.Var) – Baseline electrical or gas usage data as a Pyomo Var
emissions_units (pint.Unit) – Units for the emissions data. Default is kg / MWh
consumption_units (pint.Unit) – Units for the electricity consumption data. Default is kW
resolution (str) – granularity of each timestep in string form with default value of “15m”
model (pyomo.Model) – The model object associated with the problem. Only used in the case of Pyomo, so None by default.
varstr (str) – Name of the variable to be created if using a Pyomo model
- Returns:
tuple of pyomo Var representing emissions in kg of CO2 for the given consumption_data and carbon_intensity and the accompanying model object. The model object is only used for Pyomo, so by default it is None
- Return type:
(pint.Quantity, cvxpy.Expression, or pyomo.environ.Var), pyomo.Model
- electric_emission_cost.emissions.get_carbon_intensity(start_dt, end_dt, emissions_data, emissions_units=<Unit('kilogram / megawatt_hour')>, resolution='15m', ei_varname='co2_eq_kg_per_MWh')[source]
Computes the emissions (as kilograms of CO2) of a horizon of data
- Parameters:
start_dt (datetime.datetime or numpy.datetime64) – Start datetime to gather rate information.
end_dt (datetime.datetime or numpy.datetime64) – End datetime to gather rate information. This end_dt is excluded to be consistent with Python syntax.
emissions_data (DataFrame) – Electric grid emissions information. Only one of datetime_local and month/day/hour are required.
datetime_local
local datetime to estimate the marginal emissions
month
month for which the emissions data was averaged
day
day for which the emissions data was averaged
hour
hour for which the emissions data was averaged
co2_eq_kg_per_MWh
emissions in kg of CO2 per MWh of grid electricity
emissions_units (pint.Unit) – Units for the emissions data. Default is kg / MWh
resolution (str) – a string of the form [int][str] giving the temporal resolution on which charges are assessed. The str portion corresponds to numpy timedelta64 types. For example ‘15m’ specifying demand charges that are applied to 15-minute intervals of electricity consumption
ei_varname (str) – column name for the Scope 2 emissions factor. Default is EI_VARNAME=”co2_eq_kg_per_MWh”
- Returns:
emissions from start_dt to end_dt in kg CO2 / kWh
- Return type:
pint.Quantity