Reporting#

render(sol, case_name='', *, output=None, stream=None, detail='auto', options=None)#

Render a solved case in the format selected by the destination.

An .html or .json output path selects that format. Another output suffix selects plain text. Without an output path, a color terminal selects rich text and another stream selects plain text. This function returns the report and does not write the output path.

Parameters:
  • sol -- Solved power-flow case.

  • case_name -- Name to show in the report header.

  • output -- Path whose suffix selects the report format.

  • stream -- Stream used to detect color support. The default is sys.stdout.

  • detail -- Rich-text detail level. Use "full", "summary", or "auto". Automatic detail shows all tables through 200 buses, omits branches through 500 buses, and shows a summary above 500.

  • options -- Report content options. None uses ReportOptions defaults.

Returns:

Formatted report string.

render_plain(sol, case_name='', *, options=None)#

Render a plain-text power-flow report.

A failed solution produces only solve metadata and a diagnostic hint.

Parameters:
  • sol -- Solved power-flow case.

  • case_name -- Name to show in the report header.

  • options -- Report content options. None uses ReportOptions defaults.

Returns:

The report as plain text.

render_rich(sol, case_name='', detail='auto', *, options=None)#

Render a color terminal report with tables and a voltage sparkline.

A failed solution produces only solve metadata and a diagnostic hint.

Parameters:
  • sol -- Solved power-flow case.

  • case_name -- Name to show in the report header.

  • detail -- Table detail level. Use "full", "summary", or "auto".

  • options -- Report content options. None uses ReportOptions defaults.

Returns:

The report with ANSI color sequences.

render_html(sol, case_name='', *, options=None)#

Render a self-contained HTML report with inline CSS.

A failed solution produces only solve metadata and a diagnostic hint.

Parameters:
  • sol -- Solved power-flow case.

  • case_name -- Name to show in the report header.

  • options -- Report content options. None uses ReportOptions defaults.

Returns:

A complete HTML document.

render_json(sol)#

Render a solved case as JSON.

A failed solution includes solve metadata and convergence history but omits per-device results.

Parameters:

sol -- Solved power-flow case.

Returns:

The report as an indented JSON document.