I'm finding it difficult to execute loadcase functions using MATPOWER toolbox.
Show older comments
i get the error message below when i run my code.
Error Message:
>> nath
Attempt to execute SCRIPT loadcase as a function:
C:\Users\vicky brandelle\Desktop\matpower7.1\lib\loadcase.m
Error in nath (line 2)
mpc = loadcase('case15');
Code :
% Load IEEE 15-bus System Data
mpc = loadcase('case15');
% Original Power Flow Analysis
results_initial = runpf(mpc);
% Introduce On-Load Tap Changer (OLTC) at bus 5
regulated_bus = 5;
% Change the type of bus 5 to PV (V controlled, P specified)
mpc.bus(regulated_bus, BUS_TYPE) = 2;
% Define the tap limits and set the initial tap position
tap_min = 0.9;
tap_max = 1.1;
initial_tap = 1.0;
mpc.branch(end+1, :) = [regulated_bus regulated_bus 0.0 tap_min tap_max 0.0 initial_tap 0.0 0.0 0.0 0.0 0.0];
% Power Flow Analysis with OLTC
results_with_oltc = runpf(mpc);
% Display Bus Voltages
fprintf('Initial Bus Voltages:\n');
disp(results_initial.bus(:, VM));
fprintf('Bus Voltages with OLTC:\n');
disp(results_with_oltc.bus(:, VM));
% Compare Line Losses
loss_initial = sum(results_initial.branch(:, PT));
loss_with_oltc = sum(results_with_oltc.branch(:, PT));
fprintf('Initial Total Line Loss: %.2f MW\n', loss_initial);
fprintf('Total Line Loss with OLTC: %.2f MW\n', loss_with_oltc);
Accepted Answer
More Answers (0)
Categories
Find more on Power and Energy Systems in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!