Not enough input arguments while running the code for function PowerFlowClassical ? Kindly run the code and tell me how to fix it.

function [V,Theta,Y] = PowerFlowClassical(bus,line)
%%
nbuses=length(bus(:,1)); % number of buses of the electric power system
[Y] = Y_admi(line,bus,nbuses); % function to get the admittance matrix
V=bus(:,2); % initial voltage
Theta=bus(:,3); % initial phase
% Net power (Generation - Load)
P_neta=bus(:,4)-bus(:,6);
Q_neta=bus(:,5)-bus(:,7);
%Get the conductance and suceptance matrix
G = real(Y); % conductance matrix
B = imag(Y); % suceptance matrix
% Type of bus
slack=find(bus(:,10)==1);% slack bus
PQ=find(bus(:,10)==3); % PQ bus
PV=find(bus(:,10)==2); % PV bus
% Adquiere the total number of buses
nslack=length(slack); % slack bus
nPQ=length(PQ); % number of load buses: PQ; find V y Theta
nPV=length(PV); % number of generation buses: PV; find Theta
tol_max=10e-7; % tolerance of the solution
%% Iterative method Newton Raphson
Tol=1; %
Ciclos=0;
while (Tol>tol_max)
[P_cal,Q_cal]=cal_power(G,B,nbuses,Theta,V); % this function calculates the power
[mismatch_PQ]=mismatch_Power(P_neta,Q_neta,P_cal,Q_cal,nbuses,PQ,nPQ); % this function gets the mismatch power
% Jacobian Matrix

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Power and Energy Systems 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by