# Tolerance in power flow calculation

2 views (last 30 days)
Arifur Rahman on 30 Jan 2018
Edited: Arifur Rahman on 30 Jan 2018
Hello. Could anyone help me about that, If I do power flow calculation in Matlab then I need to mention a tolerance, for example,
tol=1; % initialization % tol= Tolerance
While tol>0.001
So actually in the power flow calculation, this tolerance depends on what? I need to do a power flow calculation. My grid is actually quite complex. I have made a while loop where the AC and DC parameters are mentioned inside it. However, why the while loop doesnt work that I am confused.
iter=0;
sK(:,:)=SK(:,:); % SK is the initial power and sK is the resulting power
tol=1500;
while (tol>1e3)
%%from bus-2 to bus-34
% [th(1),Up(1)] = cart2pol(real(uK(2)),imag(uK(2)));
% [th(2),Up(2)] = cart2pol(real(uK(34)),imag(uK(34))); Ucr= (M1*Vdr)/sqrt(2); %voltage (AC to DC)
[th(3),Up(3)] = cart2pol(real(Ucr),imag(Ucr)); % Pinjr234 = ((Up(3)*Up(1)/X1)*sin(th(1)-th(3))); % Qinjr234= ((Up(1)*(Up(1)-Up(3))*cos(th(1)-th(3)))/X1); %Reactive power inject at rectifier Itvsc= Pinjr234/Ucr; Plvscr=ar+br*Itvsc+cr*Itvsc^2; %power loss at rectifier Pd = Pinjr234-Plvscr; %Power at DC link Id = Pd/Vdr; %Current at DC link Pld = Id^2*Rd; %Power loss in the DC link Pid = Pd-Pld; %Power at the inverter side Vdi = Vdr-Id*Rd; %voltage at the inverter side Uci = (M2*Vdi)/sqrt(2); %%voltage (DC to AC) [th(4),Up(4)] = cart2pol(real(Uci),imag(Uci)); Plvsci=ai+bi*Itvsc+ci*Itvsc^2; %Power loss at inverter Pinji234 = Pid-Plvsci; %Real Power inject from DC to AC % Qinji234 = ((Up(2)*(Up(2)-Up(4))*cos(th(2)-th(4)))/X2); %Reactive Power inject from DC to AC
%% from bus-22 to bus-35
% [th(13),Up(13)] = cart2pol(real(uK(22)),imag(uK(22)));
% [th(14),Up(14)] = cart2pol(real(uK(35)),imag(uK(35)));
Ucr3= (M1*Vdr)/sqrt(2); %voltage (AC to DC) [th(15),Up(15)] = cart2pol(real(Ucr3),imag(Ucr3)); % Pinjr2235 = ((Up(15)*Up(13)/X1)*sin(th(13)-th(15))); % Qinjr2235= ((Up(13)*(Up(13)-Up(15))*cos(th(15)-th(13)))/X1); %Reactive power inject at rectifier Itvsc3= Pinjr2235/Ucr3; Plvscr3=ar+br*Itvsc3+cr*Itvsc3^2; %power loss at rectifier Pd3 = Pinjr2235-Plvscr3; %Power at DC link Id3 = Pd3/Vdr; %Current at DC link Pld3 = Id3^2*Rd3; %Power loss in the DC link Pid3 = Pd3-Pld3; %Power at the inverter side Vdi3 = Vdr-Id3*Rd3; %voltage at the inverter side Uci3 = (M2*Vdi3)/sqrt(2); %%voltage (DC to AC) [th(16),Up(16)] = cart2pol(real(Uci3),imag(Uci3)); Plvsci3=ai+bi*Itvsc3+ci*Itvsc3^2; %Power loss at inverter Pinji2235 = Pid3-Plvsci3; %Real Power inject from DC to AC %((Up(4)*Up(2)/X1)*sin(th(4)-th(2))); % Qinji2235 = ((Up(14)*(Up(14)-Up(16))*cos(th(14)-th(16)))/X2); %Reactive Power inject from DC to AC
sK(2,:) = SK(2,:)+Pinjr234;
sK(34,:) = SK(34,:)-Pinji234;
sK(22,:) = SK(22,:)+Pinjr2235;
sK(35,:) = SK(35,:)-Pinji2235;
% set apparent powers % execute when a load changed % transfer vectors (snapshot) or matrices (time series)
erf3=setSK(ws,sID,sK(:,:));
%%call power flow function % execute when load or switch status changed
erf5=calcLF(ws,sID);
tol=abs(sK-SK);
sK=SK;
iter=iter+1;
end
I have done this but when I compile, only one iteration has occurred and it gives results according to the initial values.