Voc = app.LinetolinevoltageVocEditField.Value;
Ioc = app.LinetolinecurrentAocEditField.Value;
Woc = app.ThreephasepowerkWocEditField.Value/3;
Vsc = app.LinetolinevoltageVscEditField.Value;
Isc = app.LinetolinecurrentAscEditField.Value;
Wsc = app.ThreephasepowerkWscEditField.Value/3;
Vp = app.PrimarysidelinevoltageVEditField.Value;
Vs = app.SecondorysidelinevoltageVEditField.Value;
if(app.StepdowntransformerButton.Value)
a = Vp ./ Vs;
if(app.DeltastarconnectionButton.Value)
Voc = Voc/sqrt(3);
pfoc = Woc/(Voc*Ioc);
if(pfoc>=1)
app.errorTextArea.Value = 'Error! Power factor is more than 1!';
else
Ro = Voc/(Ioc*pfoc);
app.RcTextArea.Value = num2str(Ro);
sineoc = sin(acos(pfoc));
Xm = Voc/(Ioc*sineoc);
app.XmTextArea.Value = num2str(Xm);
Isc = Isc/sqrt(3);
pfsc = Wsc/(Vsc*Isc);
if(pfsc>=1)
app.errorTextArea.Value = 'Error! Power factor is more than 1!';
else
Req = Wsc/(Isc*Isc);
Req = Req/(a*a);
app.ReqTextArea.Value = num2str(Req);
Zeq = Vsc/Isc;
Zeq = Zeq/(a*a);
Xeq = sqrt((Zeq*Zeq)-(Req*Req));
app.XeqTextArea.Value = num2str(Xeq);
end
end