<jupyter_start><jupyter_text>Testing Sensitivies on Grid Generation Resource Capacities for Figure 7Developed by <NAME>, 2022.<jupyter_code>import os
os.chdir('..')
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import pickle
import scipy
import os.path
import pandas
import matplotlib
import shutil
import copy

from simple_dispatch import generatorData
from simple_dispatch import bidStack
from simple_dispatch import dispatch
from simple_dispatch import generatorDataShort
from future_grid import FutureDemand
from future_grid import FutureGrid
from simple_dispatch import StorageModel<jupyter_output><empty_output><jupyter_text>Load generator model:<jupyter_code>gd_short = pickle.load(open('IntermediateOutputs/generator_data_short_WECC_2019.obj', 'rb'))<jupyter_output><empty_output><jupyter_text>What is 10% of capacity in the case of gas or coal in 2019?<jupyter_code>captotal = gd_short.df.loc[(gd_short.df['nerc']=='WECC')&(gd_short.df['is_gas']==1)].mw.sum()
print(0.1*captotal)
captotal = gd_short.df.loc[(gd_short.df['nerc']=='WECC')&(gd_short.df['is_coal']==1)].mw.sum()
print(0.1*captotal)<jupyter_output>7112.463508437365
3037.5<jupyter_text>Prepare Inputs<jupyter_code># os.mkdir('Results/GridExpansionSensitivity')
timer_names = {'':'Timers9pm', '_midnighttimer':'Timers12am', '_NoTimers':'TimersNone', '_RandomTimers':'TimersRandom'}
penlevel = 0.5
fuel = 1
solar = 3.5
wind = 3
# ev_scenario = 'HighHome'
ev_workplace_bool=False
ev_timers = '_NoTimers'
ev_scenario_date = '20220313'
# New values for solar
print(3.5*1.1)
print(3.5*0.9)
# New values for wind
print(3*1.1)
print(3*0.9)<jupyter_output>3.3000000000000003
2.7<jupyter_text>Case with No EVs for reference<jupyter_code>penlevel = 0
max_penlevel = 0
ev_scenario = None

save_str = 'Results/GridExpansionSensitivity/NoEVs_2035'

# Increases
# gas
grid = FutureGrid(gd_short)
grid.set_up_scenario(year=2035, solar=solar, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                         ev_workplace_control='', ev_workplace_bool=False, evs_bool=False, ev_scenario_date=ev_scenario_date, 
                                         weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                     generator_sensitivity=True, fuel_col='is_gas', percent_increase_of_total_ffcap=0.1)
grid.check_overgeneration(save_str=save_str)
print(save_str+'_gasUP10p')
grid.run_dispatch(max_penlevel, save_str+'_gasUP10p', result_date='20220408', force_storage=True) 
# coal
grid = FutureGrid(gd_short)
grid.set_up_scenario(year=2035, solar=solar, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                         ev_workplace_control='', ev_workplace_bool=False, evs_bool=False, ev_scenario_date=ev_scenario_date, 
                                         weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                    generator_sensitivity=True, fuel_col='is_coal', percent_increase_of_total_ffcap=0.1)
grid.check_overgeneration(save_str=save_str)
print(save_str+'_coalUP10p')
grid.run_dispatch(max_penlevel, save_str+'_coalUP10p', result_date='20220408', force_storage=True) 
# solar
grid = FutureGrid(gd_short)
grid.set_up_scenario(year=2035, solar=3.85, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                         ev_workplace_control='', ev_workplace_bool=False, evs_bool=False, ev_scenario_date=ev_scenario_date, 
                                         weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                    generator_sensitivity=False)
grid.check_overgeneration(save_str=save_str)
print(save_str+'_solarUP10p')
grid.run_dispatch(max_penlevel, save_str+'_solarUP10p', result_date='20220408', force_storage=True)
# wind
grid = FutureGrid(gd_short)
grid.set_up_scenario(year=2035, solar=solar, wind=3.3, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                         ev_workplace_control='', ev_workplace_bool=False, evs_bool=False, ev_scenario_date=ev_scenario_date, 
                                         weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                    generator_sensitivity=False)
grid.check_overgeneration(save_str=save_str)
print(save_str+'_windUP10p')
grid.run_dispatch(max_penlevel, save_str+'_windUP10p', result_date='20220408', force_storage=True) 

# Decreases
# gas
grid = FutureGrid(gd_short)
grid.set_up_scenario(year=2035, solar=solar, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                         ev_workplace_control='', ev_workplace_bool=False, evs_bool=False, ev_scenario_date=ev_scenario_date, 
                                         weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                     generator_sensitivity=True, generator_sensitivity_type='drop', fuel_col='is_gas', percent_decrease_of_total_ffcap=0.1)
