The latest development version of MATPOWER on GitHub
<https://github.com/MATPOWER/matpower/> include the ability to add arbitrary
nonlinear user-defined constraints. You should be able to implement your risk
constraint this way. See Sections 6.3 and Chapter 7, especially Section 7.1.2,
in the latest User’s Manual
<https://www.dropbox.com/s/3qkji1cuyi075uj/MATPOWER-manual.pdf?dl=0> for more
detail.
Ray
> On Sep 1, 2018, at 7:52 AM, Emir Ćosić <[email protected]> wrote:
>
> Dear All,
>
> i run this code to calculate risk in system:
> define_constants;
> mpc = loadcase(case24_ieee_rts);
> risk=0;
> clc;
> result=runopf(mpc);
>
> %calculation of percentage of line flow on each of 38 lines
>
> for i=1:38
>
> lineflow(i)=sqrt((result.branch(i,PF))*(result.branch(i,PF))+(result.branch(i,QF))*(result.branch(i,QF)))/mpc.branch(i,RATE_A);
> end
> lineflow;
>
> %formulation of risk calculation
> for i=1:38
> if (lineflow(i)>0.7 && lineflow(i)<1)
> risk=risk+1.667*lineflow(i)-1.167;
> end
> if (lineflow(i)>=1)
> risk=risk+2.5*lineflow(i)-2;
> end
> end
> risk=risk*0.003;
> risk
>
> and as a result i get that the system risk is risk=0.0013
>
> Is there any way to include calculation of risk in OPF as a constrain, in a
> way that value of risk must be risk<0.001.
>
> Thank you in advance for your help.
> Emir
>