Did you add a row to gencost when you added a row to gen?
If they don’t have the same number of rows, that’s what’s causing the error.
Ray
On Feb 26, 2023, at 10:05 PM, naime ahmadi <[email protected]> wrote:
Dear Mr. Hosseini,
I appreciate your guidance on changing the bus type of bus 5 from "PQ" to "PV".
However, after implementing the code you provided, I could not observe any
difference between 'result' and 'result1'.
I think there is another modification required to change the generator capacity
and voltage setpoint for the PV bus. I have attempted to implement this change
but encountered the same error.
mpc = loadcase('case14')
pv_bus = 5;
load_5 = sum(mpc.bus(mpc.bus(:,1)==pv_bus, 3));
pv_capacity = load_5 * 1.2; % Assume 120% of the load is covered by the PV
system
mpc = loadcase('case14');
mpc.bus(pv_bus, 2) = 2; % Change the bus type of bus 5 to "PV"
mpc.gen(end+1, :) = [5, 0, 0, 0, 0, 1, 100, 1, pv_capacity, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0]; % Add PV systemmpc.gencost(end+1, :) = [2, 0, 0, 3, 0, 0,
0]; % Specify the generator cost coefficients
result = runopf(mpc);
Kind regards,
Naime
On Mon, Feb 27, 2023 at 4:47 AM amir ali Hosseini
<[email protected]<mailto:[email protected]>> wrote:
hi
i think use table
<image.png>
clc
mpc = loadcase('case14');
result = runopf(mpc)
mpc_bus = mpc.bus; "
OutmailID: 127191118, List: 'matpower-l', MemberID: 82861091
SCRIPT: "show mpc.bus
type_bus_5 = mpc.bus(5,7);"
TCL MERGE ERROR ( 03/07/2023 14:35:46 ): "invalid command name "show" show type
of mpc.bus
mpc.bus(5,7) = 2;"
OutmailID: 127191118, List: 'matpower-l', MemberID: 82861091
SCRIPT: "change type of mpc.bus
mpc_bus = mpc.bus;% show change type of bus ( but is not enough ,you mast
change other element of buses too)
result_1 = runopf(mpc)
In the written example, I tried to show the changes step by step. If you
remove ";" at the end of each line, the command window will change the bass
from type 1 to type 2. But in the same way, the voltage and power values should
be changed according to the problem.
On Sun, Feb 26, 2023 at 7:18 PM naime ahmadi
<[email protected]<mailto:[email protected]>> wrote:
Hello,
I want to add PV to bus 5 in the 14 bus system.
I used the code below
pv_bus = 5;
load_5 = sum(mpc.bus(mpc.bus(:,1)==pv_bus, 3));
pv_capacity = load_5 * 1.2; mpc.bus(mpc.bus(:,1)==pv_bus, 3) = 0;
in the generator data, I added this row
5 0 0 0 0 1 100 1 pv_capacity 0 0 0 0 0 0 0 0 0 0 0 0; % Add PV system
I made the file 'case_New' and when I run
results = runpf(case14_with_renewable);
I got this error:
Index in position 1 exceeds array bounds. Index must not exceed 5.
Error in get_reorder (line 29)
B = subsref(A, s);
Error in e2i_data (line 73)
v = get_reorder(val, b+(1:n), dim);
Error in e2i_field (line 52)
mpc.(field) = e2i_data(mpc, mpc.(field), ordering, dim);
Error in ext2int (line 193)
mpc = e2i_field(mpc, 'gencost', ordering);
Error in runpf (line 109)
mpc = ext2int(mpc);
Do you know how I can add PV to case 14 in Matpower?
Thank you,
Naime
--_000_1E502937A34A46948C54107228CE56B0cornelledu_ Content-Type: text/html;
charset="utf-8" Content-ID:
<[email protected]>
Content-Transfer-Encoding: base64 <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break:
after-white-space;">
Did you add a row to <font face="Courier New">gencost</font> when you added a
row to
<font face="Courier New">gen</font>?
<div><br>
</div>
<div>If they don’t have the same number of rows, that’s what’s causing the
error.</div>
<div><br>
</div>
<div> Ray</div>
<div><br>
<div><br>
<blockquote type="cite">
<div>On Feb 26, 2023, at 10:05 PM, naime ahmadi <[email protected]>
wrote:</div>
<br class="Apple-interchange-newline">
<div>
<div dir="ltr">
<div>Dear Mr. Hosseini, <br>
</div>
<p>I appreciate your guidance on changing the bus type of bus 5 from
"PQ" to "PV". However, after implementing the code you
provided, I could not observe any difference between 'result' and 'result1'.</p>
<p>I think there is another modification required to change the generator
capacity and voltage setpoint for the PV bus. I have attempted to implement
this change but encountered the same error.</p>
<div class="gmail-rtcContent" style="padding:30px">
<div class="gmail-lineNode"
style="font-size:14pt;font-family:Menlo,Monaco,Consolas,"Courier
New",monospace;font-style:normal;font-weight:normal">
<span style="white-space:pre"><span>mpc = loadcase(</span><span
style="color:rgb(167,9,245)">'case14'</span><span>)</span></span></div>
<div class="gmail-lineNode"
style="font-size:14pt;font-family:Menlo,Monaco,Consolas,"Courier
New",monospace;font-style:normal;font-weight:normal">
</div>
<div class="gmail-lineNode"
style="font-size:14pt;font-family:Menlo,Monaco,Consolas,"Courier
New",monospace;font-style:normal;font-weight:normal">
<span style="white-space:pre"><span>pv_bus = 5;</span></span></div>
<div class="gmail-lineNode"
style="font-size:14pt;font-family:Menlo,Monaco,Consolas,"Courier
New",monospace;font-style:normal;font-weight:normal">
<span style="white-space:pre"><span>load_5 = sum(mpc.bus(mpc.bus(:,1)==pv_bus,
3));</span></span></div>
<div class="gmail-lineNode"
style="font-size:14pt;font-family:Menlo,Monaco,Consolas,"Courier
New",monospace;font-style:normal;font-weight:normal">
<span style="white-space:pre"><span>pv_capacity = load_5 * 1.2; </span><span
style="color:rgb(0,128,19)">% Assume 120% of the load is covered by the PV
system</span></span></div>
<div class="gmail-lineNode"
style="font-size:14pt;font-family:Menlo,Monaco,Consolas,"Courier
New",monospace;font-style:normal;font-weight:normal">
<span style="white-space:pre"><span>mpc = loadcase(</span><span
style="color:rgb(167,9,245)">'case14'</span><span>);</span></span></div>
<div class="gmail-lineNode"
style="font-size:14pt;font-family:Menlo,Monaco,Consolas,"Courier
New",monospace;font-style:normal;font-weight:normal">
<span style="white-space:pre"><span>mpc.bus(pv_bus, 2) = 2; </span><span
style="color:rgb(0,128,19)">% Change the bus type of bus 5 to
"PV"</span></span></div>
<div class="gmail-lineNode"
style="font-size:14pt;font-family:Menlo,Monaco,Consolas,"Courier
New",monospace;font-style:normal;font-weight:normal">
<span style="white-space:pre"><span>mpc.gen(end+1, :) = [5, 0, 0, 0, 0, 1,
100, 1, pv_capacity, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
</span><span style="color:rgb(0,128,19)">% Add PV systemmpc.gencost(end+1, :)
= [2, 0, 0, 3, 0, 0, 0]; % Specify the generator cost
coefficients</span></span></div>
<div class="gmail-lineNode"
style="font-size:14pt;font-family:Menlo,Monaco,Consolas,"Courier
New",monospace;font-style:normal;font-weight:normal">
<span style="white-space:pre"><span>result = runopf(mpc);</span></span></div>
</div>
<p>Kind regards,</p>
<p>Naime</p>
<div class="gmail-rtcContent" style="padding:30px">
<div class="gmail-lineNode"
style="font-size:14pt;font-family:Menlo,Monaco,Consolas,"Courier
New",monospace;font-style:normal;font-weight:normal">
<span style="white-space:pre"><span><br>
</span></span></div>
<div class="gmail-lineNode"
style="font-size:14pt;font-family:Menlo,Monaco,Consolas,"Courier
New",monospace;font-style:normal;font-weight:normal">
<span style="white-space:pre"><span></span></span></div>
</div>
<div><br class="webkit-block-placeholder">
</div>
<br>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<br>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Mon, Feb 27, 2023 at 4:47 AM amir ali
Hosseini <<a
href="mailto:[email protected]">[email protected]</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">hi
<div>i think use table </div>
<div><span id="cid:ii_lels6umw0"><image.png></span><br>
</div>
<div>clc<br>
mpc = loadcase('case14');<br>
result = runopf(mpc)<br>
mpc_bus = mpc.bus;"
TCL MERGE ERROR ( 03/07/2023 14:35:46 ): "extra characters after
close-quoteshow mpc.bus<br>
type_bus_5 = mpc.bus(5,7);%% show type of mpc.bus<br>
mpc.bus(5,7) = 2;%% change type of mpc.bus<br>
mpc_bus = mpc.bus;% show change type of bus ( but is not enough ,you mast
change other element of buses too)<br>
result_1 = runopf(mpc)<br>
</div>
<div dir="rtl"><br>
</div>
<div dir="rtl" style="text-align:left">In the written example, I tried to show
the changes step by step. If you remove ";" at the end of each line,
the command window will change the bass from type 1 to type 2. But in the same
way, the voltage and power values
should be changed according to the problem.<br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Sun, Feb 26, 2023 at 7:18 PM naime ahmadi
<<a href="mailto:[email protected]"
target="_blank">[email protected]</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px
solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div>Hello,<br>
</div>
<div>I want to add PV to bus 5 in the 14 bus system.</div>
<div>I used the code below</div>
<div>pv_bus = 5;</div>
<div>load_5 = sum(mpc.bus(mpc.bus(:,1)==pv_bus, 3)); <br>
</div>
<div>pv_capacity = load_5 * 1.2; mpc.bus(mpc.bus(:,1)==pv_bus, 3) = 0; <br>
</div>
<div>in the generator data, I added this row</div>
<div> 5 0 0 0 0 1 100 1 pv_capacity 0 0 0 0 0 0 0 0 0 0 0 0; % Add PV
system</div>
<div>I made the file 'case_New' and when I run <br>
</div>
<div>results = runpf(case14_with_renewable);</div>
<div>I got this error:</div>
<div>Index in position 1 exceeds array bounds. Index must not exceed 5.<br>
<br>
Error in get_reorder (line 29)<br>
B = subsref(A, s);<br>
<br>
Error in e2i_data (line 73)<br>
v = get_reorder(val, b+(1:n), dim);<br>
<br>
Error in e2i_field (line 52)<br>
mpc.(field) = e2i_data(mpc, mpc.(field), ordering, dim);<br>
<br>
Error in ext2int (line 193)<br>
mpc = e2i_field(mpc,
'gencost', ordering);<br>
<br>
Error in runpf (line 109)<br>
mpc = ext2int(mpc); <br>
</div>
<div><br>
</div>
<div>Do you know how I can add PV to case 14 in Matpower?</div>
<div>Thank you,</div>
<div>Naime<br>
</div>
<div><br>
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</body>
</html>
--