open-grid-emissions
open-grid-emissions copied to clipboard
Calculate electric_allocation_factor by subplant
Purpose
As I was exploring OGE data, I noticed that in some months, some subplants have an electric_allocation_factor (EAF) of 0 (meaning no fuel went to electricity production), but have net generation > 0. If net generation is greater than zero, then the electric allocation factor should always be greater than zero. Here's an example of the issue:
If we use plant 4042, subplant 1 as an example, here's what I found is happening: This subplant has two generators, 1 and 2. In the EIA-923 data, all of the fuel consumption in May is reported for generator 1, while all of the generation data is reported for generator 2. Since the EAF calculation depends on both factors, The EAF for gen 1 is calculated as 0 (which is multiplied by all of the fuel), and the EAF for gen 2 is 1, but is multiplied by 0 fuel.
This suggests that when calculating the electric allocation factor, we should probably be calculating this at the subplant level rather than the generator level, since the fuel and generation may not always be reported for the same generator in a subplant.
What the code is doing
Updates the code for calculating electric allocation factors, to calculate them for each subplant-month-fuel group, so that we are not dropping electricity-related fuel on accident.
I also added a new helper function add_subplant_ids_to_df()
that adds subplant ids to a dataframe, since pattern was re-used in a bunch of places.
In load_data
, I also added a new argument to add_report_date
that will allow this function to be used in other repos without failing when the data source is s3.
Testing
If we look at the results for the example plant 4042 subplant 1 above, for the month of May 2021, we see that using the subplant EAF now allocates non-zero electricity-related fuel consumption to the subplant:
Although this has a big impact on specific plants, and the distribution of fuel among generators in EIA-923, this does not have a large impact on the total fuel consumption across the country:
I successfully ran the entire pipeline for 2018.
Where to look
Usage Example/Visuals
Review estimate
10 minutes
Future work
What issues were identified that are not being addressed in this PR but should be addressed in future work?
Checklist
- [x] Update the documentation to reflect changes made in this PR
- [x] Format all updated python files using
ruff
- [x] Clear outputs from all notebooks modified
- [x] Add docstrings and type hints to any new functions created