Skip to content

Commit

Permalink
Fix ignoring contingencies when the from bus number is greater than t…
Browse files Browse the repository at this point in the history
…han to bus number (#70)

* Fix ignoring contingencies when the from bus number is greater than to bus #26

When the from bus number is greater than the to bus number for a branch, the
PS branch object stores it in the reverse order. This is done so that the
from bus number is always less than to bus number. The reason for doing this
is IPOPT complains for Hessian if this is not done. However, this was causing
the contingencies with from bus > to bus to be ignored.

* Apply pre-commmit fixes

* Update CMakeLists.txt

---------

Co-authored-by: abhyshr <abhyshr@users.noreply.github.com>
Co-authored-by: Cameron Rutherford <robert.rutherford@pnnl.gov>
  • Loading branch information
3 people authored Nov 21, 2023
1 parent 97e86c1 commit 25f749e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/ps/ps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,9 @@ PetscErrorCode PSGetLine(PS ps, PetscInt fbus, PetscInt tbus, const char *id,
ierr = PSBUSGetSupportingLines(bus, &nsupplines, &supplines);
CHKERRQ(ierr);
for (i = 0; i < nsupplines; i++) {
if (supplines[i]->fbus == fbus && supplines[i]->tbus == tbus) {
if ((supplines[i]->fbus == fbus && supplines[i]->tbus == tbus) ||
(supplines[i]->reversed_ends &
(supplines[i]->fbus == tbus && supplines[i]->tbus == fbus))) {
ierr = PetscStrcmp(id, supplines[i]->ckt, &flg);
CHKERRQ(ierr);
if (flg) {
Expand Down

0 comments on commit 25f749e

Please sign in to comment.