grid.check_overgeneration(save_str=save_str)
print(save_str+'_gasDOWN10p')
grid.run_dispatch(max_penlevel, save_str+'_gasDOWN10p', result_date='20220408', force_storage=True) 
# coal
grid = FutureGrid(gd_short)
grid.set_up_scenario(year=2035, solar=solar, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                         ev_workplace_control='', ev_workplace_bool=False, evs_bool=False, ev_scenario_date=ev_scenario_date, 
                                         weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                    generator_sensitivity=True, generator_sensitivity_type='drop', fuel_col='is_coal', percent_decrease_of_total_ffcap=0.1)
grid.check_overgeneration(save_str=save_str)
print(save_str+'_coalDOWN10p')
grid.run_dispatch(max_penlevel, save_str+'_coalDOWN10p', result_date='20220408', force_storage=True) 
# solar
grid = FutureGrid(gd_short)
grid.set_up_scenario(year=2035, solar=3.15, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                         ev_workplace_control='', ev_workplace_bool=False, evs_bool=False, ev_scenario_date=ev_scenario_date, 
                                         weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                    generator_sensitivity=False)
grid.check_overgeneration(save_str=save_str)
print(save_str+'_solarDOWN10p')
grid.run_dispatch(max_penlevel, save_str+'_solarDOWN10p', result_date='20220408', force_storage=True)
# wind
grid = FutureGrid(gd_short)
grid.set_up_scenario(year=2035, solar=solar, wind=2.7, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                         ev_workplace_control='', ev_workplace_bool=False, evs_bool=False, ev_scenario_date=ev_scenario_date, 
                                         weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                    generator_sensitivity=False)
grid.check_overgeneration(save_str=save_str)
print(save_str+'_windDOWN10p')
grid.run_dispatch(max_penlevel, save_str+'_windDOWN10p', result_date='20220408', force_storage=True)<jupyter_output>Results/GridExpansionSensitivity/NoEVs_2035_gasUP10p
----Capacity too low----
Try with storage:
1.9% Complete
3.8% Complete
5.8% Complete
7.7% Complete
9.6% Complete
11.5% Complete
13.5% Complete
15.4% Complete
17.3% Complete
19.2% Complete
21.2% Complete
23.1% Complete
25.0% Complete
26.9% Complete
28.8% Complete
30.8% Complete
32.7% Complete
34.6% Complete
36.5% Complete
38.5% Complete
40.4% Complete
42.3% Complete
44.2% Complete
46.2% Complete
48.1% Complete
50.0% Complete
51.9% Complete
53.8% Complete
55.8% Complete
57.7% Complete
59.6% Complete
61.5% Complete
63.5% Complete
65.4% Complete
67.3% Complete
69.2% Complete
71.2% Complete
73.1% Complete
75.0% Complete
76.9% Complete
78.8% Complete
80.8% Complete
82.7% Complete
84.6% Complete
86.5% Complete
88.5% Complete
90.4% Complete
92.3% Complete
94.2% Complete
96.2% Complete
98.1% Complete
100.0% Complete
Solving optimization.
Storage Rate Result: 0
Storage Capacity:  0
Results/GridExpansionSensitivity/NoEVs_2035_coalUP10p
----Capa[...]<jupyter_text>With 50% EVs<jupyter_code>penlevel = 0.5
fuel = 1
solar = 3.5
wind = 3
ev_workplace_bool=False
ev_timers = '_NoTimers'
ev_scenario_date = '20220313'


max_penlevel = 0

for ev_scenario in ['UniversalHome', 'HighHome', 'LowHome_HighWork', 'LowHome_LowWork']:
    save_str = 'Results/GridExpansionSensitivity/fuel'+str(fuel)+'_solar'+str(solar)+'_wind'+str(wind)+'_'+ev_scenario+'_'+timer_names[ev_timers]+'_noWPcontrol'+'_penlevel'+str(penlevel)
    # Increases
    # gas
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=solar, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                         generator_sensitivity=True, fuel_col='is_gas', percent_increase_of_total_ffcap=0.1)
    grid.check_overgeneration(save_str=save_str+'_gasUP10p')
    print(save_str+'_gasUP10p')
    grid.run_dispatch(max_penlevel, save_str+'_gasUP10p', result_date='20220408') 
    # coal
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=solar, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                        generator_sensitivity=True, fuel_col='is_coal', percent_increase_of_total_ffcap=0.1)
    grid.check_overgeneration(save_str=save_str+'_coalUP10p')
    print(save_str+'_coalUP10p')
    grid.run_dispatch(max_penlevel, save_str+'_coalUP10p', result_date='20220408') 
    # solar
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=3.85, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                        generator_sensitivity=False)
    grid.check_overgeneration(save_str=save_str+'_solarUP10p')
    print(save_str+'_solarUP10p')
    grid.run_dispatch(max_penlevel, save_str+'_solarUP10p', result_date='20220408')
    # wind
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=solar, wind=3.3, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                        generator_sensitivity=False)
    grid.check_overgeneration(save_str=save_str+'_windUP10p')
    print(save_str+'_windUP10p')
    grid.run_dispatch(max_penlevel, save_str+'_windUP10p', result_date='20220408') 
    
    # Decreases
    # gas
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=solar, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                         generator_sensitivity=True, generator_sensitivity_type='drop', fuel_col='is_gas', percent_decrease_of_total_ffcap=0.1)
    grid.check_overgeneration(save_str=save_str+'_gasDOWN10p')
    print(save_str+'_gasDOWN10p')
    grid.run_dispatch(max_penlevel, save_str+'_gasDOWN10p', result_date='20220408') 
    # coal
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=solar, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                        generator_sensitivity=True, generator_sensitivity_type='drop', fuel_col='is_coal', percent_decrease_of_total_ffcap=0.1)
    grid.check_overgeneration(save_str=save_str+'_coalDOWN10p')
    print(save_str+'_coalDOWN10p')
    grid.run_dispatch(max_penlevel, save_str+'_coalDOWN10p', result_date='20220408') 
    # solar
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=3.15, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                        generator_sensitivity=False)
    grid.check_overgeneration(save_str=save_str+'_solarDOWN10p')
    print(save_str+'_solarDOWN10p')
    grid.run_dispatch(max_penlevel, save_str+'_solarDOWN10p', result_date='20220408')
    # wind
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=solar, wind=2.7, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                        generator_sensitivity=False)
    grid.check_overgeneration(save_str=save_str+'_windDOWN10p')
    print(save_str+'_windDOWN10p')
    grid.run_dispatch(max_penlevel, save_str+'_windDOWN10p', result_date='20220408')<jupyter_output>Results/GridExpansionSensitivity/fuel1_solar3.5_wind3_UniversalHome_TimersNone_noWPcontrol_penlevel0.5_gasUP10p
