h2integrate.tools.h2integrate_sim_file_utils#

Functions

load_dill_pickle(filepath)

Load a dill pickle file from the given filepath.

load_physics_h2integrate_setup(config)

Loads the physics setup for the H2Integrate simulation from previously saved pickle files.

load_physics_h2integrate_simulation(config)

Load physics simulation results for a H2Integrate simulation.

save_iron_ore_results(config, ...)

Save iron ore results to a pickle file.

save_iron_results(config, iron_performance, ...)

Saves the iron results to a pickle file.

save_physics_results_h2integrate_setup(...)

Save physics results for H2Integrate setup.

save_physics_results_h2integrate_simulation(...)

Save the physics results of the H2Integrate simulation to a pickle file.

save_pickle_data(output_data_dict, config, ...)

Save data to pickle files in specified directories.

save_pickle_data_iron_out(output_data_dict, ...)

Save data to pickle files in specified directories.

h2integrate.tools.h2integrate_sim_file_utils.load_dill_pickle(filepath)#

Load a dill pickle file from the given filepath.

Parameters:

filepath (str or Path) -- The path to the dill pickle file.

Returns:

Any -- The data loaded from the dill pickle file.

h2integrate.tools.h2integrate_sim_file_utils.save_pickle_data(output_data_dict, config, pkl_fn)#

Save data to pickle files in specified directories.

Parameters:
  • output_data_dict (dict) -- Dictionary where keys are output names and values are the data to be pickled.

  • config (object) -- Configuration object that contains the attribute run_full_simulation_fn which specifies the base directory for saving files.

  • pkl_fn (str) -- Filename for the pickle file.

h2integrate.tools.h2integrate_sim_file_utils.save_pickle_data_iron_out(output_data_dict, config, pkl_fn)#

Save data to pickle files in specified directories.

Parameters:
  • output_data_dict (dict) -- Dictionary where keys are output names and values are the data to be pickled.

  • config (object) -- Configuration object that contains the attribute iron_out_fn which specifies the base directory for saving files.

  • pkl_fn (str) -- Filename for the pickle file.

h2integrate.tools.h2integrate_sim_file_utils.save_physics_results_h2integrate_setup(config, wind_cost_results)#

Save physics results for H2Integrate setup. This function saves the physics results and configuration data needed for future runs in a pickle file. The filename is generated based on the latitude, longitude, and year from the configuration.

Parameters:
  • config (object) -- Configuration object containing simulation settings.

  • wind_cost_results (object) -- Results of the wind cost calculations.

Returns:

None

h2integrate.tools.h2integrate_sim_file_utils.load_physics_h2integrate_setup(config)#

Loads the physics setup for the H2Integrate simulation from previously saved pickle files.

Parameters:

config --

A configuration object that contains the simulation settings, including: - hopp_config: A dictionary with site data, including latitude ('lat'),

longitude ('lon'), and year ('year').

  • run_full_simulation_fn: A string representing the path to the directory where

    simulation results are stored.

Returns:

tuple --

A tuple containing:
  • config: The loaded configuration object from the pickle file.

  • wind_cost_results: The loaded wind cost results from the pickle file.

h2integrate.tools.h2integrate_sim_file_utils.save_physics_results_h2integrate_simulation(config, lcoh, lcoe, electrolyzer_physics_results, wind_annual_energy_kwh, solar_pv_annual_energy_kwh, energy_shortfall_hopp)#

Save the physics results of the H2Integrate simulation to a pickle file.

Parameters:
  • config (dict) -- Configuration dictionary containing simulation settings.

  • lcoh (float) -- Levelized cost of hydrogen.

  • lcoe (float) -- Levelized cost of energy.

  • electrolyzer_physics_results (dict) -- Results from the electrolyzer physics simulation.

  • wind_annual_energy_kwh (float) -- Annual wind energy production in kWh.

  • solar_pv_annual_energy_kwh (float) -- Annual solar PV energy production in kWh.

  • energy_shortfall_hopp (float) -- Energy shortfall from the HOPP simulation.

Returns:

None

h2integrate.tools.h2integrate_sim_file_utils.load_physics_h2integrate_simulation(config)#

Load physics simulation results for a H2Integrate simulation. This function reads in outputs from previously-saved .pkl files based on the configuration provided. It loads various simulation results including LCOH, LCOE, electrolyzer physics results, wind annual energy, and solar PV annual energy. :param config: Configuration object containing simulation parameters and file paths. :type config: object

Returns:

tuple --

A tuple containing the following elements:
  • lcoh (object): Loaded LCOH data.

  • lcoe (object): Loaded LCOE data.

  • electrolyzer_physics_results (object): Loaded electrolyzer physics results.

  • wind_annual_energy_kwh (object): Loaded wind annual energy in kWh.

  • solar_pv_annual_energy_kwh (object): Loaded solar PV annual energy in kWh.

h2integrate.tools.h2integrate_sim_file_utils.save_iron_ore_results(config, iron_ore_config, iron_ore_performance, iron_ore_costs, iron_ore_finance)#

Save iron ore results to a pickle file. This function saves the performance, costs, and finance data of iron ore to a pickle file based on the configuration provided. The output file is named using the latitude, longitude, and year from the configuration.

Parameters:
  • config (object) -- Configuration object containing the output directory and site data.

  • iron_ore_config (dict) -- Configuration dictionary specific to iron ore.

  • iron_ore_performance (object) -- Object containing iron ore performance data.

  • iron_ore_costs (object) -- Object containing iron ore costs data.

  • iron_ore_finance (object) -- Object containing iron ore finance data.

Raises:

ValueError -- If the output directory is not set in the configuration.

h2integrate.tools.h2integrate_sim_file_utils.save_iron_results(config, iron_performance, iron_costs, iron_finance, iron_CI=None)#

Saves the iron results to a pickle file.

Parameters:
  • config (object) -- Configuration object containing the output directory and site data.

  • iron_performance (any) -- Performance data of the iron.

  • iron_costs (any) -- Cost data of the iron.

  • iron_finance (any) -- Financial data of the iron.

  • iron_CI (any, optional) -- Confidence interval data of the iron. Defaults to None.

Raises:

ValueError -- If the output file name in the configuration is not set.