Skip to content

Conversation

@paulf81
Copy link
Collaborator

@paulf81 paulf81 commented Oct 29, 2025

Previously, selecting which channels to log was a little ad hoc, with options including "logging_options" and "log_extra_channels" floating around. This PR streamlines this in the following ways:

  1. In the input yaml, each component can name which channels to log using the log_channels field
  2. If this field is empty, or not there, power is logged
  3. The field is a simple comma,seperated list
  4. If one of the elements is itself an array (like turbine_powers), then specifying the array name itself (turbine_powers) will log every turbine power, while (turbine_power.001) will log only the power of turbine 1. This allows logging of some turbine information but not all, since logging everything can be a bottleneck
  5. Previously, putting things into h_dict was contingent on logging, but now all values are inserted (in array form) and timing tests indicate this is no problem, and is much simpler
  6. The default logging values which used to be hard coded are now shown in the exampls and docs
  7. All tests, examples and docs updated to match
  8. Rechecked timing to ensure no degradation in performance

Finally, some of the channel names in the wind components were standardized to make this simpler. For example, what used to be wind_speed, is now wind_speed_mean_unwaked to make very explicit that value implied.

@paulf81 paulf81 requested review from Copilot and misi9170 October 29, 2025 21:33
@paulf81 paulf81 self-assigned this Oct 29, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the logging system from a fixed logging_option parameter to a flexible log_channels configuration. Key changes include replacing logging_option ("base", "turb_subset", "all") with a comma-separated log_channels string that allows users to specify exactly which outputs to log. The PR also renames wind-related variables for consistency (e.g., velocitieswind_speeds, wind_speedwind_speed_mean_unwaked) and adds support for selective array element logging (e.g., turbine_powers.001 to log only specific turbines).

  • Replaces logging_option with log_channels parameter across all components
  • Renames wind speed variables for clarity and consistency
  • Adds selective array element logging feature with .NNN syntax
  • Updates all configuration files, tests, and documentation

Reviewed Changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
hercules/plant_components/component_base.py Adds log_channels parsing logic to base component class
hercules/plant_components/wind_meso_to_power.py Removes logging_option validation, renames variables, removes hard-coded log outputs list
hercules/plant_components/wind_meso_to_power_precom_floris.py Same refactoring as wind_meso_to_power.py for precomputed FLORIS variant
hercules/plant_components/solar_pysam_base.py Removes log_extra_outputs logic in favor of log_channels
hercules/plant_components/battery_simple.py Removes hard-coded log outputs list
hercules/plant_components/battery_lithium_ion.py Removes hard-coded log outputs list
hercules/plant_components/electrolyzer_plant.py Adds removal of log_channels before passing config to Supervisor
hercules/emulator.py Implements selective array element logging logic in HDF5 initialization and data logging
tests/*.py Updates tests to use renamed variables and new log_channels parameter
examples/*.yaml Updates example configurations from logging_option to log_channels
docs/*.md Updates documentation to reflect new logging system

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@misi9170
Copy link
Collaborator

@paulf81 , overall this looks good, although I haven't yet done a really detailed run-through. A couple of suggestions jump out at me though:

  • wind_speed_mean_unwaked : Consider renaming wind_speed_mean_background
  • Currently, the log_channels field on the input yaml is specified as a single string, which is then split. I think a more standard approach would be to specify as a list of strings (this is how we do it in floris, for instance). Then, users can specify as
  log_channels:
    - power
    - wind_speed_mean_unwaked
    - ...

which might be a little easier both to read on the input file and handle within the Emulator code.

@paulf81
Copy link
Collaborator Author

paulf81 commented Oct 30, 2025

@paulf81 , overall this looks good, although I haven't yet done a really detailed run-through. A couple of suggestions jump out at me though:

  • wind_speed_mean_unwaked : Consider renaming wind_speed_mean_background
  • Currently, the log_channels field on the input yaml is specified as a single string, which is then split. I think a more standard approach would be to specify as a list of strings (this is how we do it in floris, for instance). Then, users can specify as
  log_channels:
    - power
    - wind_speed_mean_unwaked
    - ...

which might be a little easier both to read on the input file and handle within the Emulator code.

Both great suggestions, I'll get these in!

@paulf81 paulf81 requested a review from Copilot October 30, 2025 16:49
@paulf81
Copy link
Collaborator Author

paulf81 commented Oct 30, 2025

ok @misi9170 requested changes are in, and develop is merged in as well

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 35 out of 35 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

ax.plot(
df["time"],
df["wind_farm.floris_wind_speed"],
df["wind_farm.wind_speed_mean"],
Copy link

Copilot AI Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The column name should be wind_farm.wind_speed_mean_background to match the new naming convention used throughout the codebase. The current name wind_farm.wind_speed_mean is inconsistent with the renamed variables.

Suggested change
df["wind_farm.wind_speed_mean"],
df["wind_farm.wind_speed_mean_background"],

Copilot uses AI. Check for mistakes.

component_type: Wind_MesoToPower
floris_input_file: inputs/floris_input.yaml
wind_input_filename: inputs/wind_input.csv
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example seems to have an unrelated bug: the inputs/wind_input.csv file referred to here doesn't seem to exist

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After talking to @paulf81 , this example is just stale and will be fixed in a separate PR (possibly #158)

Copy link
Collaborator

@misi9170 misi9170 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks @paulf81 ! I left one suggestion below, but approving now anyway. I'm also happy to update if you'd like.

@misi9170
Copy link
Collaborator

I ran various examples with different configurations both of the list log_channels specification and with only certain turbines' data recorded, and everything worked fine for me. I'm in favor of merging when you're ready.

@paulf81 paulf81 merged commit 8fc55f0 into NatLabRockies:develop Oct 31, 2025
3 checks passed
@paulf81 paulf81 deleted the feature/reorg_log_channels_v2 branch October 31, 2025 21:04
@genevievestarke genevievestarke mentioned this pull request Dec 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants