Breakthrough-Energy / PreREISE

Generate input data for scenario framework
https://breakthrough-energy.github.io/docs/
MIT License
20 stars 28 forks source link

refactor: improve mapping of generators to buses #267

Closed danielolsen closed 2 years ago

danielolsen commented 2 years ago

Pull Request doc

Purpose

In preliminary testing, the hifld grid model had shown a lot of infeasibilities caused by mismatches between inflexible generators (namely coal, nuclear, and hydro) and local transmission capacities. This PR aims to improve this in two primary ways:

Hydro aggregation is relevant to the improving how generators are mapped to buses within substations step, since we decide which bus within a substation to map to based on generator capacity.

The most complicated part by far is the how generators are mapped to substations. The old logic was:

The new logic is:

The no-coordinates case is a fraction of a percent; the big changes are from the cases where we do have coordinates and now use those as the primary substation mapping tool, rather than ZIP codes.

What the code is doing

Aggregating hydro units: a new aggregate_hydro_generators_by_plant_id function is added, which groups hydro units by plant ID, sums Pmin and Pmax, and returns all other attributes and index from the first unit in the group.

Improving the mapping of generators to substations:

Improving how generators are mapped to buses within substations: map_generator_to_bus_by_sub is refactored from the previous logic (always map to the lowest-voltage bus within the substation) to branching logic:

There's also a small unrelated fix to prevent duplicate 'interconnect' columns in some output CSVs, which was preventing the grid.mat files created from REISE.jl from being read back into PowerSimData for post-simulation analysis.

Testing

Tested manually. The printouts for the edge cases of mapping generators to substations looks like:

no substations within (Western, MA), will map generators to substations within MA instead
no substations within (Western, MO), will map generators to substations within MO instead
no substations within (Eastern, CA), will map generators to substations within CA instead
no substations within (Western, VA), will map generators to substations within VA instead
no substations within (Western, PA), will map generators to substations within PA instead
no substations within (Western, KS), will map generators to substations within Western instead
no substations within (ERCOT, OK), will map generators to substations within ERCOT instead

With this change, about 25% of generators end up mapped to a different substation (2,837 out of 12,735). In addition, 29 generators can be mapped which were not mapped with the previous logic. The most impactful change may have been how Palo Verde's generator were mapped: previously they ended up at a 69 kV substation within metro Phoenix; now they're appropriately connected to the 500 kV substation at their true location. Many other large inflexible generators are relocated as well, and generators in WECC seem to be particularly affected.

Running powerflows with the results shows drastic improvement in WECC, where infeasibilities were initially the worst. Previously, the total amount of transmission line limit violation energy that was required was about 25% of the total demand. After the change, this is down to 0.45%. In addition, transmission violations occur at fewer than half as many lines as before. Eastern powerflows are still running but I expect to see significant improvements there as well. EDIT: Eastern is done. The improvements aren't quite as good as in Western, but are still big improvements. Transmission violation energy is down to 5.1% (from 18.2% before) and at 0.19% of branches (from 0.61% before). That puts the overall USA-wide number of violating branches down to around 200, less than 1 out of every 400 branches, and about a third as many as before the refactor.

Usage Example/Visuals

All code is still launched via:

from prereise.gather.griddata.hifld import create_csvs
create_csvs(output_folder_name)

Time estimate

1 hour. Most of the new code is pretty straightforward, but about half of it is designed to combat edge cases caused by strange data inputs from the original EIA Form 860 data.

danielolsen commented 2 years ago

I've refactored this so that it ignores states completely, and uses the voltage(s) available at each substation to help ensure that generators don't get mapped to substations with inadequate transmission capacity, based on their listed 'grid voltage' within Form 860. In a quick one-day test on Eastern, it seems to help: previously the transmission violations were > 17 GW in every hour of the year, but in the test day we have transmission violations as low as 1.3 GW. I'll run the full year over the weekend and report more detailed results.

The nonsensical-interconnection listing is at least partially fixed by using the Balancing Authority column of each generator within Form 860 to map to interconnects, rather than the NERC region. For whatever reason, BA seems more reliable, and we only use the NERC region as a fall-back. The generators which end up getting mapped more than 50 miles away now all seem to be either:

danielolsen commented 2 years ago

Results for full-year runs with the new voltage-class and interconnection mapping of generators to substations:

We're down to only 138 branches with violations across the whole USA. The next thing I'm going to try is revising the configuration of transformers within substations, which should hopefully increase the effective impedance between the higher-voltage buses at which large generators are connected and the lower-voltage buses connected to low-voltage branches with transmission violation.

danielolsen commented 2 years ago

The 'cascade' configuration (every bus within a substation is connected via a transformer to the next-highest bus) reduces transmission violation energy only barely compared to the previous configuration (every bus is connected to the substation's highest-voltage bus), but has a larger impact on reducing the number of branches at which transmission violations occur:

The remaining transmission violations are pretty heavily concentrated among a few branches, with what I believe are a few common root causes: