Skip to content

Conversation

@wperkins
Copy link
Collaborator

@wperkins wperkins commented Dec 28, 2023

Merge request type

  • New feature

Relates to

  • SOPFLOW

This MR updates

  • Header files
  • Source code
  • Manual
  • Other

Summary

This PR makes SOPFLOW understand contingencies in PSS/E format. Like SCOPFLOW, the contingency file format is determined by the file extension: .con indicates PSSE, .cont is the ExaGO NATIVE (PTI) format.

Closes #107.

@wperkins wperkins added enhancement New feature or request sopflow Concerning the SOPFLOW application labels Dec 28, 2023
@wperkins wperkins added this to the 1.6.2 Release milestone Dec 28, 2023
@wperkins wperkins self-assigned this Dec 28, 2023
@wperkins wperkins changed the title Feature/sopflow psse contingency SOPFLOW able to read contingencies in PSS/E format Dec 28, 2023
@wperkins
Copy link
Collaborator Author

@cameronrutherford, in this PR I've added a utility script. I did not see an appropriate place to put it, so made a new directory, scripts, and put it there. Is this a precedent that should be set?

@wperkins wperkins marked this pull request as ready for review December 28, 2023 16:33
@wperkins
Copy link
Collaborator Author

The Python script I've added converts ExaGO/PTI contingency format files to PSS/E format. This was used to generate input to PowerWorld from ExaGO cases. The script should be modified, or another script added, to go the other way. At this time, I don't have time to do that.

@cameronrutherford cameronrutherford force-pushed the feature/sopflow-psse-contingency branch from a68de7c to 900f502 Compare January 16, 2024 18:01
@cameronrutherford
Copy link
Collaborator

@abhyshr there are conflicts with the user manual that don't allow an auto-rebase, but with a re-review and perhaps some more documentation to explain the scripts added this is good to merge.

@cameronrutherford cameronrutherford removed their request for review March 10, 2025 02:04
@pelesh pelesh requested a review from hambrickjc November 20, 2025 21:32
@pelesh pelesh requested review from PhilipFackler and maksud and removed request for hambrickjc December 9, 2025 19:58
@pelesh pelesh assigned hambrickjc and unassigned wperkins Dec 9, 2025
@maksud
Copy link
Collaborator

maksud commented Dec 11, 2025

Was able to build python library using python version 3.12 and version 3.13 does not work.

Ran python contingency_psse_native.py ../datafiles/case9/case9.con which converts case9.con file (PSS/E format) to NATIVE format.

Output:

1,2,0,4,5,'1 ',1,0,0.01
2,2,0,4,6,'1 ',1,0,0.01
3,2,0,5,7,'1 ',1,0,0.01
4,2,0,6,9,'1 ',1,0,0.01
5,2,0,7,8,'1 ',1,0,0.01
6,2,0,8,9,'1 ',1,0,0.01
7,1,1,0,0,'1 ',1,0,0.01
8,1,2,0,0,'1 ',1,0,0.01
9,1,3,0,0,'1 ',1,0,0.01

Ran python contingency_native_psse.py ../datafiles/case9/case9.cont which converts case9.cont (in NATIVE format) to PSS/E format

Output:

CONTINGENCY L_4-5_1_1
OPEN BRANCH FROM BUS 4 TO BUS 5 CIRCUIT 1
END
CONTINGENCY L_4-6_1_2
OPEN BRANCH FROM BUS 4 TO BUS 6 CIRCUIT 1
END
CONTINGENCY L_5-7_1_3
OPEN BRANCH FROM BUS 5 TO BUS 7 CIRCUIT 1
END
CONTINGENCY L_6-9_1_4
OPEN BRANCH FROM BUS 6 TO BUS 9 CIRCUIT 1
END
CONTINGENCY L_7-8_1_5
OPEN BRANCH FROM BUS 7 TO BUS 8 CIRCUIT 1
END
CONTINGENCY L_8-9_1_6
OPEN BRANCH FROM BUS 8 TO BUS 9 CIRCUIT 1
END
CONTINGENCY G_7_1_1
REMOVE UNIT 1 FROM BUS 1
END
CONTINGENCY L_1-4_1_7
OPEN BRANCH FROM BUS 1 TO BUS 4 CIRCUIT 1
END
CONTINGENCY G_8_1_2
REMOVE UNIT 1 FROM BUS 2
END
CONTINGENCY L_2-7_1_8
OPEN BRANCH FROM BUS 2 TO BUS 7 CIRCUIT 1
END
CONTINGENCY G_9_1_3
REMOVE UNIT 1 FROM BUS 3
END
CONTINGENCY L_3-9_1_9
OPEN BRANCH FROM BUS 3 TO BUS 9 CIRCUIT 1
END

maksud
maksud previously approved these changes Dec 11, 2025
Copy link
Collaborator

@maksud maksud left a comment

Choose a reason for hiding this comment

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

With the minor modification as posted as comments. Also add a note that it works for Python 3.12 as of now.

sys.stderr.write("%s: %s: error: cannot open\n" % (program, inputfile))
exit(2)
else:
fd = sys.stdin
Copy link
Collaborator

Choose a reason for hiding this comment

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

The python script is waiting for input filename but no indication or console out is provided to let the user know whether the script is working or waiting for user input. Suggesting print usage and return

sys.stderr.write("%s: %s: error: cannot open\n" % (program, inputfile))
exit(2)
else:
fd = sys.stdin
Copy link
Collaborator

Choose a reason for hiding this comment

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

The python script is waiting for input filename but no indication or console output is provided to let the user know whether the script is working or waiting for user input. Suggesting print usage and return

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request sopflow Concerning the SOPFLOW application

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SOPFLOW able to read PSS/E contingencies

5 participants