bloc.report#

Automated Calculation Note generator for Bloc.

Generates an Excel workbook (.xlsx) from simulation results, following the structure of the manual SPRING Calculation Notes. Supports multiple scenarios as side-by-side columns.

Dependencies: openpyxl

Attributes#

Functions#

generate_calculation_note_excel(scenario_results, ...)

Generate a Calculation Note Excel workbook.

Module Contents#

bloc.report.INPUT_SECTION_FROM_OUTPUTS#
bloc.report.GAS_PHASE_EXCLUDE_KEYS = ['X_C(s)', 'Y_C(s)']#
bloc.report.COMPOSITION_AGGREGATE_EXCLUDE_KEYS = ['X_PAH']#
bloc.report.LHV_HHV_EXCEL_ERROR_KEYS#
bloc.report.generate_calculation_note_excel(scenario_results, output_path, title='SPRING Calculation Note', subtitle='Generated by Bloc', diagram_paths=None, yaml_files=None, header_comments=None, custom_input_categories=None, custom_output_categories=None, custom_input_variable_map=None, custom_output_variable_map=None, constraints=None)#

Generate a Calculation Note Excel workbook.

Parameters:
  • scenario_results (dict) – {scenario_id: {"inputs": dict, "outputs": dict, "metadata": dict}} where inputs are the YAML initial parameters and outputs is the res_dic from the simulation.

  • output_path (str or Path) – Where to write the .xlsx file.

  • title (str) – Title for the header.

  • subtitle (str) – Subtitle / description.

  • diagram_paths (dict or None) – {scenario_id: {"sankey": path, "network": path}}. If provided, diagrams are embedded as images.

  • yaml_files (list of str or None) – YAML file names used for this report (shown in header).

  • header_comments (list of str or None) – Header comments extracted from the YAML file (update log, etc.).

  • custom_input_categories (dict or None) – Override for bloc.yaml_utils.INPUT_CATEGORIES (e.g. tube furnace model).

  • custom_output_categories (dict or None) – Override for bloc.yaml_utils.OUTPUT_CATEGORIES.

  • custom_input_variable_map (dict or None) – Override for bloc.yaml_utils.INPUT_VARIABLE_MAP.

  • custom_output_variable_map (dict or None) – Override for bloc.yaml_utils.OUTPUT_VARIABLE_MAP.

  • constraints (list of bloc.constraints.Constraint or None) – Design constraints evaluated against each scenario’s outputs. When provided, a DESIGN CONSTRAINTS section is added to the summary sheet with red-background cells for violated constraints.

Returns:

The path to the generated file.

Return type:

Path