bloc.spring_kpi#

SPRING engineering KPI extraction from solved STONE simulations.

Bridges the STONE/Boulder reactor network to the SPRING Calculation Note output keys, mirroring the res_dic produced by the legacy simulation_non_isothermal_reactors.py. This module is coupled by design to the SPRING YAML node conventions and to the design reactor classes; the generic, node-name-agnostic primitives (volumetric flows, quench solve, secondary-source lookup) live in bloc.calc_note_kpi.

Public entry points#

Functions#

compute_spring_quench_nodes(sim)

Return post-processing node specs for quench_gas and post_quench.

compute_spring_kpis(sim)

Compute SPRING engineering KPIs from a solved STONE Simulation.

Module Contents#

bloc.spring_kpi.compute_spring_quench_nodes(sim)#

Return post-processing node specs for quench_gas and post_quench.

These nodes are not part of the Cantera network; they are derived from the adiabatic quench mix computed in bloc.calc_note_kpi.compute_quench_kpis() and injected into calc-note CSVs by bloc.calc_note._extract_node_data().

Returns:

Each dict has name, thermo (Solution), mass_flow_kg_s, and flow_role ("source" for the quench feed, "sink" for the terminal post-quench product).

Return type:

list[dict]

bloc.spring_kpi.compute_spring_kpis(sim)#

Compute SPRING engineering KPIs from a solved STONE Simulation.

This function bridges the STONE/Boulder path to produce the same outputs as simulation_non_isothermal_reactors.py (res_dic), so that both run_scenarios.py and run_yaml_scenarios.py generate the same Calculation Note Excel.

Reactors are located by walking sim.config['nodes'] (the STONE declaration) and pulling the first node of each expected type by id, then resolving it via sim.network.reactors (matched on .name). This is deterministic even when multiple reactors of the same Python class are present, unlike isinstance-based ordering. Input parameters are read from sim.config (nodes + connections).

Parameters:

sim (bloc.simulation_builder.Simulation) – Solved STONE simulation returned by bloc.simulation_builder.build_simulation_from_yaml().

Returns:

KPI dict with the same keys as the res_dic produced by simulation_non_isothermal_reactors.py. Unavailable values are omitted. Pass as kpi_fn to bloc.calc_note.generate_calculation_note_stone().

Return type:

dict

Notes

KPIs that depend on SPRING-specific YAML structure (e.g. node naming conventions, insulation parameters) are resolved by reactor type rather than by hard-coded node ID, making this function portable across STONE YAML variants that use the PlasmaTorchInstantaneousHeating/ContinuousMixingReactor/RefractoryReactor components.