viz_plotly
frequenz.lib.notebooks.reporting.asset_optimization.viz_plotly ¤
Visualization for asset optimization reporting using Plotly.
Functions:¤
frequenz.lib.notebooks.reporting.asset_optimization.viz_plotly.plot_battery_power ¤
Plot battery power and state of charge (SOC) over time.
Creates a Plotly figure visualizing battery behavior, including available power, charging, discharging, and SOC. The SOC is displayed on a secondary y-axis, while power-related traces share the primary axis.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Input DataFrame containing the columns required by
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Figure
|
A Plotly figure showing battery power flows and SOC. |
Source code in src/frequenz/lib/notebooks/reporting/asset_optimization/viz_plotly.py
769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 | |
frequenz.lib.notebooks.reporting.asset_optimization.viz_plotly.plot_energy_trade ¤
plot_energy_trade(
df: DataFrame,
fig: Figure | None = None,
row: int | None = None,
) -> Figure
Plot the microgrid energy trade as a time-series chart.
Creates a Plotly figure showing bought and sold energy over time based on
the processed output of prepare_energy_trade_data. The function adds
separate traces for energy buy and sell values and optionally applies the
standard layout and range slider when used as a standalone figure.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Input DataFrame containing the columns required by
TYPE:
|
fig
|
Optional existing figure to which traces are added. If not provided,
a new
TYPE:
|
row
|
Optional subplot row index. When provided, the common layout and range slider are not applied, and axis padding is scoped to the specified subplot row.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Figure
|
A Plotly figure containing the energy trade traces. |
Source code in src/frequenz/lib/notebooks/reporting/asset_optimization/viz_plotly.py
frequenz.lib.notebooks.reporting.asset_optimization.viz_plotly.plot_monthly ¤
plot_monthly(df: DataFrame) -> tuple[Figure, DataFrame]
Plot monthly aggregated energy data as grouped bar charts.
Builds a Plotly bar chart showing positive and negative monthly energy
values returned by prepare_monthly_data. Positive values are plotted
as standard bars, while negative values are rendered with reduced opacity
for visual distinction.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Input DataFrame containing time-series data required by
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[Figure, DataFrame]
|
The monthly aggregated DataFrame used for plotting. |
Source code in src/frequenz/lib/notebooks/reporting/asset_optimization/viz_plotly.py
frequenz.lib.notebooks.reporting.asset_optimization.viz_plotly.plot_power ¤
plot_power(
df: DataFrame,
fig: Figure | None = None,
row: int | None = None,
) -> Figure
Plot the microgrid power as a cumulative PSC stack.
Each component is added to the running total in its raw PSC sign, starting from the consumption line, so the top of the stack coincides with the grid line by energy balance. A stack top that drifts away from the grid line means the components do not account for the measured exchange.
Unlike plot_power_flow, production is not clipped, so PV drawing power is visible rather than silently flattened to zero.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Input DataFrame containing the columns required by prepare_power_data.
TYPE:
|
fig
|
Optional existing figure to add traces to. If not provided, a new figure is created.
TYPE:
|
row
|
Optional subplot row index. When provided, common layout and range slider configuration are skipped and axis padding is applied to the specified subplot row.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Figure
|
A Plotly figure containing the stacked power traces. |
Source code in src/frequenz/lib/notebooks/reporting/asset_optimization/viz_plotly.py
505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 | |
frequenz.lib.notebooks.reporting.asset_optimization.viz_plotly.plot_power_flow ¤
plot_power_flow(
df: DataFrame,
fig: Figure | None = None,
row: int | None = None,
) -> Figure
Plot the microgrid power flow as a stacked time-series chart.
Builds a Plotly figure showing the evolution of key power-flow components
over time, including on-site production (CHP and/or PV), battery charging and
discharging (when available), grid exchange, and total consumption. The input
data is normalized via prepare_power_flow_data before traces are added.
If no figure is provided, a new one is created. When row is not provided,
the function also applies the common layout and a range slider. Axis padding is
applied in all cases based on the combined y-range of the plotted series.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Input DataFrame containing the columns required by
TYPE:
|
fig
|
Optional existing figure to add traces to. If not provided, a new
TYPE:
|
row
|
Optional subplot row index. When provided, common layout and range slider configuration are skipped and axis padding is applied to the specified subplot row.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Figure
|
A Plotly figure containing the power-flow traces. |
Source code in src/frequenz/lib/notebooks/reporting/asset_optimization/viz_plotly.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 | |
frequenz.lib.notebooks.reporting.asset_optimization.viz_plotly.plot_power_flow_trade ¤
Create a combined subplot showing power flow and energy trade.
Builds a two-row Plotly figure with shared x-axis: - The top subplot renders the power-flow visualization. - The bottom subplot renders the corresponding energy-trade visualization.
Traces from the underlying figures are merged into a single subplot layout and assigned to two separate legends (one per subplot). The figure applies a common layout configuration, axis styling, subplot-specific y-axis titles, and adds a range slider on the lower subplot.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Input DataFrame containing the columns required by
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Figure
|
A Plotly figure containing the stacked power-flow and energy-trade |
Figure
|
subplots with independent legends and shared time navigation. |