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)#

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.).

Returns:

The path to the generated file.

Return type:

Path