I use the following lines to make the summation: line 36-38
for l_n=1:length(lineNo) % for all connected lines connected to node n
FP_n(n,t) = FP_n(n,t) + (-1)^dir(l_n) * FP(lineNo(l_n),t);
end
then I use the sumation in Lines 42 or 44:
Constraints = [Constraints, FP_n(n,t) + P(gen_index,t) == load_n(n)] ;
or Constraints = [Constraints, FP_n(n,t) == load_n(n)] ;
where, l_n is k of the equation, lineNo is a subset of K, gen_index is n if there, Load_n is L
so we can write this loop like:
for k =1: K_sub % for all connected lines connected to node n
FP_n(n,t) = FP_n(n,t) + (-1)^dir(l_n) * FP(k,t);
end
thank you, professor, for your help