Skip to content

Fix ramp parsing and GENRAMP indexing in TCOPFLOW#62

Open
willagrace wants to merge 3 commits into
ORNL:developfrom
willagrace:willa/tcopf-bug-fix
Open

Fix ramp parsing and GENRAMP indexing in TCOPFLOW#62
willagrace wants to merge 3 commits into
ORNL:developfrom
willagrace:willa/tcopf-bug-fix

Conversation

@willagrace

@willagrace willagrace commented Jun 29, 2026

Copy link
Copy Markdown

Merge request type

  • New feature
  • Resolves bug
  • Documentation
  • Other

Relates to

  • OPFLOW
  • SOPFLOW
  • SCOPFLOW
  • TCOPFLOW
  • CMake build system
  • Spack configuration
  • Manual
  • Web docs
  • Other

This MR updates

  • Header files
  • Source code
  • CMake build system
  • Spack configuration
  • Web docs
  • Manual
  • Other

Summary

This PR fixes two ramp related issues in TCOPFLOW.

Issue 1 (psreaddata.cpp):
Previously, generator ramp values were overwritten by fuel type defaults in TCOPFLOW. The updated logic only applies fuel-based default ramp rates when the corresponding MATPOWER ramp-rate value is unspecified.

Issue 2 (genramp.cpp):
Previously, some generators were not actually constrained by TCOPFLOW ramp-coupling constraints.
The previous implementation computed generator Pg locations by using PSBUSGetVariableLocation and adding 2 to the index to skip Va and Vm. This approach worked on the first generator, but failed otherwise. The fix uses each generator's stored active-power locations directly (startxpowloc and startxpowlocglob), so each active generator gets its own correct ramp constraint and Jacobian entries.

@willagrace willagrace changed the title Preserve MATPOWER generator ramp rates Fix ramp parsing and GENRAMP indexing in TCOPFLOW Jun 30, 2026
Comment thread src/ps/psreaddata.cpp Outdated

@pelesh pelesh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not scaling ramp rates by the generator MVA base may be a bug.

The code needs to be documented better. Please insert comments describing what the code does (or what is the intention behind the code).

Comment thread src/ps/psreaddata.cpp
Comment on lines +1068 to 1069
fuel_ramp_min = GENRAMPRATE_NG;
ps->ngenng++;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why is this

        fuel_ramp_min = GENRAMPRATE_NG;

and not

        fuel_ramp_min = GENRAMPRATE_NG / ps->MVAbase;

?

What are the units of GENRAMPRATE_NG?

Same applies to other fuel types for generators.

Comment thread src/ps/psreaddata.cpp
Comment on lines +1043 to 1045
PetscScalar fuel_ramp_min;

/* Read generator fuel data */

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This code block and the logic inside it should be explained in more detail in code comments.

Comment on lines 283 to +287
if (tcopflow->nconineqcoup[i]) {
ctr = 0;
ps = opflow->ps;
pstpre = opflowtpre->ps;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The following code should be documented with comments in code.

@pelesh pelesh added bug Something isn't working tcopflow Related to multiperiod optimal power flow. labels Jul 6, 2026
@pelesh pelesh added this to the Release 2.1 milestone Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working tcopflow Related to multiperiod optimal power flow.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants