Hello, ad 1) the most conservative approach would be that you compute a dispatch that will be secure in nominal case and in all contingency scenarios, however restrictive this might be. Considering N-1 security of line failures, you simple replicate all mismatch equations and line power flow limits of nominal case for each contingency with changes in grid connectivity - i.e, first build admittance matrices from mpc structure where a single branch is deleted from mpc.branch (representing your contingency) and then compute bus and branch power flows for each scenario and evaluate jacobian/hessian of constraints and objective function using these different admittance matrices (see https://github.com/goghino/matpower/blob/c8d084c46e85e843a08eb8929a25241254f58ca9/lib/ipoptscopf_solver.m#L281)

## Advertising

ad 2) I have implemented the approach described above, you can find the code in my fork of Matpower https://github.com/goghino/matpower. Simply run the SCOPF problem by specifying a list of branches that you want to cut and run the computation: mpc = loadcase('case9'); contingencies = [1:nbrch]; mpopt = mpoption('opf.ac.solver', 'IPOPT', 'verbose', 2); runscopf(mpc, contingencies, mpopt); There is an interface to MIPS and IPOPT solvers, but MIPS has troubles with converging to the solution since the problem is very ill-conditioned. I am currently investigating why the linear systems are so ill-conditioned. If you have any ideas why this ill-conditioning occurs let me know. Hope this helps. ========================== Juraj Kardos Advanced Computing Laboratory Institute of Computational Science Universita della Svizzera italiana Via Giuseppe Buffi 13 Lugano 6904 Switzerland http://www.ics.inf.usi.ch =========================== On 10 Aug 2017, at 22:37, Brandon Eidson <eids...@gmail.com<mailto:eids...@gmail.com>> wrote: List, I have been writing code to implement basic power/optimization calculations. I started with power flow, then DC power flow, then OPF. I have been using MATPOWER as a source of case systems and to check my results. I am in the process of implementing N-1 (in hopes of moving on to N-1-1). I need help on two fronts. 1) I am having trouble understanding the workflow/algorithm for these. Some appear to find violations for different contingencies and then stop. Others appear to use the violations and update the OPF constraints to pursue a new dispatch that will result in no violations in the base case and in as many as possible contingency cases. a) Are those broad descriptions of the workflow in the ballpark? b) Given the iterative/decomposed approach is correctly described above, what are the new constraints that are added to the OPF problem in order to find a new dispatch? I can't just keep adding "assume 0 flow on this branch that caused a violation" constraints. 2) If someone has non-propitiatory code that uses MATPOWER to calculate N-1 and/or N-1-1 SCOPF, I would appreciate that being passed along. I'm hoping to keep checking my code using reasonably tested code. I suppose this could also be a way of answer question 1b. Glad to be apart of this list, Brandon