17
:متلب کد
clc
clear
%% Getuser input for the primary voltage,secondary
voltage,frequency,
% primary resistance, secondary resistance, primary reactance,
% secondary reactance, core loss resistance, magnetizing
reactance,
% secondary impedance, and Z0
Vnominal1=input("Enter the primary nominal voltage:");%2300;
Vnominal2=input("Enter the secondary nominal voltage:");%230;
f=input("Enter the frequence:");%50;
R1=input("Enter the primary resistance:");%0.286;
R2=input("Enter the secondary resistance:");%0.319;
X1=input("Enter the primary reactance:");%0.73;
X2=input("Enter the secondary reactance:");%0.73;
Rc=input("Enter the core loss resistance:");%250;
Xm=input("Enter the magnetizing reactance:");%1250;
Z_L=input("Enter the secondary impedance:");%0.387+1i*0.29;
Z0=input("Enter the Z0:");%0.286+1i*0.73;
18.
18
:متلب کد
%%
% Calculatethe turns ratio oftransformer
a=Vnominal1/Vnominal2;
% Calculate the referred primary impedance
ZprimL=a^2*Z_L;
Zprim_l=abs(ZprimL);
theta_prim_l=rad2deg(angle(ZprimL));
disp(['Zprim_L = |ZprimL| = ' num2str(Zprim_l) ', θ_Zprim_L = '
num2str(theta_prim_l) '°'])
% Calculate the equivalent for primary impedance
Z1=((Rc*(1i*Xm))/(Rc+(1i*Xm)));
z1=abs(Z1);
theta_Z1=rad2deg(angle(Z1));
disp(['z1 = |Z1| = ' num2str(z1) ', θ_Z1 = ' num2str(theta_Z1)
'°'])
% Calculate the equivalent for secondary impedance
Z2=complex(R2,X2)+ZprimL;
z2=abs(Z2);
theta_Z2=rad2deg(angle(Z2));
disp(['z2 = |Z2| = ' num2str(z2) ', θ_Z2 = ' num2str(theta_Z2)
'°'])
% Calculate the magnitude and angle of Z0
z0=abs(Z0);
theta_Z0=rad2deg(angle(Z0));
disp(['z0 = |Z0| = ' num2str(z0) ', θ_Z0 = ' num2str(theta_Z0)
'°'])
19.
19
:متلب کد
% Calculatethe equivalent impedance
Zeq=((Z2*Z1)/(Z2+Z1))+Z0;
% Calculate the primary current
I1=Vnominal1/Zeq;
I_1=abs(I1);
theta_I1=rad2deg(angle(I1));
disp(['I_1 = |I1| = ' num2str(I_1) ', θ_I1 = ' num2str(theta_I1)
'°'])
% Calculate the magnetizing current
I0=I1*(Z2/(Z1+Z2));
I_0=abs(I0);
theta_I0=rad2deg(angle(I0));
disp(['I_0 = |I0| = ' num2str(I_0) ', θ_I0 = ' num2str(theta_I0)
'°'])
% Calculate the secondary current
I2=I1-I0;
I_2=abs(I2);
theta_I2=rad2deg(angle(I2));
disp(['I_2 = |I2| = ' num2str(I_2) ', θ_I2 = ' num2str(theta_I2)
'°'])
% Calculate the referred primary voltage
Vprim2=I2*ZprimL;
Vprim_2=abs(Vprim2);
theta_Vprim_2=rad2deg(angle(Vprim2));
disp(['Vprim_2 = |Vprim2| = ' num2str(Vprim_2) ', θ_Vprim_2 = '
num2str(theta_Vprim_2) '°'])
20.
20
:متلب کد
% Calculatethe secondary voltage
Vreal2=Vprim2/a;
Vreal_2=abs(Vreal2);
theta_Vreal2=rad2deg(angle(Vreal2));
disp(['Vreal_2 = |Vreal2| = ' num2str(Vreal_2) ', θ_Vreal2 = '
num2str(theta_Vreal2) '°'])
% Calculate the power factor
PF_in=cos(angle(Vnominal1)-angle(I1));
if PF_in>0
disp(['The power factor is ' num2str(PF_in) ', which is
lag.'])
else
disp(['The power factor is ' num2str(PF_in) ', which is
lead.'])
end
%%
% Calculate the input power,output power,primary power loss,
% secondary power loss,and core power loss
InputPower=I_1*Vnominal1*cosd(angle(Vnominal1)-theta_I1);
OutputPower=I_2*Vreal_2*cosd(theta_Vreal2-theta_I2);
PrimaryPowerLoss=(I_1)^2*R1;
SecondaryPowerLoss=(I_2)^2*R2;
CorePowerLoss=(I_0)^2*Rc;
disp(['Input Power = ' num2str(InputPower)])
disp(['Output Power = ' num2str(OutputPower)])
disp(['Primary Power Loss = ' num2str(PrimaryPowerLoss)])
disp(['Secondary Power Loss = ' num2str(SecondaryPowerLoss)])
disp(['Core Power Loss = ' num2str(CorePowerLoss)])
21.
21
:متلب کد
Zprim_L =|ZprimL| = 48.36, θ_Zprim_L = 36.8462°
z1 = |Z1| = 245.1452, θ_Z1 = 11.3099°
z2 = |Z2| = 49.0546, θ_Z2 = 37.3051°
z0 = |Z0| = 0.78403, θ_Z0 = 68.6057°
I_1 = |I1| = 54.6285, θ_I1 = -33.6742°
I_0 = |I0| = 9.2395, θ_I0 = -11.9303°
I_2 = |I2| = 46.1734, θ_I2 = -37.9255°
Vprim_2 = |Vprim2| = 2232.9465, θ_Vprim_2 = -1.0793°
Vreal_2 = |Vreal2| = 223.2946, θ_Vreal2 = -1.0793°
The power factor is 0.8322, which is lag.
Input Power = 104562.6358
Output Power = 8250.7787
Primary Power Loss = 853.5012
Secondary Power Loss = 680.1029
Core Power Loss = 21342.0949
Enter the primary nominal voltage:2300
Enter the secondary nominal voltage:230
Enter the frequence:50
Enter the primary resistance:0.286
Enter the secondary resistance:0.319
Enter the primary reactance:0.73
Enter the secondary reactance:0.73
Enter the core loss resistance:250
Enter the magnetizing reactance:1250
Enter the secondary impedance:0.387+1i*0.29
Enter the Z0:0.286+1i*0.73