frequenz-cs-reporting 0.4.5__tar.gz → 0.4.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/PKG-INFO +1 -1
- frequenz_cs_reporting-0.4.7/RELEASE_NOTES.md +18 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/app_pages/reporting.py +8 -1
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/styles/kpi.css +56 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/views/dashboard.py +29 -2
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/views/metric_renderers.py +125 -13
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/views/plot_renderers.py +25 -24
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz_cs_reporting.egg-info/PKG-INFO +1 -1
- frequenz_cs_reporting-0.4.7/src/frequenz_cs_reporting.egg-info/scm_version.json +8 -0
- frequenz_cs_reporting-0.4.5/RELEASE_NOTES.md +0 -16
- frequenz_cs_reporting-0.4.5/src/frequenz_cs_reporting.egg-info/scm_version.json +0 -8
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/.streamlit/config.toml +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/Dockerfile +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/LICENSE +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/MANIFEST.in +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/README.md +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/app.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/pyproject.toml +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/setup.cfg +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/__init__.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/app_pages/__init__.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/app_pages/home.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/app_pages/solar.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/assets/__init__.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/assets/neustrom_background.png +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/assets/neustrom_logo.png +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/components/__init__.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/components/inputs.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/components/plot_charts.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/components/sidebar_inputs.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/components/tables.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/components/ui.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/conftest.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/constants.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/py.typed +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/rep_cs_core/__init__.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/rep_cs_core/config.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/rep_cs_core/page_spec.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/services/__init__.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/services/client_factory.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/services/data_service.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/services/solar_workflow.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/styles/dashboard.css +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/styles/home.css +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/styles/plot_card.css +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/templates/dashboard_section_divider.html +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/templates/home_feature_grid.html +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/templates/home_feature_item.html +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/templates/home_footer.html +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/templates/home_hero.html +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/templates/home_logo.html +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/templates/home_stat_item.html +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/templates/home_stats.html +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/ui_resources.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/utils/__init__.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/utils/env.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/utils/time.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/views/__init__.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/views/sections.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/views/solar_results.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/views/table_renderers.py +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz_cs_reporting.egg-info/SOURCES.txt +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz_cs_reporting.egg-info/dependency_links.txt +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz_cs_reporting.egg-info/requires.txt +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz_cs_reporting.egg-info/scm_file_list.json +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz_cs_reporting.egg-info/top_level.txt +0 -0
- {frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/toml_directory/__init__.py +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Frequenz CS Reporting Library Release Notes
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Upgrading
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## New Features
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## Bug Fixes
|
|
13
|
+
|
|
14
|
+
- Fetch battery SOC data only when the microgrid has a battery component and a configured battery SOC formula.
|
|
15
|
+
- Update the Stromverbrauch bar plot to break down consumption by the sources
|
|
16
|
+
serving local load: grid to consumption, generation to consumption, and
|
|
17
|
+
battery to consumption.
|
|
18
|
+
- Hide the battery KPI section when a microgrid does not include battery components.
|
|
@@ -210,7 +210,13 @@ def render() -> None:
|
|
|
210
210
|
resolution=resolution,
|
|
211
211
|
)
|
|
212
212
|
battery_soc_df = None
|
|
213
|
-
|
|
213
|
+
battery_formula = (
|
|
214
|
+
mcfg.ctype["battery"].formula if "battery" in component_types else None
|
|
215
|
+
)
|
|
216
|
+
has_battery_soc_formula = (
|
|
217
|
+
battery_formula is not None and "BATTERY_SOC_PCT" in battery_formula
|
|
218
|
+
)
|
|
219
|
+
if has_battery_soc_formula:
|
|
214
220
|
try:
|
|
215
221
|
fetched_soc_df = get_microgrid_soc_data(
|
|
216
222
|
microgrid_id=microgrid_id,
|
|
@@ -251,6 +257,7 @@ def render() -> None:
|
|
|
251
257
|
resolution=resolution,
|
|
252
258
|
component_types=component_types,
|
|
253
259
|
mapper=mapper,
|
|
260
|
+
microgrid_id=microgrid_id,
|
|
254
261
|
)
|
|
255
262
|
_scroll_to_section_if_requested()
|
|
256
263
|
|
{frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/styles/kpi.css
RENAMED
|
@@ -24,6 +24,62 @@
|
|
|
24
24
|
color: #4a5568;
|
|
25
25
|
margin: 0;
|
|
26
26
|
}
|
|
27
|
+
.kpi-section-warning {
|
|
28
|
+
position: relative;
|
|
29
|
+
display: inline-flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
width: 24px;
|
|
33
|
+
height: 24px;
|
|
34
|
+
margin-left: 2px;
|
|
35
|
+
border: 1px solid #facc15;
|
|
36
|
+
border-radius: 6px;
|
|
37
|
+
background: #fef9c3;
|
|
38
|
+
color: #854d0e;
|
|
39
|
+
cursor: help;
|
|
40
|
+
flex: 0 0 auto;
|
|
41
|
+
}
|
|
42
|
+
.kpi-section-warning:hover,
|
|
43
|
+
.kpi-section-warning:focus {
|
|
44
|
+
background: #fde68a;
|
|
45
|
+
outline: 2px solid rgba(250, 204, 21, 0.35);
|
|
46
|
+
outline-offset: 1px;
|
|
47
|
+
}
|
|
48
|
+
.kpi-section-warning__icon {
|
|
49
|
+
color: #ca8a04;
|
|
50
|
+
font-size: 0.82rem;
|
|
51
|
+
line-height: 1;
|
|
52
|
+
}
|
|
53
|
+
.kpi-section-warning__tooltip {
|
|
54
|
+
position: absolute;
|
|
55
|
+
top: calc(100% + 8px);
|
|
56
|
+
left: 0;
|
|
57
|
+
z-index: 10;
|
|
58
|
+
width: max-content;
|
|
59
|
+
max-width: 240px;
|
|
60
|
+
padding: 8px 10px;
|
|
61
|
+
border: 1px solid #facc15;
|
|
62
|
+
border-radius: 6px;
|
|
63
|
+
background: #422006;
|
|
64
|
+
box-shadow: 0 8px 22px rgba(15,41,74,0.18);
|
|
65
|
+
color: #fef9c3;
|
|
66
|
+
font-size: 0.72rem;
|
|
67
|
+
font-weight: 600;
|
|
68
|
+
line-height: 1.3;
|
|
69
|
+
text-align: left;
|
|
70
|
+
text-transform: none;
|
|
71
|
+
letter-spacing: 0;
|
|
72
|
+
white-space: normal;
|
|
73
|
+
opacity: 0;
|
|
74
|
+
pointer-events: none;
|
|
75
|
+
transform: translateY(-3px);
|
|
76
|
+
transition: opacity 0.15s ease, transform 0.15s ease;
|
|
77
|
+
}
|
|
78
|
+
.kpi-section-warning:hover .kpi-section-warning__tooltip,
|
|
79
|
+
.kpi-section-warning:focus .kpi-section-warning__tooltip {
|
|
80
|
+
opacity: 1;
|
|
81
|
+
transform: translateY(0);
|
|
82
|
+
}
|
|
27
83
|
|
|
28
84
|
/* ── Individual KPI card ── */
|
|
29
85
|
.kpi-card {
|
|
@@ -56,6 +56,25 @@ def _section_divider(label: str = "", badge: str = "") -> None:
|
|
|
56
56
|
)
|
|
57
57
|
|
|
58
58
|
|
|
59
|
+
def _numeric_metric(metrics: dict[str, float | str | None], key: str) -> float | None:
|
|
60
|
+
"""Return a metric value as a float when it is numeric."""
|
|
61
|
+
value = metrics.get(key)
|
|
62
|
+
if isinstance(value, (int, float)):
|
|
63
|
+
return float(value)
|
|
64
|
+
return None
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def _average_price_ct_per_kwh(
|
|
68
|
+
metrics: dict[str, float | str | None], value_key: str, energy_key: str
|
|
69
|
+
) -> float | None:
|
|
70
|
+
"""Calculate an average price in ct/kWh from euro and kWh metric values."""
|
|
71
|
+
value = _numeric_metric(metrics, value_key)
|
|
72
|
+
energy = _numeric_metric(metrics, energy_key)
|
|
73
|
+
if value is None or energy is None or energy == 0.0:
|
|
74
|
+
return None
|
|
75
|
+
return (value * 100) / energy
|
|
76
|
+
|
|
77
|
+
|
|
59
78
|
@st.cache_data(show_spinner="Preparing analysis tables…")
|
|
60
79
|
def _build_tables(
|
|
61
80
|
master_df: pd.DataFrame,
|
|
@@ -91,7 +110,13 @@ def _build_tables(
|
|
|
91
110
|
is automatically invalidated when any input parameters change.
|
|
92
111
|
"""
|
|
93
112
|
power_table = compute_energy_summary(master_df, resolution)
|
|
94
|
-
metrics = aggregate_metrics(master_df, resolution)
|
|
113
|
+
metrics = aggregate_metrics(master_df, resolution, price_column="day_ahead_price")
|
|
114
|
+
metrics["average_da_price_grid_import"] = _average_price_ct_per_kwh(
|
|
115
|
+
metrics, "grid_import_cost_sum", "grid_consumption_sum"
|
|
116
|
+
)
|
|
117
|
+
metrics["average_da_price_grid_feed_in"] = _average_price_ct_per_kwh(
|
|
118
|
+
metrics, "grid_feed_in_revenue_sum", "grid_feed_in_sum"
|
|
119
|
+
)
|
|
95
120
|
|
|
96
121
|
# Build component analyses using configuration
|
|
97
122
|
analyses = {
|
|
@@ -185,6 +210,7 @@ def render_dashboard(
|
|
|
185
210
|
resolution: timedelta,
|
|
186
211
|
component_types: Iterable[str],
|
|
187
212
|
mapper: ColumnMapper,
|
|
213
|
+
microgrid_id: int,
|
|
188
214
|
) -> None:
|
|
189
215
|
"""Render the complete microgrid reporting dashboard.
|
|
190
216
|
|
|
@@ -200,6 +226,7 @@ def render_dashboard(
|
|
|
200
226
|
component_types: List of component types present in the microgrid for
|
|
201
227
|
dynamic tab generation.
|
|
202
228
|
mapper: Column name mapper for display name standardization.
|
|
229
|
+
microgrid_id: Identifier of the selected microgrid.
|
|
203
230
|
|
|
204
231
|
Returns:
|
|
205
232
|
Renders Streamlit components directly to the app interface.
|
|
@@ -212,7 +239,7 @@ def render_dashboard(
|
|
|
212
239
|
|
|
213
240
|
# --- Overview section---
|
|
214
241
|
_section_divider("Übersicht", "KPIs")
|
|
215
|
-
sections.render_summary_boxes(tables["metrics"], component_types)
|
|
242
|
+
sections.render_summary_boxes(tables["metrics"], component_types, microgrid_id)
|
|
216
243
|
|
|
217
244
|
# --- Plots section---
|
|
218
245
|
_section_divider("Diagramme & Zeitreihen")
|
|
@@ -26,6 +26,7 @@ _SECTION_ACCENTS: dict[str, str] = {
|
|
|
26
26
|
"Netzkennzahlen": "#3b82f6", # blue – grid
|
|
27
27
|
"(Eigen-)Erzeugungskennzahlen": "#10b981", # green – generation
|
|
28
28
|
"Verbrauchskennzahlen": "#f59e0b", # amber – consumption
|
|
29
|
+
"Batteriekennzahlen": "#14b8a6", # teal – battery
|
|
29
30
|
"Bilanzkennzahlen": "#8b5cf6", # purple – balance ratios
|
|
30
31
|
}
|
|
31
32
|
|
|
@@ -33,6 +34,7 @@ _SECTION_ICONS: dict[str, str] = {
|
|
|
33
34
|
"Netzkennzahlen": "⚡",
|
|
34
35
|
"(Eigen-)Erzeugungskennzahlen": "☀",
|
|
35
36
|
"Verbrauchskennzahlen": "📊",
|
|
37
|
+
"Batteriekennzahlen": "🔋",
|
|
36
38
|
"Bilanzkennzahlen": "⚖",
|
|
37
39
|
}
|
|
38
40
|
|
|
@@ -47,13 +49,44 @@ def _peak_label(metrics: dict[str, object]) -> str:
|
|
|
47
49
|
return f"Lastspitze (kW) — {metrics.get('peak_date')}"
|
|
48
50
|
|
|
49
51
|
|
|
52
|
+
_INVOICING_WARNING = (
|
|
53
|
+
"Die dargestellten Preise und Daten basieren auf einer Prognose eigener "
|
|
54
|
+
"gemessener Werte und entsprechen nicht den offiziellen Daten des "
|
|
55
|
+
"Verteilernetzbetreibers. Für Abrechnungen sind ausschließlich die "
|
|
56
|
+
"Netzbetreiber-Daten maßgeblich, daher sind Abweichungen zu Rechnungswerten "
|
|
57
|
+
"möglich."
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
|
|
50
61
|
SECTION_SPECS: list[dict[str, Any]] = [
|
|
51
62
|
{
|
|
52
63
|
"title": "Netzkennzahlen",
|
|
64
|
+
"warning": _INVOICING_WARNING,
|
|
53
65
|
"boxes": [
|
|
54
66
|
{"label": "Netzbezug (kWh)", "key": "grid_consumption_sum"},
|
|
55
67
|
{"label": "Netzeinspeisung (kWh)", "key": "grid_feed_in_sum"},
|
|
56
68
|
{"label_fn": _peak_label, "key": "peak"},
|
|
69
|
+
{
|
|
70
|
+
"label": "Prognostizierte Netzbezugskosten (€)",
|
|
71
|
+
"key": "grid_import_cost_sum",
|
|
72
|
+
"microgrid_ids": {231},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"label": "Prognostizierte Einspeiseerloese (€)",
|
|
76
|
+
"key": "grid_feed_in_revenue_sum",
|
|
77
|
+
"microgrid_ids": {231},
|
|
78
|
+
},
|
|
79
|
+
{"label": "", "key": None, "microgrid_ids": {231}},
|
|
80
|
+
{
|
|
81
|
+
"label": "Prognostizierter Preis (ct/kWh)",
|
|
82
|
+
"key": "average_da_price_grid_import",
|
|
83
|
+
"microgrid_ids": {231},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"label": "Prognostizierter Preis (ct/kWh)",
|
|
87
|
+
"key": "average_da_price_grid_feed_in",
|
|
88
|
+
"microgrid_ids": {231},
|
|
89
|
+
},
|
|
57
90
|
],
|
|
58
91
|
},
|
|
59
92
|
{
|
|
@@ -85,6 +118,34 @@ SECTION_SPECS: list[dict[str, Any]] = [
|
|
|
85
118
|
{"label": "Eigenverbrauch (kWh)", "key": "prod_self_consumption_sum"},
|
|
86
119
|
],
|
|
87
120
|
},
|
|
121
|
+
{
|
|
122
|
+
"title": "Batteriekennzahlen",
|
|
123
|
+
"required_component_type": "battery",
|
|
124
|
+
"per_row": 3,
|
|
125
|
+
"boxes": [
|
|
126
|
+
{
|
|
127
|
+
"label": "Erzeugung zu Batterie (kWh)",
|
|
128
|
+
"key": "production_to_battery_sum",
|
|
129
|
+
"component_type": "battery",
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"label": "Netz zu Batterie (kWh)",
|
|
133
|
+
"key": "grid_to_battery_sum",
|
|
134
|
+
"component_type": "battery",
|
|
135
|
+
},
|
|
136
|
+
{"label": "", "key": None},
|
|
137
|
+
{
|
|
138
|
+
"label": "Batterie zu Netz (kWh)",
|
|
139
|
+
"key": "battery_to_grid_sum",
|
|
140
|
+
"component_type": "battery",
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"label": "Batterie zu Verbrauch (kWh)",
|
|
144
|
+
"key": "battery_to_consumption_sum",
|
|
145
|
+
"component_type": "battery",
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
},
|
|
88
149
|
{
|
|
89
150
|
"title": "Bilanzkennzahlen",
|
|
90
151
|
"per_row": 3,
|
|
@@ -124,6 +185,38 @@ def _materialize_boxes(
|
|
|
124
185
|
return boxes
|
|
125
186
|
|
|
126
187
|
|
|
188
|
+
def _filter_section_box_specs(
|
|
189
|
+
section: dict[str, Any],
|
|
190
|
+
component_type_set: set[str],
|
|
191
|
+
component_types_provided: bool,
|
|
192
|
+
microgrid_id: int | None,
|
|
193
|
+
) -> list[dict[str, Any]]:
|
|
194
|
+
"""Return KPI box specs that apply to the selected microgrid."""
|
|
195
|
+
required_component_type = section.get("required_component_type")
|
|
196
|
+
if (
|
|
197
|
+
component_types_provided
|
|
198
|
+
and required_component_type is not None
|
|
199
|
+
and required_component_type not in component_type_set
|
|
200
|
+
):
|
|
201
|
+
return []
|
|
202
|
+
|
|
203
|
+
box_specs = section["boxes"]
|
|
204
|
+
if component_types_provided:
|
|
205
|
+
box_specs = [
|
|
206
|
+
spec
|
|
207
|
+
for spec in box_specs
|
|
208
|
+
if spec.get("component_type") is None
|
|
209
|
+
or spec.get("component_type") in component_type_set
|
|
210
|
+
]
|
|
211
|
+
|
|
212
|
+
return [
|
|
213
|
+
spec
|
|
214
|
+
for spec in box_specs
|
|
215
|
+
if spec.get("microgrid_ids") is None
|
|
216
|
+
or microgrid_id in spec.get("microgrid_ids", set())
|
|
217
|
+
]
|
|
218
|
+
|
|
219
|
+
|
|
127
220
|
def render_box_grid(
|
|
128
221
|
boxes: list[tuple[str, object]],
|
|
129
222
|
per_row: int = 3,
|
|
@@ -186,20 +279,24 @@ def render_box_grid(
|
|
|
186
279
|
|
|
187
280
|
def _build_consumption_breakdown(metrics: dict[str, Any]) -> dict[str, float | None]:
|
|
188
281
|
"""Prepare data for the percentage bar plot."""
|
|
282
|
+
grid_consumption = metrics.get("grid_consumption_sum") or 0.0
|
|
283
|
+
grid_to_battery = metrics.get("grid_to_battery_sum") or 0.0
|
|
189
284
|
values = {
|
|
190
285
|
"Stromverbrauch (kWh)": metrics.get("mid_consumption_sum"),
|
|
191
|
-
"
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
"
|
|
195
|
-
"
|
|
286
|
+
"Netz zu Verbrauch (kWh)": max(
|
|
287
|
+
float(grid_consumption) - float(grid_to_battery), 0.0
|
|
288
|
+
),
|
|
289
|
+
"Erzeugung zu Verbrauch (kWh)": metrics.get("prod_self_consumption_sum"),
|
|
290
|
+
"Batterie zu Verbrauch (kWh)": metrics.get("battery_to_consumption_sum"),
|
|
196
291
|
}
|
|
197
292
|
return {k: (float(v) if v is not None else 0.0) for k, v in values.items()}
|
|
198
293
|
|
|
199
294
|
|
|
295
|
+
# pylint: disable=too-many-locals
|
|
200
296
|
def render_summary_boxes(
|
|
201
297
|
metrics: dict[str, Any],
|
|
202
298
|
component_types: Iterable[str] | None = None,
|
|
299
|
+
microgrid_id: int | None = None,
|
|
203
300
|
) -> None:
|
|
204
301
|
"""Render overview metrics grouped into styled subsections.
|
|
205
302
|
|
|
@@ -207,6 +304,8 @@ def render_summary_boxes(
|
|
|
207
304
|
metrics: Metrics dictionary containing aggregated KPI values.
|
|
208
305
|
component_types: Optional iterable of component type identifiers present
|
|
209
306
|
in the microgrid (e.g., ``{"pv", "chp"}``).
|
|
307
|
+
microgrid_id: Optional microgrid identifier used for microgrid-specific
|
|
308
|
+
KPI cards.
|
|
210
309
|
|
|
211
310
|
Returns:
|
|
212
311
|
Streamlit components are rendered directly.
|
|
@@ -216,6 +315,7 @@ def render_summary_boxes(
|
|
|
216
315
|
return
|
|
217
316
|
|
|
218
317
|
_ensure_kpi_css()
|
|
318
|
+
component_types_provided = component_types is not None
|
|
219
319
|
component_type_set = set(component_types or [])
|
|
220
320
|
|
|
221
321
|
# Section heading
|
|
@@ -230,29 +330,41 @@ def render_summary_boxes(
|
|
|
230
330
|
)
|
|
231
331
|
|
|
232
332
|
for section in SECTION_SPECS:
|
|
333
|
+
box_specs = _filter_section_box_specs(
|
|
334
|
+
section,
|
|
335
|
+
component_type_set,
|
|
336
|
+
component_types_provided,
|
|
337
|
+
microgrid_id,
|
|
338
|
+
)
|
|
339
|
+
if not box_specs:
|
|
340
|
+
continue
|
|
341
|
+
|
|
233
342
|
title = section["title"]
|
|
234
343
|
accent = _SECTION_ACCENTS.get(title, "#3b82f6")
|
|
235
344
|
icon = _SECTION_ICONS.get(title, "●")
|
|
236
345
|
icon_bg = accent + "22" # ~13% opacity hex approximation
|
|
346
|
+
warning = section.get("warning")
|
|
347
|
+
warning_html = (
|
|
348
|
+
f'<span class="kpi-section-warning" role="button" tabindex="0" '
|
|
349
|
+
f'aria-label="{warning}">'
|
|
350
|
+
'<span class="kpi-section-warning__icon">⚠</span>'
|
|
351
|
+
f'<span class="kpi-section-warning__tooltip">{warning}</span>'
|
|
352
|
+
"</span>"
|
|
353
|
+
if warning
|
|
354
|
+
else ""
|
|
355
|
+
)
|
|
237
356
|
|
|
238
357
|
st.markdown(
|
|
239
358
|
f"""
|
|
240
359
|
<div class="kpi-section-header">
|
|
241
360
|
<div class="kpi-section-icon" style="background:{icon_bg};">{icon}</div>
|
|
242
361
|
<p class="kpi-section-title">{title}</p>
|
|
362
|
+
{warning_html}
|
|
243
363
|
</div>
|
|
244
364
|
""",
|
|
245
365
|
unsafe_allow_html=True,
|
|
246
366
|
)
|
|
247
367
|
|
|
248
|
-
box_specs = section["boxes"]
|
|
249
|
-
if component_type_set:
|
|
250
|
-
box_specs = [
|
|
251
|
-
spec
|
|
252
|
-
for spec in box_specs
|
|
253
|
-
if spec.get("component_type") is None
|
|
254
|
-
or spec.get("component_type") in component_type_set
|
|
255
|
-
]
|
|
256
368
|
boxes = _materialize_boxes(box_specs, metrics)
|
|
257
369
|
per_row = section.get("per_row", 3)
|
|
258
370
|
render_box_grid(boxes, per_row=per_row, accent=accent)
|
|
@@ -29,9 +29,9 @@ _COMPONENT_TABS = [
|
|
|
29
29
|
("KWK", "chp"),
|
|
30
30
|
("EV", "ev"),
|
|
31
31
|
]
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
_TIME_SERIES_HEIGHT = 500
|
|
33
|
+
_TIME_SERIES_MARGIN = {"t": 80, "r": 64, "b": 96, "l": 64}
|
|
34
|
+
_TIME_SERIES_RANGE_SLIDER_THICKNESS = 0.15
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
def _left_align_plot_title(fig: object) -> None:
|
|
@@ -40,6 +40,17 @@ def _left_align_plot_title(fig: object) -> None:
|
|
|
40
40
|
fig.update_layout(title={"x": 0, "xref": "container", "xanchor": "left"})
|
|
41
41
|
|
|
42
42
|
|
|
43
|
+
def _apply_compact_time_series_layout(fig: go.Figure) -> None:
|
|
44
|
+
"""Reduce time-series plot size without changing the visible data range."""
|
|
45
|
+
fig.update_layout(
|
|
46
|
+
height=_TIME_SERIES_HEIGHT,
|
|
47
|
+
margin=_TIME_SERIES_MARGIN,
|
|
48
|
+
xaxis_rangeslider_thickness=_TIME_SERIES_RANGE_SLIDER_THICKNESS,
|
|
49
|
+
)
|
|
50
|
+
fig.update_xaxes(autorange=True, range=None)
|
|
51
|
+
fig.update_yaxes(autorange=True, range=None)
|
|
52
|
+
|
|
53
|
+
|
|
43
54
|
# pylint: disable=too-many-arguments
|
|
44
55
|
def render_time_series(
|
|
45
56
|
df: pd.DataFrame,
|
|
@@ -108,11 +119,7 @@ def render_time_series(
|
|
|
108
119
|
dotted_cols=dotted_cols,
|
|
109
120
|
plot_order=plot_order,
|
|
110
121
|
)
|
|
111
|
-
fig
|
|
112
|
-
height=_BATTERY_OVERVIEW_HEIGHT,
|
|
113
|
-
margin=_BATTERY_OVERVIEW_MARGIN,
|
|
114
|
-
xaxis_rangeslider_thickness=_BATTERY_OVERVIEW_RANGE_SLIDER_THICKNESS,
|
|
115
|
-
)
|
|
122
|
+
_apply_compact_time_series_layout(fig)
|
|
116
123
|
_left_align_plot_title(fig)
|
|
117
124
|
|
|
118
125
|
render_plot_card(title, fig)
|
|
@@ -243,16 +250,12 @@ def _render_overview_plot(battery_usecase_df: pd.DataFrame | None) -> None:
|
|
|
243
250
|
"peak_before_optimization",
|
|
244
251
|
"day_ahead_price",
|
|
245
252
|
],
|
|
246
|
-
stack_mode="
|
|
253
|
+
stack_mode="psc",
|
|
247
254
|
xaxis_title="Zeitpunkt",
|
|
248
255
|
yaxis_title="kW",
|
|
249
256
|
soc_secondary_y_title="SOC [%]",
|
|
250
257
|
)
|
|
251
|
-
fig
|
|
252
|
-
height=_BATTERY_OVERVIEW_HEIGHT,
|
|
253
|
-
margin=_BATTERY_OVERVIEW_MARGIN,
|
|
254
|
-
xaxis_rangeslider_thickness=_BATTERY_OVERVIEW_RANGE_SLIDER_THICKNESS,
|
|
255
|
-
)
|
|
258
|
+
_apply_compact_time_series_layout(fig)
|
|
256
259
|
_left_align_plot_title(fig)
|
|
257
260
|
render_plot_card("Lastgang Übersicht", fig)
|
|
258
261
|
|
|
@@ -287,11 +290,7 @@ def _render_battery_soc_plot(battery_usecase_df: pd.DataFrame | None) -> None:
|
|
|
287
290
|
legend_title=None,
|
|
288
291
|
secondary_y_title="SOC [%]",
|
|
289
292
|
)
|
|
290
|
-
fig
|
|
291
|
-
height=_BATTERY_OVERVIEW_HEIGHT,
|
|
292
|
-
margin=_BATTERY_OVERVIEW_MARGIN,
|
|
293
|
-
xaxis_rangeslider_thickness=_BATTERY_OVERVIEW_RANGE_SLIDER_THICKNESS,
|
|
294
|
-
)
|
|
293
|
+
_apply_compact_time_series_layout(fig)
|
|
295
294
|
_left_align_plot_title(fig)
|
|
296
295
|
render_plot_card("Batterie Ladezustand", fig)
|
|
297
296
|
|
|
@@ -304,6 +303,7 @@ def _get_active_tabs(
|
|
|
304
303
|
) -> list[tuple[str, Callable[[], None]]]:
|
|
305
304
|
"""Determine which tabs should be rendered based on data availability."""
|
|
306
305
|
tabs = []
|
|
306
|
+
battery_soc_tab: tuple[str, Callable[[], None]] | None = None
|
|
307
307
|
component_type_set = set(component_types)
|
|
308
308
|
|
|
309
309
|
# 1. Overview Tab
|
|
@@ -311,11 +311,9 @@ def _get_active_tabs(
|
|
|
311
311
|
if overview_df is not None and not overview_df.empty:
|
|
312
312
|
tabs.append(("Zeitreihen-Plot", lambda: _render_overview_plot(overview_df)))
|
|
313
313
|
if "battery" in component_type_set:
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
lambda: _render_battery_soc_plot(overview_df),
|
|
318
|
-
)
|
|
314
|
+
battery_soc_tab = (
|
|
315
|
+
"Batterie SOC",
|
|
316
|
+
lambda: _render_battery_soc_plot(overview_df),
|
|
319
317
|
)
|
|
320
318
|
|
|
321
319
|
# 2. Energy Mix Tab
|
|
@@ -352,6 +350,9 @@ def _get_active_tabs(
|
|
|
352
350
|
)
|
|
353
351
|
tabs.append((label, render_fn))
|
|
354
352
|
|
|
353
|
+
if battery_soc_tab is not None:
|
|
354
|
+
tabs.append(battery_soc_tab)
|
|
355
|
+
|
|
355
356
|
return tabs
|
|
356
357
|
|
|
357
358
|
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Frequenz CS Reporting Library Release Notes
|
|
2
|
-
|
|
3
|
-
## Summary
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
## Upgrading
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## New Features
|
|
10
|
-
|
|
11
|
-
- Fetch and cache battery state-of-charge data for microgrids with batteries.
|
|
12
|
-
- Add a dedicated "Batterie SOC" plot tab showing battery power flow and state of charge.
|
|
13
|
-
|
|
14
|
-
## Bug Fixes
|
|
15
|
-
- Update the table filtering logic to work in deepnote.
|
|
16
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/conftest.py
RENAMED
|
File without changes
|
{frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/constants.py
RENAMED
|
File without changes
|
{frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/py.typed
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/utils/env.py
RENAMED
|
File without changes
|
{frequenz_cs_reporting-0.4.5 → frequenz_cs_reporting-0.4.7}/src/frequenz/cs_reporting/utils/time.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|