h2integrate.demand.demand_base#

Classes

DemandComponentBase(**kwargs)

Base OpenMDAO component for open-loop demand tracking.

DemandComponentBaseConfig(*, commodity, ...)

Configuration for defining a demand profile.

class h2integrate.demand.demand_base.DemandComponentBaseConfig(*, commodity, commodity_rate_units, demand_profile, commodity_amount_units=None)#

Configuration for defining a demand profile.

This configuration object specifies the commodity being demanded and the demand profile that should be met by downstream components.

Parameters:
  • commodity (str)

  • commodity_rate_units (str)

  • demand_profile (int | float | list)

  • commodity_amount_units (str)

commodity#

Name of the commodity being demanded (e.g., “hydrogen”). Converted to lowercase and stripped of whitespace.

Type:

str

commodity_rate_units#

Units of the commodity (e.g., “kg/h”).

Type:

str

demand_profile#

Demand values for each timestep, in the same units as commodity_rate_units. May be a scalar for constant demand or a list/array for time-varying demand.

Type:

int | float | list

commodity_amount_units#

Units of the commodity as an amount (i.e., kW*h or kg). If not provided, defaults to commodity_rate_units*h.

Type:

str | None, optional

commodity: str#
commodity_rate_units: str#
demand_profile: int | float | list#
commodity_amount_units: str#
class h2integrate.demand.demand_base.DemandComponentBase(**kwargs)#

Base OpenMDAO component for open-loop demand tracking.

This component defines the interfaces required for demand components, including inputs for demand, supplied commodity, and outputs tracking unmet demand, unused production, and total unmet demand. Subclasses must implement the compute() method to define the demand component behavior.

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

Define inputs and outputs for demand component.

Creates time-series inputs and outputs for commodity demand, supply, unmet demand, unused commodity, and total unmet demand. Shapes and units are determined by the plant configuration and load component configuration.

Raises:

KeyError – If required configuration keys are missing from plant_config or tech_config.

compute()#

This method must be implemented by subclasses to define the demand component.

Raises:

NotImplementedError – Always, unless implemented in a subclass.

calculate_outputs(commodity_in, commodity_demand, outputs)#

Compute unmet demand, unused commodity, and converter output.

This method compares the demand profile to the supplied commodity for each timestep and assigns unmet demand, curtailed production, and actual delivered output.

Parameters:
  • commodity_in (np.array) – supplied commodity profile

  • commodity_demand (np.array) – entire commodity demand profile

  • outputs (dict-like) –

    Mapping of output variable names where results will be written, including:

    • unmet_{commodity}_demand_out: Unmet demand.

    • unused_{commodity}_out: Curtailed production.

    • {commodity}_out: Actual output delivered.

Notes

All variables operate on a per-timestep basis and typically have array shape (n_timesteps,).