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]>
wrote:

> hi
> i think use table
> [image: image.png]
> clc
> mpc = loadcase('case14');
> result = runopf(mpc)
> mpc_bus = mpc.bus; %%show mpc.bus
> type_bus_5 = mpc.bus(5,7);%% show type of mpc.bus
> mpc.bus(5,7) = 2;%% 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]>
> 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
>>
>>

Reply via email to