I have a power grid with N buses and L lines; each line is between specific nodes. o(l) for the origin bus of line l and d(l) for the destination bus of line l. I want to get a power flow and know what power is in each line and in what direction. How can I create the following constraint? this constraint shows that the power balance in each node preserves the power balance at bus n such that the inflow and outflow are equal.
note: IEEE one-area RTS-1996 system known as 'case24_ieee_rts' in Matpower
Indices and sets:
N: set of indices of buses, indexed by n
J: set of indices of generators, indexed by j
Jn: set of indices of generators connected to bus n
L: set of indices of transmission assets, indexed by l
o(l): origin bus of line l
d(l): destination bus of line l
Parameters:
Dn ; demand at bus n (in megawatts)
Decision variables:
gj : generation level of generator j (in megawatts)
pl: power flow on line l (in megawatts)
dn : load shed at node n (in megawatts)