# Electronic – Equations of Power Flow Between Buses

power-flow-analysis

I'm working in a MATLAB algorithm to compute the state estimation of a power system given some measures. The classical method computes a Jacobian matrix of all the measures, so I have to program all the derivatives of all types of measures. The problem lies in the equations of the power flow between buses. I've searched several books and papers and I've found two distinct sets of equations (\$P_{ij}\$ and \$Q_{ij}\$ are the real and reactive power flow from node \$i\$ to node \$j\$, respectively):
$$P_{ij} = \left| {V_i } \right|^2 G_{ij} – \left| {V_i } \right|\left| {V_j } \right|\left( {G_{ij} \cos \delta _{ij} + B_{ij} \sin \delta _{ij} } \right)$$
$$Q_{ij} = – \left| {V_i } \right|^2 B_{ij} – \left| {V_i } \right|\left| {V_j } \right|\left( {G_{ij} \sin \delta _{ij} – B_{ij} \cos \delta _{ij} } \right)$$
Where \$V_i\$ and \$V_j\$ are the complex voltages of buses \$i\$ and \$j\$. \$G_{ij}\$ and \$B_{ij}\$ are the real and imaginary parts of \$Y_{ij}\$, the \$ij\$ element of the admitance matrix of the system. And \$\delta_{ij}\$ is the angle difference betwwen \$V_i\$ and \$V_j\$. These two equations are derived from the book of Abur and Expósito (2004), neglecting the lines' shunt admitance. However, from the paper of Larson, Tinney and Peschon (1970), the resulting equations are:
$$P_{ij} = -\left| {V_i } \right|^2 G_{ij} + \left| {V_i } \right|\left| {V_j } \right|\left( {G_{ij} \cos \delta _{ij} + B_{ij} \sin \delta _{ij} } \right)$$
$$Q_{ij} = \left| {V_i } \right|^2 B_{ij} + \left| {V_i } \right|\left| {V_j } \right|\left( {G_{ij} \sin \delta _{ij} – B_{ij} \cos \delta _{ij} } \right)$$
There are other documents that present either the first or the second set of equations, and I'm really bewildered, I absolutely don't know which set I must use. Can someone explain to me the reason of this discrepancy, and which is the correct set of equations? My most sincere thanks to whoever answers me.