Run NYgrid
- nygrid.run_nygrid.get_last_shutdown_hour(results: Dict[str, DataFrame], hour_before_start: Timestamp) ndarray[source]
Get the hour since the last generator shutdown
- Parameters:
results (dict) – Dictionary of results
hour_before_start (pd.Timestamp) – Hour before the start of the simulation
- Returns:
hour_since_last_shutdown – Hour since the last generator shutdown
- Return type:
np.ndarray
- nygrid.run_nygrid.get_last_startup_hour(results: Dict[str, DataFrame], hour_before_start: Timestamp) ndarray[source]
Get the hour since the last generator startup
- Parameters:
results (dict) – Dictionary of results
hour_before_start (pd.Timestamp) – Hour before the start of the simulation
- Returns:
hour_since_last_startup – Hour since the last generator startup
- Return type:
np.ndarray
- nygrid.run_nygrid.read_com_building_elec_data(data_dir: str | PathLike, upgrade_id: int, county_attrs: DataFrame) DataFrame[source]
Commercial building energy changes due to electrification.
- Parameters:
data_dir (str) – Directory of commercial building data
upgrade_id (int) – Commercial building upgrade scenario ID
county_attrs (pd.DataFrame) – County attributes
- Returns:
com_load_change_county – Commercial building load change by county
- Return type:
pd.DataFrame
- nygrid.run_nygrid.read_electrification_data(electrification_dict: Dict[str, Any], county_attrs: DataFrame, county_2_bus: DataFrame) Dict[str, Any][source]
Read electrification data for different sectors (residential building, commercial building, electric vehicle)
- Parameters:
electrification_dict (dict) – Dictionary of electrification data Keys: ‘res_building’, ‘com_building’, ‘electric_vehicle’ In each dictionary, the following keys are required:
data_dir(str),upgrade_id(int)county_attrs (pd.DataFrame) – County attributes
county_2_bus (pd.DataFrame) – County to bus mapping
- Returns:
electrification_dict – Dictionary of electrification data Keys: ‘res_building’, ‘com_building’, ‘electric_vehicle’ In each dictionary, the following keys are required:
data_dir(str),upgrade_id(int),load_change(pd.DataFrame)- Return type:
dict
- nygrid.run_nygrid.read_ev_elec_data(data_dir: str | PathLike, upgrade_id: int, county_attrs: DataFrame) DataFrame[source]
Electric vehicle energy changes due to electrification.
- Parameters:
data_dir (str) – Directory of EV data
upgrade_id (int) – EV upgrade scenario ID
county_attrs (pd.DataFrame) – County attributes
- Returns:
ev_load_change_county – EV load change by county
- Return type:
pd.DataFrame
- nygrid.run_nygrid.read_grid_profile(data_dir: str | PathLike, year: int) Dict[str, DataFrame][source]
Read grid profile data from csv files.
- Parameters:
data_dir (str) – Directory of grid data
year (int) – Year of grid data
- Returns:
grid_data – Dictionary of grid data The following keys are accepted:
load_profile,gen_profile,genmax_profile,genmin_profile,genramp30_profile,gencost0_profile,gencost1_profileThe dictionary values are pandas.DataFrame- Return type:
dict
- nygrid.run_nygrid.read_grid_prop(grid_data_dir: str | PathLike, bus_prop_file: str = 'bus_prop.csv', gen_prop_file: str = 'gen_prop.csv', genfuel_prop_file: str = 'genfuel_prop.csv', gencost_prop_file: str = 'gencost_prop.csv', branch_prop_file: str = 'branch_prop.csv', if_lims_prop_file: str = 'if_lims_prop.csv', if_map_prop_file: str = 'if_map_prop.csv', esr_prop_file: str = 'esr_prop.csv', dcline_prop_file: str = 'dcline_prop.csv') Dict[str, DataFrame][source]
Read grid data from csv files.
- Parameters:
grid_data_dir (str) – Path to the grid data directory.
bus_prop_file (str, optional) – Bus properties file name, by default ‘bus_prop.csv’
gen_prop_file (str, optional) – Generator properties file name, by default ‘gen_prop.csv’
genfuel_prop_file (str, optional) – Generator fuel type file name, by default ‘genfuel_prop.csv’
gencost_prop_file (str, optional) – Generator cost properties file name, by default ‘gencost_prop.csv’
branch_prop_file (str, optional) – AC line properties file name, by default ‘branch_prop.csv’
if_lims_prop_file (str, optional) – Interface limit properties file name, by default ‘if_lims_prop.csv’
if_map_prop_file (str, optional) – Interface mapping file name, by default ‘if_map_prop.csv’
esr_prop_file (str, optional) – Energy storage properties file name, by default ‘esr_prop.csv’
dcline_prop_file (str, optional) – DC line properties file name, by default ‘dcline_prop.csv’
- Returns:
grid_data – Dictionary of grid data.
Keys:
bus_prop,gen_prop,gen_fuel,gencost_prop,branch_prop,if_lim_prop,if_map_prop,esr_prop,dcline_propValues: pandas.DataFrame
- Return type:
dict
- nygrid.run_nygrid.read_res_building_elec_data(data_dir: str | PathLike, upgrade_id: int, county_attrs: DataFrame) DataFrame[source]
Residential building energy changes due to electrification.
- Parameters:
data_dir (str) – Directory of residential building data
upgrade_id (int) – Residential building upgrade scenario ID
county_attrs (pd.DataFrame) – County attributes
- Returns:
res_load_change_county – Residential building load change by county
- Return type:
pd.DataFrame
- nygrid.run_nygrid.read_vre_data(solar_data_dir: str | PathLike, onshore_wind_data_dir: str | PathLike, offshore_wind_data_dir: str | PathLike) Tuple[DataFrame, DataFrame][source]
- Parameters:
solar_data_dir (str) – Directory of solar data
onshore_wind_data_dir (str) – Directory of onshore wind data
offshore_wind_data_dir (str) – Directory of offshore wind data
- Returns:
vre_prop (pandas.DataFrame) – VRE properties
genmax_profile_vre (pandas.DataFrame) – VRE generation profiles
- nygrid.run_nygrid.run_nygrid_sim(grid_prop: Dict[str, DataFrame], grid_profile: Dict[str, DataFrame], start_datetime: Timestamp, end_datetime: Timestamp, options: Dict[str, Any], solver_options: Dict[str, Any] | None, gen_init: ndarray | None, gen_init_cmt: ndarray | None, soc_init: ndarray | None, gen_last_startup_hour: ndarray | None = None, gen_last_shutdown_hour: ndarray | None = None, verbose: bool = False) Dict[str, DataFrame][source]
Run NYGrid simulation for one day
- Parameters:
grid_prop (dict) –
Dictionary of grid properties
Keys:
bus_prop,gen_prop,gen_fuel,gencost_prop,branch_prop,if_lim_prop,if_map_propValues: pandas.DataFrame
grid_profile (dict) –
Dictionary of grid profiles
Keys:
load_profile,gen_profile,genmax_profile,genmin_profile,genramp30_profile,gencost0_profile,gencost1_profileValues: pandas.DataFrame
start_datetime (pd.Timestamp) – Start datetime of simulation
end_datetime (pd.Timestamp) – End datetime of simulation
options (dict) – Dictionary of options
init_gen (np.ndarray) – Initial generator status
init_soc (np.ndarray) – Initial ESR SOC
gen_last_startup_hour (np.ndarray, optional) – Hour since the last generator startup
gen_last_shutdown_hour (np.ndarray, optional) – Hour since the last generator shutdown
verbose (bool, optional) – Print verbose output, by default
- Returns:
results – Dictionary of results
- Return type:
dict