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
  2 件のコメント
per isakson
per isakson 2016 年 4 月 20 日
Mahbubur Rahman
Mahbubur Rahman 2016 年 4 月 20 日
Yes, right.

サインインしてコメントする。

回答 (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 Center および File ExchangeSimulation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by