Hi,
I’m currently working on a project in which I use the PowerModels package.
In the first part of my project, I used the ‘solve_opf’ function with the different models of quadratic relaxations implemented in the package.
Now, I would like to run security-constrained ac-opf and more specifically apply the N-1 criterion to my test systems. I have had a look at the PowerModelsSecurityConstrained.jl package and from this, I think the more efficient solution is to use the multinetwork feature to be able to link some variables of the intact system and some of the outaged system.

Have anyone already created some example code to create a constraint linking variables from two different PowerModels ‘network’ ? Or do you have any suggestions or examples of security constrained ac-opf model using PowerModels.jl ?

Hi @lcharles, thanks for posting your question and sorry for the delay in responding.

You are on the right track, the intended solution for SCOPF is to use the multi-network feature to build additional networks for the first and second stage problems and then link them together. PowerModelsSecurityConstrained.jl provides such examples. For examples you can check out this file,

Reviewing the source code of PowerModelsSecurityConstrained provides several examples for how to do this.

Hi @ccoffrin, and thank you for all of the great work with the power flow models. A few questions that I have are:

If the goal is to run an SCUC, how does using the PowerModelsSecurityConstrained.jl differ from using the multi-network function within PowerModels.jl (with the different networks representing a different topology, N-1 contingency)?

How does one extract the transmission constraint shadow prices from the PowerModelsSecurityConstrained.jl? The PowerModels.jl solve_c1_opf produces a mu_sm_fr (and _to) along with the lam_kcpl_r (and q) values. I did not see transmission dual values within the PowerModelsSecurityConstrained.jl package.

The goal with the SCUC would be to optimize for the list of N-1 contingencies simultaneously. It appears the multi-network function in PowerModels,jl solves each network independently, so I get dual values for buses and branches for each network, correct?

Currently the workflow that I have come up with is: solve an ac OPF using PowerModels.jl (without transmission constraints) to get a good starting point for the generation. Then I want to use the output of that initial stage to come up with a contingency list using an LODF matrix. The goal is to filter out most of the contingencies. In actuality I would like to find the top overload per contingency and monitor a grouping of pairs (monitored element, contingency element). Then add those pairs to the OPF and solve.

Any answers to the questions and/or feedback would be greatly appreciated as I am stuck on how exactly to include the N-1 contingencies.

Hi @bdschust18, welcome to the forum and thanks for your interest in PowerModels.

This is an astute observation. If you look at how PMSC is built the default is to use multi-networks for many of the formulations. There are some more sophisticated and heuristic methods in there too, but the baseline implementations are based on multi-networks. This package is a good example for how to use the multi-network feature for setting up such problems.

The usual way to do this is to request that duals be reported in the solution like this, PowerModels.jl/test/output.jl at master · lanl-ansi/PowerModels.jl · GitHub I have not tested this feature in the PMSC code, so not sure how good the support is in that package. It is a pretty easy feature to add if you needed it.

Multi-network models build one BIG JuMP model where everything is solved simultaneously. This is not the most scalable approach but works for small problems. You should be able to get all of the dual values for all of the networks, once the solve is complete.

Building the LODF here seems like overkill to me. You can run a DC power flow for each contingency and then check for violated branch flow constraints to do the contingency filtering. You can also run each contingency in parallel, to make use of the multiple cores on modern CPUs.