----Capacity too low----
Try with storage:
1.9% Complete
3.8% Complete
5.8% Complete
7.7% Complete
9.6% Complete
11.5% Complete
13.5% Complete
15.4% Complete
17.3% Complete
19.2% Complete
21.2% Complete
23.1% Complete
25.0% Complete
26.9% Complete
28.8% Complete
30.8% Complete
32.7% Complete
34.6% Complete
36.5% Complete
38.5% Complete
40.4% Complete
42.3% Complete
44.2% Complete
46.2% Complete
48.1% Complete
50.0% Complete
51.9% Complete
53.8% Complete
55.8% Complete
57.7% Complete
59.6% Complete
61.5% Complete
63.5% Complete
65.4% Complete
67.3% Complete
69.2% Complete
71.2% Complete
73.1% Complete
75.0% Complete
76.9% Complete
78.8% Complete
80.8% Complete
82.7% Complete
84.6% Complete
86.5% Complete
88.5% Complete
90.4% Complete
92.3% Complete
94.2% Complete
96.2% Complete
98.1% Complete
100.0% Complete
Solving optimization.
Storage Rate Result: 0
Storage Capacity:  0
Res[...]<jupyter_text>Test the storage amount:<jupyter_code>penlevel = 0.5
fuel = 1
solar = 3.5
wind = 3
ev_workplace_bool=False
ev_timers = '_NoTimers'
ev_scenario_date = '20220313'

max_rate = 10000 # assumes average 4 hour storage 
cap = 40000



max_penlevel = 0

for ev_scenario in ['UniversalHome', 'HighHome', 'LowHome_HighWork', 'LowHome_LowWork']:
    save_str = 'Results/GridExpansionSensitivity/fuel'+str(fuel)+'_solar'+str(solar)+'_wind'+str(wind)+'_'+ev_scenario+'_'+timer_names[ev_timers]+'_noWPcontrol'+'_penlevel'+str(penlevel)
    # Increases
    # gas
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=solar, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                         generator_sensitivity=True, fuel_col='is_gas', percent_increase_of_total_ffcap=0.1)
    grid.check_overgeneration(save_str=save_str+'_gasUP10p', change_demand=False)
    grid.run_storage_before_capacitydispatch(cap, max_rate, allow_negative=True)
    grid.storage.df.to_csv(save_str+'_gasUP10p'+'_storagebeforedf_'+'20220408'+'.csv')
    grid.future.demand['demand'] = np.copy(grid.storage.df.comb_demand_after_storage.values)
    grid.check_overgeneration(save_str=save_str+'_gasUP10p', change_demand=True, extra_save_str='_afterstorage')
    grid.future.demand.to_csv(save_str+'_gasUP10p'+'_futuredemand_storagebefore_afterstorage_20220408.csv')
#     grid.check_overgeneration(save_str=save_str+'_gasUP10p')
    print(save_str+'_gasUP10p')
