Breakthrough-Energy / SwitchWrapper

Wrapper for Switch
MIT License
1 stars 2 forks source link

Curtailment results from SWITCH post-processing #41

Closed YifanLi86 closed 3 years ago

YifanLi86 commented 3 years ago

Post-calculate curtailment data from SWITCH results, summarize by type.

image

kasparm commented 3 years ago

@YifanLi86 can you please provide more details:

  1. Input: DispatchGen form pkl, EnergyAvailable column ? in variable_capacity_factors.csv
  2. Process: Curtailment = EnergyAvailable - DispatchGen for each unit(?) and timepoint.
  3. Output value, table: ? (Provide column and row description (Ex. Generator output per hour: row: hour, column: Generator Index))
danielolsen commented 3 years ago
>>> from postreise.analyze.generation.curtailment import calculate_curtailment_time_series
>>> from switchwrapper.switch_extract import get_output_scenarios
>>>
>>> # Extract grid and time-series data from outputs
>>> scenarios = get_output_scenarios(path_to_switch_project_folder)
>>> output_scenario = scenarios[2030]
>>> output_grid = output_scenario.get_grid()
>>> output_plant = output_grid.plant
>>>
>>> # Calculate curtailment by zone/type
>>> curtailment = calculate_curtailment_time_series(output_scenario)
>>> zone_id_curtailment = curtailment.sum().groupby([output_plant.zone_id, output_plant.type]).sum().unstack().fillna(0)
>>> zone_id_curtailment
type           solar         wind  wind_offshore
zone_id
201         35.81604      0.00000            0.0
202       2315.51442      0.00000            0.0
203      20546.51868      0.00000            0.0
204          0.00000      0.00000            0.0
205        480.85956      0.00000            0.0
206       3931.54614  11496.16980            0.0
207       8394.61788   4455.54738            0.0
208       1722.01086      0.00000            0.0
209       4602.52710   5357.79054            0.0
210          0.00000      0.00000            0.0
211          0.00000      0.00000            0.0
212          0.00000      0.00000            0.0
213          0.00000      0.00000            0.0
214          0.00000   9980.40132            0.0
215          0.00000    173.53098            0.0
216          0.00000      0.00000            0.0
>>>
>>> # Calculate curtailment by state/type
>>> zone_name_curtailment = zone_id_curtailment.rename(output_grid.id2zone)
>>> zone_states = zone_name_curtailment.index.map(output_grid.model_immutables.zones["loadzone2state"])
>>> state_curtailment = zone_id_curtailment.groupby(zone_states).sum()
>>> state_curtailment
type              solar         wind  wind_offshore
zone_id
Arizona      4602.52710   5357.79054            0.0
California  33353.54226  15951.71718            0.0
Colorado        0.00000      0.00000            0.0
Idaho           0.00000   9980.40132            0.0
Montana         0.00000    173.53098            0.0
Nevada       1722.01086      0.00000            0.0
New Mexico      0.00000      0.00000            0.0
Oregon       2315.51442      0.00000            0.0
Texas           0.00000      0.00000            0.0
Utah            0.00000      0.00000            0.0
Washington     35.81604      0.00000            0.0
Wyoming         0.00000      0.00000            0.0