h2integrate.storage.test.test_storage_performance_model#

Functions

plant_config_non_hourly(n_timesteps)

test_generic_storage_charge_more_than_available(...)

test_generic_storage_with_simple_control_charge_rate_lessthan_demand(...)

test_generic_storage_with_simple_control_dmd_lessthan_charge_rate(...)

test_generic_storage_with_simple_control_with_losses(...)

test_generic_storage_with_simple_control_with_losses_round_trip(...)

test_generic_storage_with_simple_control_zero_size(...)

test_round_trip_efficiency_preserved_in_config(...)

Test that round_trip_efficiency is preserved in the config's as_dict() output.

test_storage_half_hourly_known_outputs(...)

Verify SOC, charge/discharge profiles, and scalar outputs against calculated values for a simple scenario at dt=1800s (30-min dt).

test_storage_half_hourly_known_outputs_kg_s(...)

Verify SOC, charge/discharge profiles against hand-calculated values when commodity_rate_units='kg/s' and dt=1800s.

test_storage_half_hourly_kw_kwh_2hr(subtests)

h2integrate.storage.test.test_storage_performance_model.test_generic_storage_with_simple_control_dmd_lessthan_charge_rate(plant_config, subtests)#
h2integrate.storage.test.test_storage_performance_model.test_generic_storage_with_simple_control_charge_rate_lessthan_demand(plant_config, subtests)#
h2integrate.storage.test.test_storage_performance_model.test_generic_storage_with_simple_control_zero_size(plant_config, subtests)#
h2integrate.storage.test.test_storage_performance_model.test_generic_storage_with_simple_control_with_losses(plant_config, subtests)#
h2integrate.storage.test.test_storage_performance_model.test_generic_storage_with_simple_control_with_losses_round_trip(plant_config, subtests)#
h2integrate.storage.test.test_storage_performance_model.test_generic_storage_charge_more_than_available(plant_config, subtests)#
h2integrate.storage.test.test_storage_performance_model.test_round_trip_efficiency_preserved_in_config(subtests)#

Test that round_trip_efficiency is preserved in the config's as_dict() output.

This is a regression test for a bug where round_trip_efficiency was set to None after computing charge/discharge efficiencies in __attrs_post_init__. This caused check_inputs() to raise an AttributeError because round_trip_efficiency appeared in the user input but was missing from the config's as_dict() output.

h2integrate.storage.test.test_storage_performance_model.plant_config_non_hourly(n_timesteps)#
h2integrate.storage.test.test_storage_performance_model.test_storage_half_hourly_known_outputs(subtests, plant_config_non_hourly)#

Verify SOC, charge/discharge profiles, and scalar outputs against calculated values for a simple scenario at dt=1800s (30-min dt).

Scenario (4 timesteps * 30 min = 2 hours total):

t0, t1: charge at 10 kg/h - stores 5 kg each step
t2, t3: discharge at 10 kg/h -- removes 5 kg each step

With capacity=40 kg, init_soc=0.1, eff=1.0, min_soc=0.1, max_soc=1.0:

SOC[0] = 0.1 + 5/40 = 0.225
SOC[1] = 0.225 + 5/40 = 0.35
SOC[2] = 0.35  - 5/40 = 0.225
SOC[3] = 0.225 - 5/40 = 0.1
total_hydrogen_produced = (-10 - 10 + 10 + 10) * 0.5 hr = 0 kg
standard_capacity_factor = (10+10)*0.5 / (10 * 4 * 0.5) = 10/20 = 0.5 -> 50 %
h2integrate.storage.test.test_storage_performance_model.test_storage_half_hourly_known_outputs_kg_s(subtests, plant_config_non_hourly)#

Verify SOC, charge/discharge profiles against hand-calculated values when commodity_rate_units='kg/s' and dt=1800s.

This test verifies that dt_amount is correctly computed via OpenMDAO that SOC increments are correct for a non-hourly rate unit.

Scenario

capacity=3600 kg, charge_rate=1 kg/s, init_soc=0.1, min/max_soc=0.1/1.0, eff=1.0 commodity_in = [1, 1, 0, 0] kg/s set_point = [-1, -1, 1, 1] kg/s (negative=charge, positive=discharge)

With 1800s (0.5 hr) timesteps, the expected SOC profile is:

SOC[0] = 0.1 + (1 kg/s * 1800s) / 3600 kg = 0.1 + 0.5 = 0.6 -> 60% SOC[1] = 0.6 + (1 kg/s * 1800s) / 3600 kg = 0.6 + 0 = 1.0 -> 100% SOC[2] = 1.0 - (1 kg/s * 1800s) / 3600 kg = 1.0 - 0.5 = 0.5 -> 50% SOC[3] = 0.5 - (1 kg/s * 1800s) / 3600 kg = 0.5 - 0.5 = 0.1 -> 10%

total_produced = (-1-0.8+1+0.8)*1800 = 0 kg standard_capacity_factor = (1+0.8)*1800 / (1*4*1800) = 3240/7200 = 45%

h2integrate.storage.test.test_storage_performance_model.test_storage_half_hourly_kw_kwh_2hr(subtests)#