Skip to content

Conversation

@sambuddhac
Copy link
Owner

Fixed the thermal fuel type assignment to use getproperty(ThermalFuels, Symbol(...)) instead of directly using fuel_dict values. This ensures compatibility with the PowerSystems.jl v4 API where ThermalFuels enum values must be properly accessed.

Changes:

  • Updated 3_Zones_simulation.ipynb to properly convert fuel_dict values to ThermalFuels enum
  • Added example_cases/FuelMapping_example.csv as a reference for users
  • Updated example_cases/README.md with documentation on fuel type mapping requirements

This fixes the error: "type DataType has no field ThermalFuel"

Fixed the thermal fuel type assignment to use getproperty(ThermalFuels, Symbol(...))
instead of directly using fuel_dict values. This ensures compatibility with the
PowerSystems.jl v4 API where ThermalFuels enum values must be properly accessed.

Changes:
- Updated 3_Zones_simulation.ipynb to properly convert fuel_dict values to ThermalFuels enum
- Added example_cases/FuelMapping_example.csv as a reference for users
- Updated example_cases/README.md with documentation on fuel type mapping requirements

This fixes the error: "type DataType has no field ThermalFuel"
Copilot AI review requested due to automatic review settings November 5, 2025 03:47
Copy link

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 pull request adds documentation for fuel type mapping and updates the fuel assignment logic in the Jupyter notebook to correctly use PowerSystems.jl enum values. The changes enable users to properly configure fuel types when working with CSV data inputs for power system simulations.

  • Added comprehensive documentation for fuel type mapping configuration
  • Fixed fuel assignment in thermal generator initialization to use proper ThermalFuels enum values
  • Provided example fuel mapping CSV file

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
example_cases/README.md Added documentation explaining fuel type mapping requirements, example usage, and valid enum values
example_cases/FuelMapping_example.csv New example file showing fuel type mappings from custom names to PowerSystems.jl enum values
3_Zones_simulation.ipynb Updated fuel assignment to convert string values to ThermalFuels enum using getproperty, and formatting changes to Unicode characters

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

@@ -821,7 +821,7 @@
" time_limits = (up = thermal_df[i, :Up_Time], down = thermal_df[i, :Down_Time]),\n",
" must_run = false,\n",
" prime_mover_type = getproperty(PrimeMovers,Symbol(mover_dict[thermal_df[i, :Resource]])),\n",
" fuel = fuel_dict[string(thermal_df[i, :Fuel])],\n",
" fuel = getproperty(ThermalFuels, Symbol(fuel_dict[string(thermal_df[i, :Fuel])])),\n",
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

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

The nested function calls (getproperty, Symbol, string, indexing) make this expression difficult to read and error-prone. Consider extracting this logic into a helper function like get_thermal_fuel(fuel_name) that handles the string-to-enum conversion and provides clearer error messages if the fuel type is invalid or missing from the mapping.

Copilot uses AI. Check for mistakes.
@@ -859,7 +859,7 @@
" time_limits = (up = thermal_df_plc[i, :Up_Time], down = thermal_df_plc[i, :Down_Time]),\n",
" must_run = false,\n",
" prime_mover_type = getproperty(PrimeMovers,Symbol(mover_dict[thermal_df_plc[i, :Resource]])),\n",
" fuel = fuel_dict[string(thermal_df_plc[i, :Fuel])],\n",
" fuel = getproperty(ThermalFuels, Symbol(fuel_dict[string(thermal_df_plc[i, :Fuel])])),\n",
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

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

The nested function calls (getproperty, Symbol, string, indexing) make this expression difficult to read and error-prone. Consider extracting this logic into a helper function like get_thermal_fuel(fuel_name) that handles the string-to-enum conversion and provides clearer error messages if the fuel type is invalid or missing from the mapping.

Copilot uses AI. Check for mistakes.
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.

3 participants