#     grid.run_dispatch(max_penlevel, save_str+'_gasUP10p', result_date='20220408') 
    # coal
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=solar, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                        generator_sensitivity=True, fuel_col='is_coal', percent_increase_of_total_ffcap=0.1)
    grid.check_overgeneration(save_str=save_str+'_coalUP10p', change_demand=False)
    grid.run_storage_before_capacitydispatch(cap, max_rate, allow_negative=True)
    grid.storage.df.to_csv(save_str+'_coalUP10p'+'_storagebeforedf_'+'20220408'+'.csv')
    grid.future.demand['demand'] = np.copy(grid.storage.df.comb_demand_after_storage.values)
    grid.check_overgeneration(save_str=save_str+'_coalUP10p', change_demand=True, extra_save_str='_afterstorage')
    grid.future.demand.to_csv(save_str+'_coalUP10p'+'_futuredemand_storagebefore_afterstorage_20220408.csv')
    #     grid.check_overgeneration(save_str=save_str+'_coalUP10p')
    print(save_str+'_coalUP10p')
#     grid.run_dispatch(max_penlevel, save_str+'_coalUP10p', result_date='20220408') 
    # solar
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=3.85, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                        generator_sensitivity=False)
    grid.check_overgeneration(save_str=save_str+'_solarUP10p', change_demand=False)
    grid.run_storage_before_capacitydispatch(cap, max_rate, allow_negative=True)
    grid.storage.df.to_csv(save_str+'_solarUP10p'+'_storagebeforedf_'+'20220408'+'.csv')
    grid.future.demand['demand'] = np.copy(grid.storage.df.comb_demand_after_storage.values)
    grid.check_overgeneration(save_str=save_str+'_solarUP10p', change_demand=True, extra_save_str='_afterstorage')
    grid.future.demand.to_csv(save_str+'_solarUP10p'+'_futuredemand_storagebefore_afterstorage_20220408.csv')
    #     grid.check_overgeneration(save_str=save_str+'_solarUP10p')
    print(save_str+'_solarUP10p')
#     grid.run_dispatch(max_penlevel, save_str+'_solarUP10p', result_date='20220408')
    # wind
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=solar, wind=3.3, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                        generator_sensitivity=False)
    grid.check_overgeneration(save_str=save_str+'_windUP10p', change_demand=False)
    grid.run_storage_before_capacitydispatch(cap, max_rate, allow_negative=True)
    grid.storage.df.to_csv(save_str+'_windUP10p'+'_storagebeforedf_'+'20220408'+'.csv')
    grid.future.demand['demand'] = np.copy(grid.storage.df.comb_demand_after_storage.values)
    grid.check_overgeneration(save_str=save_str+'_windUP10p', change_demand=True, extra_save_str='_afterstorage')
    grid.future.demand.to_csv(save_str+'_windUP10p'+'_futuredemand_storagebefore_afterstorage_20220408.csv')
    #     grid.check_overgeneration(save_str=save_str+'_windUP10p')
    print(save_str+'_windUP10p')
#     grid.run_dispatch(max_penlevel, save_str+'_windUP10p', result_date='20220408') 
    
    # Decreases
    # gas
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=solar, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                         generator_sensitivity=True, generator_sensitivity_type='drop', fuel_col='is_gas', percent_decrease_of_total_ffcap=0.1)
    grid.check_overgeneration(save_str=save_str+'_gasDOWN10p', change_demand=False)
    grid.run_storage_before_capacitydispatch(cap, max_rate, allow_negative=True)
    grid.storage.df.to_csv(save_str+'_gasDOWN10p'+'_storagebeforedf_'+'20220408'+'.csv')
    grid.future.demand['demand'] = np.copy(grid.storage.df.comb_demand_after_storage.values)
    grid.check_overgeneration(save_str=save_str+'_gasDOWN10p', change_demand=True, extra_save_str='_afterstorage')
    grid.future.demand.to_csv(save_str+'_gasDOWN10p'+'_futuredemand_storagebefore_afterstorage_20220408.csv')
    #     grid.check_overgeneration(save_str=save_str+'_gasDOWN10p')
    print(save_str+'_gasDOWN10p')
#     grid.run_dispatch(max_penlevel, save_str+'_gasDOWN10p', result_date='20220408') 
    # coal
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=solar, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                        generator_sensitivity=True, generator_sensitivity_type='drop', fuel_col='is_coal', percent_decrease_of_total_ffcap=0.1)
    grid.check_overgeneration(save_str=save_str+'_coalDOWN10p', change_demand=False)
    grid.run_storage_before_capacitydispatch(cap, max_rate, allow_negative=True)
    grid.storage.df.to_csv(save_str+'_coalDOWN10p'+'_storagebeforedf_'+'20220408'+'.csv')
    grid.future.demand['demand'] = np.copy(grid.storage.df.comb_demand_after_storage.values)
    grid.check_overgeneration(save_str=save_str+'_coalDOWN10p', change_demand=True, extra_save_str='_afterstorage')
    grid.future.demand.to_csv(save_str+'_coalDOWN10p'+'_futuredemand_storagebefore_afterstorage_20220408.csv')

    #     grid.check_overgeneration(save_str=save_str+'_coalDOWN10p')
    print(save_str+'_coalDOWN10p')
#     grid.run_dispatch(max_penlevel, save_str+'_coalDOWN10p', result_date='20220408') 
    # solar
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=3.15, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                        generator_sensitivity=False)
    grid.check_overgeneration(save_str=save_str+'_solarDOWN10p', change_demand=False)
    grid.run_storage_before_capacitydispatch(cap, max_rate, allow_negative=True)
    grid.storage.df.to_csv(save_str+'_solarDOWN10p'+'_storagebeforedf_'+'20220408'+'.csv')
    grid.future.demand['demand'] = np.copy(grid.storage.df.comb_demand_after_storage.values)
    grid.check_overgeneration(save_str=save_str+'_solarDOWN10p', change_demand=True, extra_save_str='_afterstorage')
    grid.future.demand.to_csv(save_str+'_solarDOWN10p'+'_futuredemand_storagebefore_afterstorage_20220408.csv')
#     grid.check_overgeneration(save_str=save_str+'_solarDOWN10p')
    print(save_str+'_solarDOWN10p')
#     grid.run_dispatch(max_penlevel, save_str+'_solarDOWN10p', result_date='20220408')
    # wind
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=solar, wind=2.7, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                        generator_sensitivity=False)
    grid.check_overgeneration(save_str=save_str+'_windDOWN10p', change_demand=False)
    grid.run_storage_before_capacitydispatch(cap, max_rate, allow_negative=True)
    grid.storage.df.to_csv(save_str+'_windDOWN10p'+'_storagebeforedf_'+'20220408'+'.csv')
    grid.future.demand['demand'] = np.copy(grid.storage.df.comb_demand_after_storage.values)
    grid.check_overgeneration(save_str=save_str+'_windDOWN10p', change_demand=True, extra_save_str='_afterstorage')
    grid.future.demand.to_csv(save_str+'_windDOWN10p'+'_futuredemand_storagebefore_afterstorage_20220408.csv')

    #     grid.check_overgeneration(save_str=save_str+'_windDOWN10p')
    print(save_str+'_windDOWN10p')
#     grid.run_dispatch(max_penlevel, save_str+'_windDOWN10p', result_date='20220408')<jupyter_output>Solving optimization.
Results/GridExpansionSensitivity/fuel1_solar3.5_wind3_UniversalHome_TimersNone_noWPcontrol_penlevel0.5_gasUP10p
Solving optimization.
Results/GridExpansionSensitivity/fuel1_solar3.5_wind3_UniversalHome_TimersNone_noWPcontrol_penlevel0.5_coalUP10p
Solving optimization.
Results/GridExpansionSensitivity/fuel1_solar3.5_wind3_UniversalHome_TimersNone_noWPcontrol_penlevel0.5_solarUP10p
Solving optimization.
Results/GridExpansionSensitivity/fuel1_solar3.5_wind3_UniversalHome_TimersNone_noWPcontrol_penlevel0.5_windUP10p
Solving optimization.
Results/GridExpansionSensitivity/fuel1_solar3.5_wind3_UniversalHome_TimersNone_noWPcontrol_penlevel0.5_gasDOWN10p
Solving optimization.
Results/GridExpansionSensitivity/fuel1_solar3.5_wind3_UniversalHome_TimersNone_noWPcontrol_penlevel0.5_coalDOWN10p
Solving optimization.
Results/GridExpansionSensitivity/fuel1_solar3.5_wind3_UniversalHome_TimersNone_noWPcontrol_penlevel0.5_solarDOWN10p
Solving optimization.
Results/GridExpansionSensit[...]<jupyter_text>100% EVs<jupyter_code>penlevel = 1.0
fuel = 1
solar = 3.5
wind = 3
ev_workplace_bool=False
ev_timers = '_NoTimers'
ev_scenario_date = '20220313'
timer_names = {'':'Timers9pm', '_midnighttimer':'Timers12am', '_NoTimers':'TimersNone', '_RandomTimers':'TimersRandom'}


max_penlevel = 0

