Reputation: 1
I am using MATPOWER for optimal power flow of IEEE30 bus system. I am changing the real power generation of a particular bus 12 times and want to save the result 12 times also. But while doing so only the result of last run is saved in the result struct. The code is given:
P=xlsread('C:\Users\User\Documents\MATLAB\output\sp.xlsx');
for h=1:12
P(h);
**mpc.gen(NG,PG)=P(h);**
mpopt = mpoption('pf.alg', 'NR', 'verbose', 1, 'out.all', 0);
results= runopf(mpc,mpopt);
end
Upvotes: 0
Views: 502
Reputation: 323
You could store the result struct you get from each opf run in a struct array like so:
for h=1:12
P(h);
**mpc.gen(NG,PG)=P(h);**
mpopt = mpoption('pf.alg', 'NR', 'verbose', 1, 'out.all', 0);
results(h) = runopf(mpc,mpopt);
end
Adressing results should then be possible by calling e.g. results(3).branch
or whatever you want to evaluate.
Upvotes: 0