viz_data
frequenz.lib.notebooks.reporting.asset_optimization.viz_data ¤
Data preparation helpers for asset optimization visualizations.
Classes¤
frequenz.lib.notebooks.reporting.asset_optimization.viz_data.BatteryPowerData
dataclass
¤
Prepared series for battery power plotting.
Source code in src/frequenz/lib/notebooks/reporting/asset_optimization/viz_data.py
frequenz.lib.notebooks.reporting.asset_optimization.viz_data.EnergyTradeData
dataclass
¤
frequenz.lib.notebooks.reporting.asset_optimization.viz_data.MonthlyAggregateData
dataclass
¤
Prepared data for monthly aggregate plotting.
Source code in src/frequenz/lib/notebooks/reporting/asset_optimization/viz_data.py
frequenz.lib.notebooks.reporting.asset_optimization.viz_data.PowerFlowData
dataclass
¤
Prepared series for power flow plotting.
Source code in src/frequenz/lib/notebooks/reporting/asset_optimization/viz_data.py
Functions¤
frequenz.lib.notebooks.reporting.asset_optimization.viz_data.prepare_battery_power_data ¤
prepare_battery_power_data(
df: DataFrame,
) -> BatteryPowerData
Prepare normalized battery power data for visualization.
Extracts battery-related signals from a power-flow DataFrame and computes derived series used for plotting, including charge, discharge, available battery power, and state-of-charge (SOC). The function also determines the maximum absolute battery value for consistent axis scaling.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Input DataFrame containing at least the columns
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
BatteryPowerData
|
A structured container including:
- timestamp index,
- state of charge ( |
Source code in src/frequenz/lib/notebooks/reporting/asset_optimization/viz_data.py
frequenz.lib.notebooks.reporting.asset_optimization.viz_data.prepare_energy_trade_data ¤
prepare_energy_trade_data(df: DataFrame) -> EnergyTradeData
Prepare normalized energy-trade data for plotting.
Processes raw power time-series data to derive buy and sell energy flows relative to site consumption and local production. The function applies sign normalization, subtracts on-site generation (PV and CHP if present), and converts the resulting power values into resampled energy quantities.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Input DataFrame containing at least the
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
EnergyTradeData
|
A structured container including:
- resampled timestamp index (15-minute resolution),
- positive energy purchases ( |
Source code in src/frequenz/lib/notebooks/reporting/asset_optimization/viz_data.py
frequenz.lib.notebooks.reporting.asset_optimization.viz_data.prepare_monthly_data ¤
prepare_monthly_data(df: DataFrame) -> MonthlyAggregateData
Prepare monthly aggregate data.
Source code in src/frequenz/lib/notebooks/reporting/asset_optimization/viz_data.py
frequenz.lib.notebooks.reporting.asset_optimization.viz_data.prepare_power_flow_data ¤
prepare_power_flow_data(df: DataFrame) -> PowerFlowData
Prepare normalized power-flow data for plotting.
Transforms raw microgrid power columns into a structured PowerFlowData
object suitable for visualization. The function ensures required columns
exist, applies sign normalization, derives production totals, and splits
battery behavior into charge and discharge flows.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Input DataFrame containing at least the columns
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PowerFlowData
|
A structured container including: - normalized consumption series, - CHP and PV production signals, - combined production values, - battery charge and discharge components (if available), - grid exchange values, - metadata flags indicating available production sources. |
Source code in src/frequenz/lib/notebooks/reporting/asset_optimization/viz_data.py
frequenz.lib.notebooks.reporting.asset_optimization.viz_data.require_columns ¤
require_columns(df: DataFrame, *columns: str) -> None
Validate that a DataFrame contains all required columns.
Checks whether the provided column names exist in the DataFrame. If any
required columns are missing, a ValueError is raised listing all
missing column names.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
The DataFrame to validate.
TYPE:
|
*columns
|
One or more column names that must be present in
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If one or more required columns are not found in the DataFrame. |