for ev_scenario in ['UniversalHome', 'HighHome', 'LowHome_HighWork', 'LowHome_LowWork']:
    save_str = 'Results/GridExpansionSensitivity/fuel'+str(fuel)+'_solar'+str(solar)+'_wind'+str(wind)+'_'+ev_scenario+'_'+timer_names[ev_timers]+'_noWPcontrol'+'_penlevel'+str(penlevel)
    # Increases
    # gas
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=solar, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                         generator_sensitivity=True, fuel_col='is_gas', percent_increase_of_total_ffcap=0.1)
    grid.check_overgeneration(save_str=save_str+'_gasUP10p')
    print(save_str+'_gasUP10p')
    grid.run_dispatch(max_penlevel, save_str+'_gasUP10p', result_date='20220408') 
    # coal
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=solar, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                        generator_sensitivity=True, fuel_col='is_coal', percent_increase_of_total_ffcap=0.1)
    grid.check_overgeneration(save_str=save_str+'_coalUP10p')
    print(save_str+'_coalUP10p')
    grid.run_dispatch(max_penlevel, save_str+'_coalUP10p', result_date='20220408') 
    # solar
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=3.85, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                        generator_sensitivity=False)
    grid.check_overgeneration(save_str=save_str+'_solarUP10p')
    print(save_str+'_solarUP10p')
    grid.run_dispatch(max_penlevel, save_str+'_solarUP10p', result_date='20220408')
    # wind
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=solar, wind=3.3, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                        generator_sensitivity=False)
    grid.check_overgeneration(save_str=save_str+'_windUP10p')
    print(save_str+'_windUP10p')
    grid.run_dispatch(max_penlevel, save_str+'_windUP10p', result_date='20220408') 
    
    # Decreases
    # gas
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=solar, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                         generator_sensitivity=True, generator_sensitivity_type='drop', fuel_col='is_gas', percent_decrease_of_total_ffcap=0.1)
    grid.check_overgeneration(save_str=save_str+'_gasDOWN10p')
    print(save_str+'_gasDOWN10p')
    grid.run_dispatch(max_penlevel, save_str+'_gasDOWN10p', result_date='20220408') 
    # coal
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=solar, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                        generator_sensitivity=True, generator_sensitivity_type='drop', fuel_col='is_coal', percent_decrease_of_total_ffcap=0.1)
    grid.check_overgeneration(save_str=save_str+'_coalDOWN10p')
    print(save_str+'_coalDOWN10p')
    grid.run_dispatch(max_penlevel, save_str+'_coalDOWN10p', result_date='20220408') 
    # solar
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=3.15, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                        generator_sensitivity=False)
    grid.check_overgeneration(save_str=save_str+'_solarDOWN10p')
    print(save_str+'_solarDOWN10p')
    grid.run_dispatch(max_penlevel, save_str+'_solarDOWN10p', result_date='20220408')
    # wind
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=solar, wind=2.7, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                        generator_sensitivity=False)
    grid.check_overgeneration(save_str=save_str+'_windDOWN10p')
    print(save_str+'_windDOWN10p')
    grid.run_dispatch(max_penlevel, save_str+'_windDOWN10p', result_date='20220408')<jupyter_output>Results/GridExpansionSensitivity/fuel1_solar3.5_wind3_UniversalHome_TimersNone_noWPcontrol_penlevel1.0_gasUP10p
----Capacity too low----
Try with storage:
1.9% Complete
3.8% Complete
5.8% Complete
7.7% Complete
9.6% Complete
11.5% Complete
13.5% Complete
15.4% Complete
17.3% Complete
19.2% Complete
21.2% Complete
23.1% Complete
25.0% Complete
26.9% Complete
28.8% Complete
30.8% Complete
32.7% Complete
34.6% Complete
36.5% Complete
38.5% Complete
40.4% Complete
42.3% Complete
44.2% Complete
46.2% Complete
48.1% Complete
50.0% Complete
51.9% Complete
53.8% Complete
55.8% Complete
57.7% Complete
59.6% Complete
61.5% Complete
63.5% Complete
65.4% Complete
67.3% Complete
69.2% Complete
71.2% Complete
73.1% Complete
75.0% Complete
76.9% Complete
78.8% Complete
80.8% Complete
82.7% Complete
84.6% Complete
86.5% Complete
88.5% Complete
90.4% Complete
92.3% Complete
94.2% Complete
96.2% Complete
98.1% Complete
100.0% Complete
Solving optimization.
Storage Rate Result: 7046
Storage Capacity:  28[...]<jupyter_text>calculate the storage result:<jupyter_code>penlevel = 1.0
fuel = 1
solar = 3.5
wind = 3
ev_workplace_bool=False
ev_timers = '_NoTimers'
ev_scenario_date = '20220313'

max_rate = 10000 # assumes average 4 hour storage 
cap = 40000



max_penlevel = 0

for ev_scenario in ['UniversalHome', 'HighHome', 'LowHome_HighWork', 'LowHome_LowWork']:
    save_str = 'Results/GridExpansionSensitivity/fuel'+str(fuel)+'_solar'+str(solar)+'_wind'+str(wind)+'_'+ev_scenario+'_'+timer_names[ev_timers]+'_noWPcontrol'+'_penlevel'+str(penlevel)
    # Increases
    # gas
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=solar, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                         generator_sensitivity=True, fuel_col='is_gas', percent_increase_of_total_ffcap=0.1)
    grid.check_overgeneration(save_str=save_str+'_gasUP10p', change_demand=False)
    grid.run_storage_before_capacitydispatch(cap, max_rate, allow_negative=True)
    grid.storage.df.to_csv(save_str+'_gasUP10p'+'_storagebeforedf_'+'20220408'+'.csv')
    grid.future.demand['demand'] = np.copy(grid.storage.df.comb_demand_after_storage.values)
    grid.check_overgeneration(save_str=save_str+'_gasUP10p', change_demand=True, extra_save_str='_afterstorage')
    grid.future.demand.to_csv(save_str+'_gasUP10p'+'_futuredemand_storagebefore_afterstorage_20220408.csv')
