Dear all, I am trying to add the following simple constraints by direct specification.
0 <= Pg1 + Pg3 + Pg5 + Pg7 + ...... + Pg299 <= 700000 To do so, I added the following statements. (The number of buses are 100. The number of generators are 300. Therefore, the number of generators at some buses are between 10 to 20.) %---------------------------------------------------- A_Va = sparse(1, 100); % number of buses are 100 A_Vm = sparse(1, 100); % number of buses are 100 A_Pg = sparse([ 1 0 1 0 1 0 1 0 1 0 1 0 1 0 ... 0 1 0 1 0 ] ); % number of generators are 300 A_Qg = sparse(1, 300); % number of generators are 300 mpc1.A = [A_Va A_Vm A_Pg A_Qg]; mpc1.l = [0]; mpc1.u = [700000]; mpopt = mpoption('opf.ac.solver','KNITRO','out.branch', 0, 'out.lim.all', 0, 'out.sys_sum', 0, 'out.gen', 1); [results, success]=runopf(mpc1, mpopt); %---------------------------------------------------- Actually, AC-OPF calculations can be performed successfully. However, by checking the total output of odd-number generators in simulation results, the added constraints are not effective. The total output of odd-number generators is more than 700000. Would you please help me in this aspect. Kind Regards, Teiji