Calculating the branch current

I need some help in calculating the branch current flows using the PowerModels package, and matpower casses.

Please be more specific with your question and show us what you have tried so far with minimal example code.

Hi) Thanks for replying, I am running an AC-OPF, with one additional constraint,

@NLconstraint(m, Il[i in Nodes, j in Nodes; abs(Y_bus[i,j])>0 && i!=j], (G[i,j]^2+B[i,j]^2)*(v[i]^2+v[j]^2 -4*(v[i]*v[j])) <= s[i,j]*(Y_busnew[i,j]^2 * v[i]^2)+k*(1-s[i,j]))

Here, s[i,j] is the variable between 0 and 1, here I am trying to relax the line, my goal is to get the line with the minimum value of “s”. And the factor “k”, I defined it as a bigger number. My problem is, I need to remove this Y_busnew[i,j]^2 * v[i]^2 with the branch current derived from power flow equations may be.

Hi @priod, the first thing to clarify if you want to compute the branch current after the optimization is complete or if you want to change the model to optimize the current.

In the former case, the solution that is returned by run_ac_opf already has the branch power values in it, you just need to do a little computation to convert those into current values.

In the later case, you need to modify the AC-OPF optimization model that is being solved. The simplest solution there is start with one of these models from PowerModelsAnnex,

and adapt it to your own needs.