#     grid.check_overgeneration(save_str=save_str+'_gasUP10p')
    print(save_str+'_gasUP10p')
#     grid.run_dispatch(max_penlevel, save_str+'_gasUP10p', result_date='20220408') 
    # coal
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=solar, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                        generator_sensitivity=True, fuel_col='is_coal', percent_increase_of_total_ffcap=0.1)
    grid.check_overgeneration(save_str=save_str+'_coalUP10p', change_demand=False)
    grid.run_storage_before_capacitydispatch(cap, max_rate, allow_negative=True)
    grid.storage.df.to_csv(save_str+'_coalUP10p'+'_storagebeforedf_'+'20220408'+'.csv')
    grid.future.demand['demand'] = np.copy(grid.storage.df.comb_demand_after_storage.values)
    grid.check_overgeneration(save_str=save_str+'_coalUP10p', change_demand=True, extra_save_str='_afterstorage')
    grid.future.demand.to_csv(save_str+'_coalUP10p'+'_futuredemand_storagebefore_afterstorage_20220408.csv')
    #     grid.check_overgeneration(save_str=save_str+'_coalUP10p')
    print(save_str+'_coalUP10p')
#     grid.run_dispatch(max_penlevel, save_str+'_coalUP10p', result_date='20220408') 
    # solar
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=3.85, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                        generator_sensitivity=False)
    grid.check_overgeneration(save_str=save_str+'_solarUP10p', change_demand=False)
    grid.run_storage_before_capacitydispatch(cap, max_rate, allow_negative=True)
    grid.storage.df.to_csv(save_str+'_solarUP10p'+'_storagebeforedf_'+'20220408'+'.csv')
    grid.future.demand['demand'] = np.copy(grid.storage.df.comb_demand_after_storage.values)
    grid.check_overgeneration(save_str=save_str+'_solarUP10p', change_demand=True, extra_save_str='_afterstorage')
    grid.future.demand.to_csv(save_str+'_solarUP10p'+'_futuredemand_storagebefore_afterstorage_20220408.csv')
    #     grid.check_overgeneration(save_str=save_str+'_solarUP10p')
    print(save_str+'_solarUP10p')
#     grid.run_dispatch(max_penlevel, save_str+'_solarUP10p', result_date='20220408')
    # wind
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=solar, wind=3.3, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                        generator_sensitivity=False)
    grid.check_overgeneration(save_str=save_str+'_windUP10p', change_demand=False)
    grid.run_storage_before_capacitydispatch(cap, max_rate, allow_negative=True)
    grid.storage.df.to_csv(save_str+'_windUP10p'+'_storagebeforedf_'+'20220408'+'.csv')
    grid.future.demand['demand'] = np.copy(grid.storage.df.comb_demand_after_storage.values)
    grid.check_overgeneration(save_str=save_str+'_windUP10p', change_demand=True, extra_save_str='_afterstorage')
    grid.future.demand.to_csv(save_str+'_windUP10p'+'_futuredemand_storagebefore_afterstorage_20220408.csv')
    #     grid.check_overgeneration(save_str=save_str+'_windUP10p')
    print(save_str+'_windUP10p')
#     grid.run_dispatch(max_penlevel, save_str+'_windUP10p', result_date='20220408') 
    
    # Decreases
    # gas
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=solar, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                         generator_sensitivity=True, generator_sensitivity_type='drop', fuel_col='is_gas', percent_decrease_of_total_ffcap=0.1)
    grid.check_overgeneration(save_str=save_str+'_gasDOWN10p', change_demand=False)
    grid.run_storage_before_capacitydispatch(cap, max_rate, allow_negative=True)
    grid.storage.df.to_csv(save_str+'_gasDOWN10p'+'_storagebeforedf_'+'20220408'+'.csv')
    grid.future.demand['demand'] = np.copy(grid.storage.df.comb_demand_after_storage.values)
    grid.check_overgeneration(save_str=save_str+'_gasDOWN10p', change_demand=True, extra_save_str='_afterstorage')
    grid.future.demand.to_csv(save_str+'_gasDOWN10p'+'_futuredemand_storagebefore_afterstorage_20220408.csv')
    #     grid.check_overgeneration(save_str=save_str+'_gasDOWN10p')
    print(save_str+'_gasDOWN10p')
#     grid.run_dispatch(max_penlevel, save_str+'_gasDOWN10p', result_date='20220408') 
    # coal
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=solar, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                        generator_sensitivity=True, generator_sensitivity_type='drop', fuel_col='is_coal', percent_decrease_of_total_ffcap=0.1)
    grid.check_overgeneration(save_str=save_str+'_coalDOWN10p', change_demand=False)
    grid.run_storage_before_capacitydispatch(cap, max_rate, allow_negative=True)
    grid.storage.df.to_csv(save_str+'_coalDOWN10p'+'_storagebeforedf_'+'20220408'+'.csv')
    grid.future.demand['demand'] = np.copy(grid.storage.df.comb_demand_after_storage.values)
    grid.check_overgeneration(save_str=save_str+'_coalDOWN10p', change_demand=True, extra_save_str='_afterstorage')
    grid.future.demand.to_csv(save_str+'_coalDOWN10p'+'_futuredemand_storagebefore_afterstorage_20220408.csv')

    #     grid.check_overgeneration(save_str=save_str+'_coalDOWN10p')
    print(save_str+'_coalDOWN10p')
