Fix ramp parsing and GENRAMP indexing in TCOPFLOW#62
Open
willagrace wants to merge 3 commits into
Open
Conversation
hambrickjc
reviewed
Jul 2, 2026
pelesh
requested changes
Jul 6, 2026
pelesh
left a comment
Collaborator
There was a problem hiding this comment.
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 on lines
+1068
to
1069
| fuel_ramp_min = GENRAMPRATE_NG; | ||
| ps->ngenng++; |
Collaborator
There was a problem hiding this comment.
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 on lines
+1043
to
1045
| PetscScalar fuel_ramp_min; | ||
|
|
||
| /* Read generator fuel data */ |
Collaborator
There was a problem hiding this comment.
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; | ||
|
|
Collaborator
There was a problem hiding this comment.
The following code should be documented with comments in code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge request type
Relates to
This MR updates
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
PSBUSGetVariableLocationand 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 (startxpowlocandstartxpowlocglob), so each active generator gets its own correct ramp constraint and Jacobian entries.