Skip to content

Pablo/updates#25

Open
PabloBotinGP wants to merge 65 commits into
NLR-Sienna:mainfrom
PabloBotinGP:pablo/updates
Open

Pablo/updates#25
PabloBotinGP wants to merge 65 commits into
NLR-Sienna:mainfrom
PabloBotinGP:pablo/updates

Conversation

@PabloBotinGP

Copy link
Copy Markdown

Forked out from Annas repo and work advanced by Pablo during the last couple weeks, adapting repo to psy5.
build_system_script works
copper_singlestage works
copper_multistage has some feasibility issues

annacasavant and others added 30 commits May 16, 2025 13:29
…red fields

Previously, make_new_bus called the ACBus kwargs constructor without
`available`, which in psy5 caused
`UndefKeywordError(:available)` while calling `add_line!()`. This commit adds `available=true`
and ensures other required fields are set correctly.

Note: add_line! still fails later due to another bug
Problem:
- New buses did not inherit base_voltage from existing endpoints.
- When both ends were new, defaults used bus_data[3] (area code) instead of intended bus_data[1] (kV).

Solution:
- Inherit base_voltage from the existing endpoint when present.
- When both new, use bus_data[1] as the default (kV).
- Mirror the inheritance logic in add_transformer!.
- Add logging for inheritance and conflict cases.
…match handling

- Set base_voltage from line definition (new_arc[1]) for all new buses
- Remove redundant voltage mismatch detection and correction logic
…tibility

- Added base_power argument to TapTransformer calls due to new struct requirements in beta PowerSystems.jl
- Set base_power = system_base_power and rating = 2000.0/system_base_power to preserve original 2000 MVA specification
- Convert rating to per-unit as required by new API
- Implementation may need revision pending clarification from PS.jl developers on base_power vs rating semantics
…ut SCED data

Fixed critical UndefVarError bug in system_build_functions.jl where the
make_thermal_gen() function referenced undefined variable 'gen' instead
of the correct parameter name 'original_gen'. This bug affected all
steam turbines and generators without SCED market data, causing failures
hours into production runs.

Changes:
- Fixed lines 860 & 863 in system_build_functions.jl to use 'original_gen'
Fixed UndefVarError in get_mean_quadratic_model() and
get_median_quadratic_model() where JuMP model variable 'm' was created
inside try-catch block but used outside of it.

When Xpress optimizer failed to instantiate, the error was caught and
rethrown, but if an outer handler caught it, execution continued to
code that referenced the undefined 'm' variable.

Changes:
- Added 'local m' declaration in function scope
- Moved set_optimizer_attribute() calls inside try blocks
- Ensures 'm' is only used after successful creation
- Import DataStructures.SortedDict in make_day_ahead_data.jl
- Replace Dict with SortedDict for scenario forecast data
- PowerSystems requires chronologically ordered time series
- Fixes both 31-scenario and 84-scenario system construction
- Document bug in BUGS.md as Error NLR-Sienna#4
PabloBotinGP and others added 30 commits October 16, 2025 13:09
PROBLEM:
--------
Hour-ahead (HA) and real-time (RT) time series data were embedded in System
objects (.json + .h5) created with an older PowerSystems.jl version.

SOLUTION:
---------
Extracted time series from old systems and saved as individual H5 files, then
adapted scripts to read directly from H5 files instead of loading old System
objects.

Related: Error NLR-Sienna#7 in dev/BUGS.md
PowerSystems.jl API changed the argument order for get_components() when
using a filter function. Updated to correct signature.

Related: Error NLR-Sienna#8 in dev/BUGS.md
- Fixed: Changed  to  in make_real_time_data.jl (3 occurrences)
- Fixed: Changed HA output from jsons/HA_sys.json to HA_sys.json for consistency
…oid infeasible UC

Override incorrect min==max active-power limits coming from original TAMU data by forcing every HydroDispatch component's active_power_limits.min to 0.0 on system load.
Implemented as a short-term mitigation in copper_singlestage_sim.jl.
Prevents unit‑commitment infeasibilities caused by bad input limits while investigation/fix is applied upstream.
Next steps (choose one)

A) Fix the original TAMU MATPOWER data so hydro generator limits are correct (recommended, permanent fix).
B) Or, apply the same override immediately after loading the original TAMU system (e.g., right after sys = System(TAMU_matpower_file) in build_system_script.jl) so all downstream serialized snapshots inherit corrected limits.
PROBLEM:
- Original TAMU/ACTIVSg2000 MATPOWER data contains HydroDispatch generators
  with incorrect minimum active power limits (min==max or min!=0)
- This caused infeasibility in Unit Commitment optimization
- Previous workaround: manually set limits to zero in copper_singlestage_sim.jl
  after loading the system

SOLUTION:
1. Corrected all HydroDispatch min active power limits to 0.0 on the datafile.
   - Saved corrected system as ACTIVSg2000.json (PowerSystems native format)

2. Updated file_pointers.jl:
   - Changed TAMU_matpower_file from .m to .json extension

3. Commented out provisional fix in copper_singlestage_sim.jl:
   - Lines 31-42 now commented out (HydroDispatch limit fix loop)
   - No longer needed since data is corrected at source
- Add fix_hydro_dispatch_limits!() function to system_build_functions.jl
- Integrate hydro limits fix into build_system_script.jl at system initialization
- Remove redundant hydro fix code from copper_singlestage_sim.jl

This resolves UC infeasibility issues caused by HydroDispatch components having
min==max active power limits from the original TAMU data. The fix is now applied
automatically during system building without modifying any datafile.
- Remove erroneous include(add_services.jl)
- add_services.jl attempts to load intermediate_sys.json which doesn't exist
- Script already correctly loads intermediate_sys_w_services.json, which already exists

This resolves the No such file or directory error when trying to load
intermediate_sys.json during hour-ahead data generation.
…power so I removed its definitions. Leaving the original command for reference
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