#     grid.run_dispatch(max_penlevel, save_str+'_coalDOWN10p', result_date='20220408') 
    # solar
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=3.15, wind=wind, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                        generator_sensitivity=False)
    grid.check_overgeneration(save_str=save_str+'_solarDOWN10p', change_demand=False)
    grid.run_storage_before_capacitydispatch(cap, max_rate, allow_negative=True)
    grid.storage.df.to_csv(save_str+'_solarDOWN10p'+'_storagebeforedf_'+'20220408'+'.csv')
    grid.future.demand['demand'] = np.copy(grid.storage.df.comb_demand_after_storage.values)
    grid.check_overgeneration(save_str=save_str+'_solarDOWN10p', change_demand=True, extra_save_str='_afterstorage')
    grid.future.demand.to_csv(save_str+'_solarDOWN10p'+'_futuredemand_storagebefore_afterstorage_20220408.csv')
#     grid.check_overgeneration(save_str=save_str+'_solarDOWN10p')
    print(save_str+'_solarDOWN10p')
#     grid.run_dispatch(max_penlevel, save_str+'_solarDOWN10p', result_date='20220408')
    # wind
    grid = FutureGrid(gd_short)
    grid.set_up_scenario(year=2035, solar=solar, wind=2.7, fuel=fuel, ev_scenario=ev_scenario, ev_timers=ev_timers, ev_pen=penlevel, 
                                             ev_workplace_control='', ev_workplace_bool=False, evs_bool=True, ev_scenario_date=ev_scenario_date, 
                                             weekend_date=ev_scenario_date,  weekend_timers=ev_timers,
                        generator_sensitivity=False)
    grid.check_overgeneration(save_str=save_str+'_windDOWN10p', change_demand=False)
    grid.run_storage_before_capacitydispatch(cap, max_rate, allow_negative=True)
    grid.storage.df.to_csv(save_str+'_windDOWN10p'+'_storagebeforedf_'+'20220408'+'.csv')
    grid.future.demand['demand'] = np.copy(grid.storage.df.comb_demand_after_storage.values)
    grid.check_overgeneration(save_str=save_str+'_windDOWN10p', change_demand=True, extra_save_str='_afterstorage')
    grid.future.demand.to_csv(save_str+'_windDOWN10p'+'_futuredemand_storagebefore_afterstorage_20220408.csv')

    #     grid.check_overgeneration(save_str=save_str+'_windDOWN10p')
    print(save_str+'_windDOWN10p')
#     grid.run_dispatch(max_penlevel, save_str+'_windDOWN10p', result_date='20220408')<jupyter_output>Solving optimization.
Results/GridExpansionSensitivity/fuel1_solar3.5_wind3_UniversalHome_TimersNone_noWPcontrol_penlevel1.0_gasUP10p
Solving optimization.
Results/GridExpansionSensitivity/fuel1_solar3.5_wind3_UniversalHome_TimersNone_noWPcontrol_penlevel1.0_coalUP10p
Solving optimization.
Results/GridExpansionSensitivity/fuel1_solar3.5_wind3_UniversalHome_TimersNone_noWPcontrol_penlevel1.0_solarUP10p
Solving optimization.
Results/GridExpansionSensitivity/fuel1_solar3.5_wind3_UniversalHome_TimersNone_noWPcontrol_penlevel1.0_windUP10p
Solving optimization.
Results/GridExpansionSensitivity/fuel1_solar3.5_wind3_UniversalHome_TimersNone_noWPcontrol_penlevel1.0_gasDOWN10p
Solving optimization.
Results/GridExpansionSensitivity/fuel1_solar3.5_wind3_UniversalHome_TimersNone_noWPcontrol_penlevel1.0_coalDOWN10p
Solving optimization.
Results/GridExpansionSensitivity/fuel1_solar3.5_wind3_UniversalHome_TimersNone_noWPcontrol_penlevel1.0_solarDOWN10p
Solving optimization.
Results/GridExpansionSensit[...]
{'fraction_non_alphanumeric': 0.10293289433782438, 'fraction_numerical': 0.04271541827318806, 'mean_word_length': 4.299850763402595, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 161, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '317306', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 17225, 'n_tokens_neox': 15727, 'n_words': 1809, 'path': 'GridModel_GridImpact/MainAnalysis/results_grid_expansion_sensitivites.ipynb', 'repo_name': 'SiobhanPowell/speech-grid-impact', 'size': '46174'}