-
Notifications
You must be signed in to change notification settings - Fork 0
Fix ThermalFuels type error in 3_Zones_simulation.ipynb #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: claude/review-example-cases-011CUoKzxvaPipTx9tf2MB4M
Are you sure you want to change the base?
Conversation
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"
There was a problem hiding this 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", | |||
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
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.
| @@ -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", | |||
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
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.
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:
This fixes the error: "type DataType has no field ThermalFuel"