Skip to content

Initial implementation of multi-contingency app#394

Open
PhilipFackler wants to merge 11 commits into
developfrom
PhilipFackler/multi-contingency
Open

Initial implementation of multi-contingency app#394
PhilipFackler wants to merge 11 commits into
developfrom
PhilipFackler/multi-contingency

Conversation

@PhilipFackler
Copy link
Copy Markdown
Collaborator

@PhilipFackler PhilipFackler commented May 6, 2026

Description

Refactored pdsim code as ContingencyStudy class and reused in initial implementation of concurrent contingency app.

Closes #392

Proposed changes

For the work-in-progress I implemented three different versions of the simulation for easy timing comparison.

  • serial
  • async (using std::async)
  • openmp

The easiest interesting case to try locally is "new england" (I have 22 cores in my laptop).

Checklist

  • All tests pass.
  • Code compiles cleanly with flags -Wall -Wpedantic -Wconversion -Wextra.
  • The new code follows GridKit™ style guidelines.
  • There are unit tests for the new code.
  • The new code is documented.
  • The feature branch is rebased with respect to the target branch.
  • I have updated CHANGELOG.md to reflect the changes in this PR. If this is a minor PR that is part of a larger fix already included in the file, state so.

@PhilipFackler PhilipFackler requested a review from pelesh May 6, 2026 20:44
@lukelowry
Copy link
Copy Markdown
Collaborator

'ContingencyStudy' -> 'CTGStudy'

CTG is common short hand and way easier to type! One option.

@PhilipFackler
Copy link
Copy Markdown
Collaborator Author

yes, I need feedback on naming things

@pelesh
Copy link
Copy Markdown
Collaborator

pelesh commented May 7, 2026

A few comments:

  • Great to have multiple execution options to compare performance!
  • I suggest restoring PDSim as it was. It is a different app and should not be modified in this PR.
  • I would contain implementation of ContingencyStudy to a single file or a source and a header file.
  • We have development of application utilities in our roadmap, but this is beyond the scope of this PR.

@PhilipFackler PhilipFackler force-pushed the PhilipFackler/multi-contingency branch from e30ce37 to 463644f Compare May 8, 2026 13:36
@PhilipFackler PhilipFackler marked this pull request as ready for review May 8, 2026 13:37
@PhilipFackler PhilipFackler force-pushed the PhilipFackler/multi-contingency branch from 463644f to e49c57f Compare May 8, 2026 13:40
Copy link
Copy Markdown
Collaborator

@nkoukpaizan nkoukpaizan left a comment

Choose a reason for hiding this comment

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

A couple of comments on this below. We'll also need to update the applications README when this is ready, to minimize users' confusion.

Comment thread application/PhasorDynamics/CMakeLists.txt Outdated
Comment thread application/PhasorDynamics/CMakeLists.txt Outdated
@nkoukpaizan nkoukpaizan added enhancement New feature or request new study New study or event capability labels May 15, 2026
@nkoukpaizan nkoukpaizan marked this pull request as draft May 15, 2026 20:21
@lukelowry
Copy link
Copy Markdown
Collaborator

Very excited for this! I think once we have this merged we should address the events-as-components modeling so we don't need to store a BusFault for each bus in the case.

Also, if possible, I'd like the *.study.json to have a "ida_stats" field for a file output string that would if passed calls the IDA api and writes out the IDA statistics (verbose extended version). I would use that ASAP with this + PDSIM

@PhilipFackler PhilipFackler marked this pull request as ready for review May 19, 2026 21:20
@PhilipFackler PhilipFackler force-pushed the PhilipFackler/multi-contingency branch 2 times, most recently from 0f37785 to a20100c Compare May 20, 2026 16:57
@nkoukpaizan nkoukpaizan mentioned this pull request May 20, 2026
4 tasks
Copy link
Copy Markdown
Collaborator

@pelesh pelesh left a comment

Choose a reason for hiding this comment

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

The new code needs to be better commented. The purpose of classes, structures and standalone functions implemented here needs to be better explained.

It is unclear what is the purpose of CTGStudy::run() function. This could be implemented within standalone function runStudy. I would suggest removing CTGStudy class altogether and moving utility functions for I/O processing to ContingencyUtilities.*pp file(s).

@PhilipFackler PhilipFackler force-pushed the PhilipFackler/multi-contingency branch from 8e4b968 to 631dc75 Compare May 21, 2026 16:55
@PhilipFackler PhilipFackler force-pushed the PhilipFackler/multi-contingency branch from 631dc75 to 89f8595 Compare May 21, 2026 17:07
@PhilipFackler PhilipFackler requested a review from pelesh May 21, 2026 17:07
Copy link
Copy Markdown
Collaborator

@nkoukpaizan nkoukpaizan left a comment

Choose a reason for hiding this comment

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

Almost there I well. I'm able to follow what's in ContigencyAnalysis.cpp, though more documentation (runStudy, runStudyAsync, etc.) is always welcome.

I would add an example that uses the ContingencyAnalysis executable that shows how this works and runs along with the other tests/examples.

Comment thread application/PhasorDynamics/CMakeLists.txt Outdated
@PhilipFackler PhilipFackler requested a review from nkoukpaizan May 22, 2026 14:39
Comment thread application/PhasorDynamics/CMakeLists.txt Outdated
Comment thread application/PhasorDynamics/CMakeLists.txt
Comment thread CMakeLists.txt Outdated
PhilipFackler and others added 3 commits May 22, 2026 11:45
Co-authored-by: Nicholson Koukpaizan <72402802+nkoukpaizan@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request new study New study or event capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add contingency analysis app for phasor domain dynamics

4 participants