def parameterSweep(sweep_inputs, index): # Record time to solve t0 = time.time() # create and run model data = pd.read_csv('model_inputs.csv') model_inputs = ocaes.get_default_inputs(storage_type=sweep_inputs.loc[index, 'storage_type']) if sweep_inputs.loc[index, 'storage_type'] == 'wind_only': model_inputs['X_well'] = 0.0 model_inputs['X_cmp'] = 0.0 model_inputs['X_exp'] = 0.0 else: model_inputs['X_well'] = sweep_inputs.loc[index, 'capacity'] model_inputs['X_cmp'] = sweep_inputs.loc[index, 'capacity'] model_inputs['X_exp'] = sweep_inputs.loc[index, 'capacity'] if sweep_inputs.loc[index, 'storage_type'] == 'OCAES-10': model_inputs['pwr2energy'] = 10 if sweep_inputs.loc[index, 'storage_type'] == 'OCAES-24': model_inputs['pwr2energy'] = 24 model = ocaes(data, model_inputs) df, s = model.get_full_results() s['revenue'], s['LCOE'], s['COVE'], s['emissions_avoided'] = model.post_process(s) # Display Elapsed Time t1 = time.time() print("Time Elapsed: " + str(round(t1 - t0, 2)) + " s") # Combine inputs and results into output and then return return pd.concat([sweep_inputs.loc[index, :], s], axis=0)
def parameterSweep(sweep_inputs, index): # Record time to solve t0 = time.time() # create and run model data = pd.read_csv('data_manual.csv') model_inputs = ocaes.get_default_inputs() model_inputs['eta_storage'] = sweep_inputs.loc[index, 'efficiency'] model_inputs['X_well'] = sweep_inputs.loc[index, 'capacity'] model_inputs['X_cmp'] = sweep_inputs.loc[index, 'capacity'] model_inputs['X_exp'] = sweep_inputs.loc[index, 'capacity'] model = ocaes(data, model_inputs) df, s = model.get_full_results() s = model.calculate_LCOE(s) # Display Elapsed Time t1 = time.time() print("Time Elapsed: " + str(round(t1 - t0, 2)) + " s") # Combine inputs and results into output and then return return pd.concat([sweep_inputs.loc[index,:]], axis=0), s
import pandas as pd from OCAES import ocaes # ---------------------- # wind only # ---------------------- data = pd.read_csv('data_manual.csv') inputs = ocaes.get_default_inputs() inputs['X_well'] = 0 inputs['X_cmp'] = 0 inputs['X_exp'] = 0 model = ocaes(data, inputs) df, s_wind = model.get_full_results() s_wind = model.calculate_LCOE(s_wind) # ---------------------- # OCAES # ---------------------- data = pd.read_csv('data_manual.csv') inputs = ocaes.get_default_inputs() inputs['X_cmp'] = 500 inputs['X_exp'] = 500 model = ocaes(data, inputs) df, s_ocaes = model.get_full_results() s_ocaes = model.calculate_LCOE(s_ocaes) # ---------------------- # battery # ---------------------- data = pd.read_csv('data_manual.csv') inputs = ocaes.get_default_inputs()
def parameter_sweep(sweep_input): # Record time to solve t0 = time.time() # create model data = pd.read_csv(sweep_input['timeseries_filename']) model_inputs = ocaes.get_default_inputs() model_inputs['objective'] = sweep_input['objective'] # scenario specific inputs model_inputs['pwr2energy'] = sweep_input['pwr2energy'] model_inputs['eta_storage'] = sweep_input['eta_storage'] model_inputs['CC_exp'] = sweep_input['CC_exp'] model_inputs['C_well'] = 0.0 model_inputs['C_cmp'] = 0.0 model_inputs['C_exp'] = sweep_input['C_exp'] model_inputs['V_cmp'] = 0.0 model_inputs['V_exp'] = sweep_input['V_exp'] model_inputs['F_well'] = 0.0 model_inputs['F_cmp'] = 0.0 model_inputs['F_exp'] = sweep_input['F_exp'] model_inputs['L_well'] = sweep_input['L_well'] model_inputs['L_cmp'] = sweep_input['L_cmp'] model_inputs['L_exp'] = sweep_input['L_exp'] # capacity inputs if sweep_input['scenario'] == 'wind_only': model_inputs['X_well'] = 0.0 model_inputs['X_cmp'] = 0.0 model_inputs['X_exp'] = 0.0 model_inputs['eta_storage'] = 1.0 else: model_inputs['X_well'] = sweep_input['capacity'] model_inputs['X_cmp'] = sweep_input['capacity'] model_inputs['X_exp'] = sweep_input['capacity'] if model_inputs['objective'] == 'CONST_DISPATCH_OPT': model_inputs['X_dispatch'] = sweep_input['capacity'] print('Scenario: ' + str(sweep_input['scenario'])) print('X_wind: ' + str(model_inputs['X_wind'])) print('Capacity: ' + str(sweep_input['capacity'])) print('Objective: ' + str(sweep_input['objective'])) # run model model = ocaes(data, model_inputs) df, s = model.get_full_results() revenue, LCOE, COVE, avoided_emissions, ROI = model.post_process(s) # save results results = pd.Series(index=('revenue', 'LCOE', 'COVE', 'avoided_emissions', 'solve_time'), dtype='float64') results['revenue'] = revenue results['LCOE'] = LCOE results['COVE'] = COVE results['avoided_emissions'] = avoided_emissions results['ROI'] = ROI results['solve_time'] = time.time() - t0 # additional outputs results['avoided_emissions_tonnes'] = s['avoided_emissions'] results['yearly_electricity_MWh'] = s['yearly_electricity'] results['yearly_electricity_generated_MWh'] = s[ 'yearly_electricity_generated'] results['yearly_electricity_purchased_MWh'] = s[ 'yearly_electricity_purchased'] results['yearly_exp_usage_MWh'] = s['yearly_exp_usage'] results['yearly_cmp_usage_MWh'] = s['yearly_cmp_usage'] results['yearly_curtailment_MWh'] = s['yearly_curtailment'] results['yearly_curtailment_fr'] = s['yearly_curtailment'] / s[ 'yearly_electricity_generated'] results['yearly_electricity_revenue_dollars'] = s[ 'yearly_electricity_revenue'] results['yearly_capacity_credit_dollars'] = s['yearly_capacity_credit'] results['yearly_total_revenue_dollars'] = s['yearly_total_revenue'] results['yearly_costs_dollars'] = s['yearly_costs'] results['yearly_profit_dollars'] = s['yearly_profit'] results['yearly_electricity_value_dollars'] = s['yearly_electricity_value'] results['price_grid_average_dollarsPerMWh'] = s['price_grid_average'] results['X_wind'] = s['X_wind'] results['X_well'] = s['X_well'] results['X_exp'] = s['X_exp'] results['X_cmp'] = s['X_cmp'] results['X_dispatch'] = s['X_dispatch'] results['storage_duration_hrs'] = s['E_well_duration'] results['E_well_init_fr'] = s['E_well_init_fr'] results['E_well_init'] = s['E_well_init'] # combine inputs and results to return in single series single_output = pd.concat([sweep_input, results]) return single_output