config
frequenz.lib.notebooks.solar.maintenance.config ¤
This module contains the SolarMaintenanceConfig class.
The SolarMaintenanceConfig class is a configuration class that contains parameters and methods to update them dynamically, ensuring consistency and preventing unauthorized modifications. The class inherits from ConfigConstants, which contains immutable constants for the Solar Maintenance Project.
Classes¤
frequenz.lib.notebooks.solar.maintenance.config.ConfigConstants ¤
Class containing immutable constants for the Solar Maintenance Project.
Constants
ATTRIBUTES_THAT_CANNOT_BE_UPDATED (list[str]): Attributes that cannot be updated directly. VALID_OUTLIER_DETECTION_METHODS (list[str]): Supported outlier detection methods. Currently supported methods are: - 'z_score' - 'modified_z_score' - 'min_max' - 'iqr' VALID_ROLLING_VIEW_TIME_FRAMES (list[str]): Supported time frames for the rolling view plot. Currently only 'days' is supported. SUPPORTED_LANGUAGES (list[str]): Supported languages for translations. Currently supported languages are: 'en' (English) and 'de' (German). RANGE_SMALL_RESAMPLE_PERIOD (tuple[int, int]): Bounded range (min, max) in seconds, for the small_resample_period_seconds RANGE_REAL_TIME_VIEW_DURATION_HOURS (tuple[int, int]): Bounded range (min, max) for the real time view duration in hours. VALID_STAT_PROFILE_GROUPINGS (list[str]): Supported groupings for the statistical profile. Currently supported groupings are: - 'grouped': Groups data by an interval size defined by DEFAULT_LARGE_RESAMPLE_PERIOD_SECONDS in minutes, merging data from the same interval across different days into one group. - 'continuous': Groups data into continuous intervals throughout the entire dataset duration, without merging same-interval data across different days. The interval size is defined by DEFAULT_LARGE_RESAMPLE_PERIOD_SECONDS in minutes. - '24h_continuous': Groups data into continuous 24-hour intervals throughout the entire dataset duration, without merging same-interval data across different days. VALID_BASELINE_MODELS (list[str]): Supported baseline models. Currently supported models are: - '7-day MA': 7-day moving average. - '7-day sampled MA': 7-day moving average with intervals of DEFAULT_LARGE_RESAMPLE_PERIOD_SECONDS in minutes. - 'simulation': Simulation-based forecast using pvlib library. - 'weather-based-forecast': Weather-based forecast using data from the weather API. VALID_PLOT_THEMES (list[str]): Supported plot themes. Currently supported themes are: - 'frequenz-neustrom' (default) - 'elegant-minimalist' - 'vibrant' - 'classic' DEFAULT_VERBOSITY_FLAG (bool): Default verbosity flag. A boolean flag to print additional information to the console. DEFAULT_WEATHER_SERVICE_ADDRESS (str): Default weather service address. DEFAULT_REPORTING_SERVICE_ADDRESS (str): Default reporting service address. DEFAULT_MICROGRID_IDS (list[int]): Default microgrid IDs. DEFAULT_COMPONENT_IDS (list[list[int]]): Default component IDs for each microgrid. DEFAULT_OUTLIER_DETECTION_PARAMS (dict): Default parameters for outlier detection. Contains these keys: - method: Outlier detection method. - bounds: The lower and upper values, at index 0 and 1 respectively, to replace outliers with. - params: Additional parameters for the outlier detection method. DEFAULT_METRICS_TO_FETCH (list[Metric]): Default metrics to fetch from the reporting API. DEFAULT_SMALL_RESAMPLE_PERIOD_SECONDS (int): Default small sample period. DEFAULT_LARGE_RESAMPLE_PERIOD_SECONDS (int): Default large sample period. DEFAULT_WEATHER_FEATURES_TO_FETCH (list[str]): Default features to fetch from the weather API. DEFAULT_WEATHER_FEATURE_NAMES (list[str]): Default internal feature names for the weather API features. These must match the order of DEFAULT_WEATHER_FEATURES_TO_FETCH. DEFAULT_TIME_ZONE (ZoneInfo): Timezone for all timestamps. Default is UTC. DEFAULT_START_TIMESTAMP (datetime): Default start timestamp for fetching data. DEFAULT_END_TIMESTAMP (datetime): Default end timestamp for fetching data. DEFAULT_CLIENT_SITE_INFO_KEYS_VALUE_TYPES (list[dict[str, tuple[type, Any]]]): List of one dictionary that contains the default keys and value types (along with dummy default values) for the client site info. Contains these keys: - name (str): Name of the client site. - latitude (float): The latitude of the location. - longitude (float): The longitude of the location. - altitude (float): The altitude of the location. - peak_power_watts (float): The peak power (solar panels) in Watts. - rated_power_watts (float): The rated power (PV inverters) in Watts. - efficiency (float): The overall system efficiency. Range: [0.0, 1.0]. - mid (int): The microgrid ID of the client site. - malo_id (str): The MALO ID of the client site. DEFAULT_ROLLING_VIEW_DURATION (int): Default duration for the rolling view plot. DEFAULT_ROLLING_VIEW_TIME_FRAME (str): Default time frame for the rolling view plot. DEFAULT_REAL_TIME_VIEW_DURATION_HOURS (int): Default duration for the real time view in hours. DEFAULT_STAT_PROFILE_GROUPING (list[str]): Default groupings for the statistical profile. DEFAULT_PLOT_THEME (str): Default plot theme for the plots. DEFAULT_FORCE_POSITIVE_VALUES (bool): Default flag to force positive values for all data points. DEFAULT_SPLIT_REAL_TIME_VIEW_PER_INVERTER (bool): Default flag to split the real time view per inverter (True) or to show the total power (False). DEFAULT_BASELINE_MODELS (list[str]): Default baseline models to use. DEFAULT_LANGUAGE (str): Default language for the translations.
Source code in frequenz/lib/notebooks/solar/maintenance/config.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
|
frequenz.lib.notebooks.solar.maintenance.config.SolarMaintenanceConfig ¤
Bases: ConfigConstants
Configuration class the solar maintenance project.
This class contains parameters and methods to update them dynamically, ensuring consistency and preventing unauthorized modifications.
ATTRIBUTE | DESCRIPTION |
---|---|
weather_service_address |
Endpoint for weather data API.
TYPE:
|
reporting_service_address |
Endpoint for reporting data API.
TYPE:
|
weather_feature_names_mapping |
Mapping of weather API feature names to internal feature names.
TYPE:
|
microgrid_ids |
List of microgrid IDs. Each microgrid ID must correspond to the element of the same index in component_ids. |
component_ids |
List of component IDs for each microgrid. |
microgrid_components |
List of microgrid- component ID pairs. |
metrics_to_fetch |
List of metrics to fetch from the reporting API.
TYPE:
|
small_resample_period_seconds |
The sample period value in seconds to use when fetching data from the reporting API for further processing and/or plotting that requires high temporal resolution.
TYPE:
|
large_resample_period_seconds |
The sample period value in seconds to use when fetching data from the reporting API for further processing and/or plotting that does not require high temporal resolution.
TYPE:
|
time_zone |
Timezone for the data. Default is UTC. To set a different timezone, the set_timezone method is used which accepts a string in the IANA timezone database format.
TYPE:
|
start_timestamp |
Start timestamp for fetching data (in UTC).
TYPE:
|
end_timestamp |
End timestamp for fetching data (in UTC).
TYPE:
|
client_site_info |
Information per client site. Each List element must correspond to the same index in microgrid_ids and component_ids. Each dictionary can be empty (in which case all the default values are kept) or contain one or more of the keys in DEFAULT_CLIENT_SITE_INFO_KEYS_VALUE_TYPES (in which case the default values are overwritten). |
outlier_detection_parameters |
Parameters for outlier detection. See DEFAULT_OUTLIER_DETECTION_PARAMS for more details and see VALID_OUTLIER_DETECTION_METHODS for the supported methods.
TYPE:
|
rolling_view_duration |
Duration for the rolling view plot.
TYPE:
|
rolling_view_time_frame |
Time frame for the rolling view plot.
TYPE:
|
stat_profile_grouping |
Groupings for the statistical profile. See VALID_STAT_PROFILE_GROUPINGS for the supported groupings. |
verbose |
Verbosity flag. A boolean flag to print additional info.
TYPE:
|
real_time_view_duration_hours |
Duration for the real time view in hours.
TYPE:
|
plot_theme |
Theme for the plots. See VALID_PLOT_THEMES for the supported themes.
TYPE:
|
force_positive_values |
Flag to force positive values for all data points.
TYPE:
|
split_real_time_view_per_inverter |
Flag to split the real time view per inverter (True) or to show the total power (False).
TYPE:
|
baseline_models |
Baseline models to use. See VALID_BASELINE_MODELS for the supported models. |
language |
Language for the translations.
TYPE:
|
Constants
Inherited from ConfigConstants. These include: - VALID_OUTLIER_DETECTION_METHODS: List of valid methods for outlier detection. - DEFAULT_*: Default values for various configuration parameters.
METHOD | DESCRIPTION |
---|---|
set_default_parameters |
Set default parameters for the configuration. |
update_parameter |
Update a specific parameter with a new value. |
update_mids_and_cids |
Update microgrid_ids and component_ids together. |
update_dict |
Update specific values in a dictionary. |
validate_all_settings |
Validate all configuration settings. |
Notes
- The configuration parameters are set to default values in the constructor.
- The default service addresses, microgrid IDs, component IDs and client_site_info are set to example values for demonstration purposes. These should be updated with the actual values before running the application.
Source code in frequenz/lib/notebooks/solar/maintenance/config.py
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 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 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 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 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 |
|
Functions¤
__init__ ¤
Initialize the SolarMaintenanceConfig class.
Source code in frequenz/lib/notebooks/solar/maintenance/config.py
set_time_zone ¤
set_time_zone(time_zone_str: str) -> None
Set the timezone for the data.
PARAMETER | DESCRIPTION |
---|---|
time_zone_str
|
The timezone to set. Should be in the IANA timezone database format (i.e. supported by zoneinfo).
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the timezone is not found in the zoneinfo database. |
Source code in frequenz/lib/notebooks/solar/maintenance/config.py
set_timestamp ¤
Set the start or end timestamp for fetching data.
PARAMETER | DESCRIPTION |
---|---|
param_name
|
The name of the parameter to update.
TYPE:
|
timestamp
|
The new timestamp to set.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the timestamp is not a datetime object. |
Source code in frequenz/lib/notebooks/solar/maintenance/config.py
update_dict ¤
Update specific key values in a dictionary.
PARAMETER | DESCRIPTION |
---|---|
dict_to_update
|
Dictionary to update. |
updates
|
Dictionary containing the values to update. |
param_name
|
The name of the parameter being updated.
TYPE:
|
See Also
_validate_inclusion()
and validate_all_settings()
for validation
details.
Source code in frequenz/lib/notebooks/solar/maintenance/config.py
update_mids_and_cids ¤
Update microgrid_ids and component_ids together.
PARAMETER | DESCRIPTION |
---|---|
microgrid_ids
|
A list of microgrid IDs. |
component_ids
|
A list of lists of component IDs. |
See Also
see validate_all_settings() for validation details.
Source code in frequenz/lib/notebooks/solar/maintenance/config.py
update_parameter ¤
Update parameters dynamically with type and logical checks.
Certain parameters cannot be directly updated and require specific
methods. For example, microgrid_ids and component_ids should be updated using update_mids_and_cids.
PARAMETER | DESCRIPTION |
---|---|
param_name
|
The name of the parameter to update.
TYPE:
|
param_value
|
The new value for the parameter.
TYPE:
|
See Also
validate_all_settings()
and _validate_can_be_updated()
for
validation details.
Source code in frequenz/lib/notebooks/solar/maintenance/config.py
validate_all_settings ¤
Validate all configuration settings.
See Also
_validate_service_address(), _validate_type(), _validate_value_range(), _validate_list_of(), _validate_matching_lengths(), _validate_dictionary(), _validate_inclusion(), _validate_can_be_updated() for validation details.
Source code in frequenz/lib/notebooks/solar/maintenance/config.py
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 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 |
|