bloc.boulder_plugins.hmb_pane#

Bloc GUI plugin: an HMB output pane — the heat and material balance.

Adds a selection-independent results tab carrying the Calculation Note’s PER-NODE DATA block: one column per node — every reactor, reservoir and stream-point diamond in the solved network — and one row per variable, the first two columns naming the property and its unit. Read a column for one node’s full state; read a row to follow one property across the process.

The rows are not defined here. Both the data and its layout come from the reporting layer that already owns them:

  • bloc.reporting.excel_detail.PER_NODE_TABLE_SPEC — the sections and their rows (overall / gas / solids properties, gas-phase mole and mass fractions, total mass fractions), with each row’s declared unit and precision.

  • bloc.reporting.orchestrator._extract_node_data() — the per-node records, straight off the solved network: mass flow from the flow devices, gas/solid split at the mechanism’s own solid-carbon threshold, transport properties (rebuilt through the declared mechanism when a reservoir’s phase has no transport model), heat capacity, HHV.

So the pane cannot drift from the Calculation Note: adding a row there adds it here, and a number shown in the GUI is the number the note will export.

With a live network the records are built from it directly. A run restored from cache has no live network, so the pane reads the per-node records the solve already wrote to the store (the calc-note bundle) — no re-solve, and the numbers are the ones the note exported. A cell reads - where the run does not support that property (no transport data for a node, a flow no device reported).

Attributes#

Classes#

HMBPanePlugin

Heat and material balance: nodes as columns, properties as rows.

Functions#

build_table(node_names, node_data[, spec])

Build the pane's table content from per-node records.

cached_bundle_path(config)

Locate the cached calc-note bundle for the run the GUI is showing.

cached_node_data(config)

Return (node_names, node_data) from the cached bundle, or None.

Module Contents#

bloc.boulder_plugins.hmb_pane.logger#
bloc.boulder_plugins.hmb_pane.OutputPaneContext = None#
bloc.boulder_plugins.hmb_pane.MISSING = '-'#
bloc.boulder_plugins.hmb_pane.build_table(node_names, node_data, spec=None)#

Build the pane’s table content from per-node records.

Sections, rows, units and precision all come from spec, which defaults to the Calculation Note’s PER_NODE_TABLE_SPEC. Each section is introduced by a label row so the GUI table reads like the note’s block.

Separate from the plugin class so it can be tested without Boulder’s output-pane machinery or a live network.

bloc.boulder_plugins.hmb_pane.cached_bundle_path(config)#

Locate the cached calc-note bundle for the run the GUI is showing.

A restored run has no live network, but its per-node records were written to the store at solve time by the calc-note cache contributor — the same node_data this pane renders. So a restored run needs no re-solve and no rebuilt network: it just reads what the solve already computed.

Only the path is resolved here (cheap enough for an availability check); cached_node_data() does the loading.

The config is located through the environment the CLI sets when it preloads a YAML, since an output pane’s context carries no config path. A browser-uploaded config (no file on disk) therefore has no cached bundle to find — the same case where Boulder’s own scenario features stay inert.

bloc.boulder_plugins.hmb_pane.cached_node_data(config)#

Return (node_names, node_data) from the cached bundle, or None.

class bloc.boulder_plugins.hmb_pane.HMBPanePlugin#

Bases: boulder.output_pane_plugins.OutputPanePlugin

Heat and material balance: nodes as columns, properties as rows.

property plugin_id: str#

Unique identifier for this plugin.

property tab_label: str#

Label to display on the tab.

property tab_icon: str | None#

Optional icon for the tab (Bootstrap icon class).

property requires_selection: bool#

Whether this plugin requires a reactor/element to be selected.

is_available(context)#

Available with a live solved network, or a cached bundle to read.

create_content_data(context)#

Return the balance table for the whole network.

Off the live network when there is one; off the run’s cached per-node records when there is not, so a restored run shows the balance without re-solving.

property supported_element_types: List[str]#

List of element types this plugin supports.

property supported_node_types: List[str] | None#

Reactor kinds this plugin applies to (None = any).

When set (and requires_selection is True), the GUI only shows the plugin’s tab while a node of one of these STONE kinds is selected (e.g. ["MyReactorKind"]).

property preferred: bool#

Open this pane by default when a run completes.

When True and the user has neither picked a results tab nor selected an element, the GUI auto-selects the first node this plugin supports and activates its tab instead of the generic default.

get_callbacks()#

Return list of callbacks this plugin needs.

Returns:

List of tuples: (outputs, inputs, callback_function).

Return type:

list

on_simulation_update(context)#

Handle simulation data update.

Parameters:

context – Updated context information.

Returns:

Optional dictionary of updates to apply to components.

Return type:

dict or None