NetworkBlockData

class flexops.core.network_block.NetworkBlockData(component)

A network: a composition of plant blocks (module docstring).

Example

>>> import pyomo.environ as pyo
>>> import flexops as fo
>>> from pyomo.environ import units as pyunits
>>> m = pyo.ConcreteModel()
>>> m.time_block = fo.TimeBlock(
...     start_date="2025-01-01", end_date="2025-01-02",
...     time_step=1 * pyunits.hr,
... )
>>> m.campus = fo.NetworkBlock(time_block=m.time_block)
>>> m.campus.north = fo.PlantBlock(time_block=m.time_block)

Constrain two time-indexed quantities across the network to be equal.

The network-level counterpart of a plant’s arcs: it relates quantities (a heat duty against a heating load, one plant’s product against another’s feed) rather than copying stream state, so the two sides may live on different plants and carry different components.

Parameters:
  • name – Local name for the Constraint this builds.

  • source – A time-indexed quantity (source[t]).

  • destination – A time-indexed quantity constrained to equal it.

add_subset_aggregate(plants: list[PlantBlockData], var_name: str, *, name: str | None = None, replace: bool = True) → None

Sum a time-indexed quantity across a chosen subset of this network’s plants.

Unlike the network’s own totals (always every plant, to avoid double-counting), this aggregates whatever plants the caller names — e.g. one building’s power draw within a larger campus. A plant missing var_name is skipped with a logged warning; the aggregate is built from whichever plants have it.

Parameters:
  • plants – The child plants to aggregate over.

  • var_name – Local name of the time-indexed quantity to look up on each plant via find_component.

  • name – Local name for the aggregate on this network. Defaults to f"aggregate_{var_name}".

  • replace – If an aggregate named name already exists, update its defining Constraint in place to the new plants/var_name (never deleting the Var or Constraint). If False, leave the existing aggregate untouched and log a warning instead.

property plants: list[PlantBlockData]

this network’s immediate child plants, in declaration order.

Type:

list