0% found this document useful (0 votes)
13 views3 pages

Function: 'Gui - Name' 'Gui - Singleton' 'Gui - Openingfcn' 'Gui - Outputfcn' 'Gui - Layoutfcn' 'Gui - Callback'

This document contains the code for a GUI application to calculate electrical values for a transformer circuit. The code defines callbacks for GUI components like buttons and displays an image. It also includes the calculation logic to determine values like resistances, reactances, and currents for the transformer branches based on supplied parameters.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views3 pages

Function: 'Gui - Name' 'Gui - Singleton' 'Gui - Openingfcn' 'Gui - Outputfcn' 'Gui - Layoutfcn' 'Gui - Callback'

This document contains the code for a GUI application to calculate electrical values for a transformer circuit. The code defines callbacks for GUI components like buttons and displays an image. It also includes the calculation logic to determine values like resistances, reactances, and currents for the transformer branches based on supplied parameters.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

function varargout = calculate(varargin)

gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @calculate_OpeningFcn, ...
'gui_OutputFcn', @calculate_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end

function calculate_OpeningFcn(hObject, eventdata, handles, varargin)

handles.output = hObject;

guidata(hObject, handles);

function varargout = calculate_OutputFcn(hObject, eventdata, handles)

varargout{1} = handles.output;

function axes1_CreateFcn(hObject, eventdata, handles)


imshow('Transformador-circuito.png');

function pushbutton1_Callback(hObject, eventdata, handles)


close(calculate);
main;

function pushbutton2_Callback(hObject, eventdata, handles)


sn=getappdata(0,'sn');
vp=getappdata(0,'vp');
vs=getappdata(0,'vs');
f=getappdata(0,'f');

voc=getappdata(0,'voc');
ioc=getappdata(0,'ioc');
poc=getappdata(0,'poc');

vcc=getappdata(0,'vcc');
icc=getappdata(0,'icc');
pcc=getappdata(0,'pcc');

%Cálculo de las corrientes por los devanados:


ip=sn/vp;

1
is=sn/vs;

%Cálculo de la relación de transformación "a":


a=vp/vs;

%Cálculo de la RAMA DE MAGNETIZACIÓN:


%Resistencia de Magnetización:
rm=(voc^2)/poc;
rmag=rm/(a^2);

str2double(set(handles.Rmag,'string',rmag))

%Reactancia de Magnetización:
soc=voc*ioc;
fp_oc=poc/soc;
theta_oc=acos(fp_oc);
qoc=poc*tan(theta_oc);

xm=(voc^2)/qoc;
xmag=xm/(a^2);

str2double(set(handles.Xmag,'string',xmag))

%Cálculo de la RAMA EQUIVALENTE:


%Resistencia Equivalente:
req=pcc/(icc^2);

str2double(set(handles.Req,'string',req))

%Reactancia Equivalente:
scc=vcc*icc;
fp_cc=pcc/scc;
theta_cc=acos(fp_cc);
qcc=pcc*tan(theta_cc);

xeq=qcc/(icc^2);

str2double(set(handles.Xeq,'string',xeq))

%Corrientes en pantalla...
str2double(set(handles.Ip,'string',ip))
str2double(set(handles.Is,'string',is))

function pushbutton3_Callback(hObject, eventdata, handles)


clear all;
clc;
close(calculate);

function axes2_CreateFcn(hObject, eventdata, handles)


imshow('Transformador-circuito.png');

2
Published with MATLAB® R2017b

You might also like