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

조회 수: 8 (최근 30일)
Mahbubur Rahman
Mahbubur Rahman 2016년 4월 20일
답변: Ruchir Kemnaik 2016년 5월 10일
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

답변 (1개)

Ruchir Kemnaik
Ruchir Kemnaik 2016년 5월 10일
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.

카테고리

Help CenterFile Exchange에서 Controller Creation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by