h2integrate.control.control_strategies.storage.optimized_pyomo_controller

Contents

h2integrate.control.control_strategies.storage.optimized_pyomo_controller#

Classes

OptimizedDispatchStorageController(**kwargs)

Operates storage based on optimization to meet the demand profile based on

OptimizedDispatchStorageControllerConfig(...)

Configuration data container for Pyomo-based optimal dispatch.

class h2integrate.control.control_strategies.storage.optimized_pyomo_controller.OptimizedDispatchStorageControllerConfig(max_charge_rate, charge_efficiency=None, discharge_efficiency=None, cost_per_production=None, cost_per_charge=None, cost_per_discharge=None, commodity_met_value=None, time_weighting_factor=0.995, time_duration=1.0, *, max_capacity, max_soc_fraction, min_soc_fraction, init_soc_fraction, n_control_window, commodity, commodity_rate_units, tech_name, system_commodity_interface_limit, round_digits=4)#

Configuration data container for Pyomo-based optimal dispatch.

This class groups the parameters needed by the optimized dispatch controller. Values are typically populated from the technology tech_config.yaml (merged under the “control” section).

Parameters:
  • max_charge_rate (int | float)

  • charge_efficiency (float)

  • discharge_efficiency (float)

  • cost_per_production (float)

  • cost_per_charge (float)

  • cost_per_discharge (float)

  • commodity_met_value (float)

  • time_weighting_factor (float)

  • time_duration (float)

  • max_capacity (float)

  • max_soc_fraction (float)

  • min_soc_fraction (float)

  • init_soc_fraction (float)

  • n_control_window (int)

  • commodity (str)

  • commodity_rate_units (str)

  • tech_name (str)

  • system_commodity_interface_limit (float | int | str | list[float])

  • round_digits (int)

max_charge_rate#

The maximum charge that the storage can accept (in units of the commodity per time step).

Type:

float

charge_efficiency#

The efficiency of charging the storage (between 0 and 1).

Type:

float

discharge_efficiency#

The efficiency of discharging the storage (between 0 and 1).

Type:

float

commodity#

The name of the commodity being stored (e.g., “electricity”, “hydrogen”).

Type:

str

commodity_rate_units#

The rate units of the commodity being stored (e.g., “kW”, “kg/h”).

Type:

str

cost_per_production#

The cost to use the incoming produced commodity (in $/commodity_rate_units).

Type:

float

cost_per_charge#

The cost per unit of charging the storage (in $/commodity_rate_units).

Type:

float

cost_per_discharge#

The cost per unit of discharging the storage (in $/commodity_rate_units).

Type:

float

commodity_met_value#

The penalty for not meeting the desired load demand (in $/commodity_rate_units).

Type:

float

time_weighting_factor#

The weighting factor applied to future time steps in the optimization objective (between 0 and 1).

Type:

float

time_duration#

The duration of each time step in the Pyomo model in hours. The default of this parameter is 1.0 (i.e., 1 hour time steps).

Type:

float

max_charge_rate: int | float#
charge_efficiency: float#
discharge_efficiency: float#
cost_per_production: float#
cost_per_charge: float#
cost_per_discharge: float#
commodity_met_value: float#
time_weighting_factor: float#
time_duration: float#
make_dispatch_inputs()#
class h2integrate.control.control_strategies.storage.optimized_pyomo_controller.OptimizedDispatchStorageController(**kwargs)#
Operates storage based on optimization to meet the demand profile based on

available commodity from generation profiles and demand profile while minimizing costs.

Uses a rolling-window optimization approach with configurable horizon and control windows.

_time_step_bounds = (3600, 3600)#
setup()#

Initialize the optimized dispatch controller.

pyomo_setup(discrete_inputs)#

Create the Pyomo model, extract dispatch technology names, and return dispatch solver.

Returns:

callable

Function(performance_model, performance_model_kwargs, inputs, commodity)

executing rolling-window optimization to determine dispatch and returning: (total_out, storage_out, unmet_demand, unused_commodity, soc)

initialize_parameters(inputs)#

Initialize parameters for optimization model

Parameters:

inputs (dict) –

Dictionary of numpy arrays (length = self.n_timesteps) containing at least:

f”{commodity}_in” : Available generated commodity profile. f”{commodity}_demand” : Demanded commodity output profile.

update_time_series_parameters(commodity_in=None, commodity_demand=None, updated_initial_soc=None)#

Updates the pyomo optimization problem with parameters that change with time

Parameters:
  • commodity_in (list) – List of generated commodity in for this time slice.

  • commodity_demand (list) – The demanded commodity for this time slice.

  • updated_initial_soc (float) – The updated initial state of charge for storage technologies for the current time slice.

solve_dispatch_model(start_time=0, n_days=0)#

Solves the dispatch optimization model and stores problem metrics.

Parameters:
  • start_time (int) – Starting timestep index for the current solve window.

  • n_days (int) – Total number of days in the simulation.

_create_dispatch_optimization_model()#

Creates monolith dispatch model by creating pyomo models for each technology, then aggregating them into hybrid_rule

compute(inputs, outputs, discrete_inputs, discrete_outputs)#

Build Pyomo model blocks and assign the dispatch solver.

static glpk_solve_call(pyomo_model, log_name='', user_solver_options=None)#

This method takes in the dispatch system-level pyomo model that we have built, gives it to the solver, and gives back solver results.

Parameters:
  • pyomo_model (ConcreteModel)

  • log_name (str)

  • user_solver_options (dict | None)

property storage_dispatch_commands: list#

Commanded dispatch including available commodity at current time step that has not been used to charge storage.