bloc.boulder_plugins.sweep_kpis#
Per-scenario sweep hooks: KPI attrs for the plot, cache write for export.
Registered as plugins.scenario_attrs / plugins.on_scenario_solved in
bloc.boulder_plugins.register. Both fire on Boulder’s own sweep code
(boulder.sweep_runner and the GUI’s in-process
boulder.api.routes.sweep) — no Bloc-specific sweep runner needed.
Input parameters (e.g. a node’s declared pressure) don’t need a hook at all —
Boulder auto-walks every node/connection’s numeric properties on its own (see
boulder.runset.node_property_attrs). This module only supplies genuinely
computed KPIs, which Boulder has no way to derive itself.
Attributes#
Functions#
|
KPI attrs the Sweep Results plot can offer as X/Y axes. |
|
Write this scenario's calc-note artifacts beside its stored result. |
Module Contents#
- bloc.boulder_plugins.sweep_kpis.logger#
- bloc.boulder_plugins.sweep_kpis.scenario_attrs(scenario_id, merged_config, gui_payload)#
KPI attrs the Sweep Results plot can offer as X/Y axes.
carbon_yieldis read straight off the “C(s)_yield” summary row Bloc’s converter already injects for SPRING-family models (seeBlocConverter._inject_spring_performance_summary) — no extra KPI computation here. Its display unit comes frombloc.io.scenario.OUTPUT_VARIABLE_MAP, the same map the Calculation Note export already uses for this KPI’s unit — one source of truth, not a hardcoded literal here.
- bloc.boulder_plugins.sweep_kpis.on_scenario_solved(scenario_id, config, converter, simulation_result, fingerprint, gui_payload, mechanism)#
Write this scenario’s calc-note artifacts beside its stored result.
Boulder’s sweep already stores the result – one store, keyed by scenario name – so nothing here needs to persist a payload any more. What is still ours is the artifacts: running the registered cache contributors against the entry Boulder just wrote, so “Export Calculation Note” finds a bundle for every swept scenario instead of re-solving it.
(Boulder runs contributors on a single-run solve but not inside its sweep loop, which is the only reason this hook still exists. If it ever does – it has the store dir and the scenario id right there – this can go.)