How to run a while/for loop for a matpower case file?

8 vues (au cours des 30 derniers jours)
Mahbubur Rahman
Mahbubur Rahman le 20 Avr 2016
For the case9.m file on matpower I want to change the "Pd" (power) of a bus continuously (suppose 90:1:200), and see the results using the runpf fuction. I've tried several ideas but none of them is working. I did this one , but it is not changing the value in the case9.m file. What can I do?
mpc = loadcase(case9);
mpc.bus(5,3)
max_iter = 10;
for i =1:max_iter
mpc.bus(5,3) = mpc.bus(5,3) +5
runpf
end
  2 commentaires
per isakson
per isakson le 20 Avr 2016
Mahbubur Rahman
Mahbubur Rahman le 20 Avr 2016
Yes, right.

Connectez-vous pour commenter.

Réponses (1)

Ruchir Kemnaik
Ruchir Kemnaik le 10 Mai 2016
It is my understanding that you want to change the “Pd”(power) of a bus continuously and see the results using “runpf” function. However, when you change the power of the bus, you are not able to see the updated results.
Replace the “runpf” command inside the “for” loop with “runpf(mpc)” to display the updated results. The initial data in “mpc” struct variable comes from the hardcoded data in “case9.m” file. The changes made inside the “for” loop affects only the “mpc” struct variable which is in the current workspace. The values in “case9.m” are unchanged. So, when “runpf” is called without any input arguments, it reads the data from “case9.m” by default which is the reason the updated values are not displayed in the results.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by