Está en la página 1de 15

MANUAL DE INTERFAZ GRAFICA DE USUARIO EN MATLAB (GUI)

INTERFAZ DE CALCULO DE PORTENCIA

ELABORADO POR:
CAMILO ANDRES BELTRA MALAGOON
JUAN CAMILO VANEGAS CONTRERAS
CRISTIAN DAVID FADO VILLAMIL

UNIVERSIDAD ECCI

PROYECTO DE TERCER CORTE, ELECTRONICA DE POTENCIA

JUNIO 07 DE 2017
BOGOTA, D.C.

1
INDICE

INTRODUCCION Pag. 3.
INICIO INTERFAZ GRAFICA DE CALCULO DE POTENCIA Pag. 3-8.
CODIGO MATLAB. Pag 8-15.
BIBLIOGRAFIA.. Pag. 15.

2
INTRODUCCION
GUIDE es un entorno de programacin visual disponible en MATLAB, este
entorno fue utilizado para crear la interfaz grfica INTERFAZ DE
CALCULO DE POTENCIA. Se cre haciendo uso de las diferentes
herramientas que este entorno nos ofrece y que se explican en este
manual.

INICIO INTERFAZ GRAFICA DE CALCULO DE POTENCIA

Para iniciar la construccin de nuestro proyecto seguimos los siguientes pasos:

Utilizamos el programa MATLAB


En la ventana de herramientas buscamos el icono GUIDE (Ilusdtracion1)
para acceder a este entorno e iniciar la construccin de nuestra interfaz
grfica.

Ilustracin 1

3
Despus de acceder dando click en el icono, se abrir una nueva ventana
(ilustracin 2) , all seleccionamos la opcin Blank GUI para iniciar nuestra
GUI desde ceros.

Ilustracin 2

Despus de dar click en esta opcin se abrir la siguiente ventana

Ilustracin 3

4
En esta ventana a su parte izquierda y en la parte superior se encontraran
las herramientas que nos permitirn construir nuestra GUI.
Para entender mejor el funcionamiento de las herramientas, ejecutamos la
siguiente ruta File-pesferentes-show name in component palette. Para
luego obtener:

Ilustracin 4

Como puedes ver, el nombre de la interfaz es el elegido, y por supuesto


est en el directorio que yo he seleccionado. De no haberlo guardado,
MatLab habra titulado provisionalmente a la interfaz como untitled.fig y la
habra guardado en el directorio donde se hallaba la ventana de comandos.
La cuestin ms importante es que al guardar la interfaz en el mismo
comienzo nos encontramos con unos archivos nuevos en nuestro directorio
elegido. Un archivo es interface1.fig y el otro es interface1.m. Antes de
comenzar a manipularlos es conveniente echarles un vistazo para ver las
diferencias que se van a ir produciendo a medida que vayamos
introduciendo elementos dentro de la interfaz. Una de las funciones que
tiene la gui es el texto estatico el cual consite en introducir mensajes e
incluso valores numricos de una GUI y puede colocarse en un lugar
deseado.(1)

5
Ilustracin 5

STATIC TEXT: Una de las funciones que tiene la gui es el texto estatico el
cual consiste en introducir mensajes e incluso valores numricos de una
GUI y puede colocarse en un lugar deseado.(1 El cual tiene la siguiente
forma y estos son los siguientes cuadros de texto en nuestra interfaz
grfica.

Ilustracin 6

6
Con esta herramientas comenzamos la construccin de la GUI INTERFAZ
DE CALCULO DE PORTENCIA

Ilustracin 7

En la ilustracin 7 podemos observar cmo est constituida nuestra GUI


llamada interfaz de clculo de potencia, en ella podemos observar la
aplicacin de las diferentes herramientas que encontramos en este entorno.
En el diseo se tom en cuenta que solo se iba a realizar en anlisis de
potencia paa un circuito RCL con LC en prelo.
Como primera medida para este diseo se establecieron el ingreso de tres
tipos de seales recopilados dentro del recuadro al que llamamos
Parmetros entrada de voltaje , el usuario escoge entre los tres tipos de
seales pues cada seal representa en el programa una funcin diferente
las cuales se visualizar en el lado izquierdo del circuito dado, pues cada
seal representa en el programa una funcin diferente. De igual forma en
este mismo recuadro se da la posibilidad de que el usuario ingrese los
valores de amplitud y frecuencia de la seal para iniciar los clculos
matemticos relacionados con el tipo de seal que se ingres. En el
siguiente recuadro al que llamamos Parmetros se da la posibilidad que el
usuario ingrese los valores de los componentes electrnicos que integran el
circuito elctrico.
Ingresado estos valores tendremos que pulsar el botos Fijar para
confirmar los datos ingresados por el usuario.
Confirmado los datos pulsaremos el botn Calcular V(t) para iniciar los
clculos matemticos, en estos clculos matemticos se calcula el voltaje a
travs de los coeficientes de la serie trigonomtrica de Fourier que fueron

7
analizados previamente de acuerdo a la funcin ingresada por el usuario,
teniendo estos coeficientes se suman para obtener el voltaje, luego
hallamos la corriente primero resolviendo el paralelo entre la bobina y el
condensador para luego hallar la corriente que circula por esta malla.
Teniendo los valores de voltaje y corriente que circular por el circuito
procedemos a calcular la potencia que recae sobre cada uno de los
componentes los cuales se observan en el recuadro al que llamamos
Resultados

CODIGO EN MATLAB
Se muestra el programa de funcionamiento de la interfaz de clculo de
potencia

function varargout = Juangui(varargin)

gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Juangui_OpeningFcn, ...
'gui_OutputFcn', @Juangui_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
% End initialization code - DO NOT EDIT

% --- Executes just before Juangui is made visible.


function Juangui_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;

% Update handles structure

8
guidata(hObject, handles);

% --- Outputs from this function are returned to the command line.
function varargout = Juangui_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;

% --------------------------------------------------------------------
function Untitled_1_Callback(hObject, eventdata, handles)

% --- Executes on button press in Fijar.


function Fijar_Callback(hObject, eventdata, handles)
global modo;
A = str2double(get(handles.edit6, 'String')); %Amplitus senal de entrada
F = str2double(get(handles.edit7, 'String')); %Frecuencia senal de entrada
R = str2double(get(handles.edit1, 'String')); %Valor de la resistencia
L = str2double(get(handles.edit2, 'String')); %Valor de la inductancia
C = str2double(get(handles.edit3, 'String')); %Valor del condensador
% T = 1/F; % Perido de la senal
set(handles.text19,'string', R);
set(handles.text20,'string', L);
set(handles.text21,'string', C);
%Xc = 1 / (jc w) reactancia capacitiva
%Xl = jl w reactancia inductiva
%Wr = R reactancia ohmica
%Z(w) = R + j(cw - 1/lw) impedancia total
%a0 = (1/T)* int(vin, 0, T); valor medio senal de entrada
%an = (2/T)* int (vin*cos(2*pi*n*(1/T)), 0, T);
%bn = (2/T)* int (vin*sin(2*pi*n*(1/T)), 0, T);

if modo == 1
%senal triangular (A * 1/F)
%A = 1;
%w = 10*pi;
%rho = 0.5;
w=F*2*pi;
t = 0:0.0001:(25/w);
tr = (A/2)*sawtooth(t*w) + (A/2);
plot(t,tr);
axes(handles.axes1)
handles.axes1=imread('Circuito.jpg');
imagesc(handles.axes1)
axis off

end
if modo == 2

9
%senal cuadrada
w=F*2*pi;
t = 0:0.0001:(25/w);
sq = A*square(w*t);
plot(t,sq);
axes(handles.axes1)
handles.axes1=imread('Circuito.jpg');
imagesc(handles.axes1)
axis off
end
if modo == 3
%senal triangular
w=F*2*pi;
t = 0:0.0001:(12.5/w);
tr = (A)*sawtooth(t*w+(pi/2), 0.5);
plot(t,tr);
axes(handles.axes1)
handles.axes1=imread('Circuito.jpg');
imagesc(handles.axes1)
axis off
end

function edit1_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.


function edit1_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'),


get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit2_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.


function edit2_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'),


get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit3_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.


function edit3_CreateFcn(hObject, eventdata, handles)

10
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in radiobutton1.
function radiobutton1_Callback(hObject, eventdata, handles)

% --- Executes on button press in radiobutton2.


function radiobutton2_Callback(hObject, eventdata, handles)

% --- Executes on button press in radiobutton3.


function radiobutton3_Callback(hObject, eventdata, handles)

function edit4_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.


function edit4_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'),


get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit5_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.


function edit5_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'),


get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit6_Callback(hObject, eventdata, handles)


% hObject handle to edit6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit6 as text


% str2double(get(hObject,'String')) returns contents of edit6 as a double
% --- Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

11
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit7_Callback(hObject, eventdata, handles)


% hObject handle to edit7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit7 as text
% str2double(get(hObject,'String')) returns contents of edit7 as a double

% --- Executes during object creation, after setting all properties.


function edit7_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in pushbutton2.


function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% global y
% y = 5*3;
% set (handles.text11,'String',y);

% --- Executes when selected object is changed in uipanel6.

% --- Executes when selected object is changed in uipanel9.


function uipanel9_SelectionChangeFcn(hObject, eventdata, handles)
% hObject handle to the selected object in uipanel9
% eventdata structure with the following fields (see UIBUTTONGROUP)
% EventName: string 'SelectionChanged' (read only)

12
% OldValue: handle of the previously selected object or empty if none was
selected
% NewValue: handle of the currently selected object
% handles structure with handles and user data (see GUIDATA)
global modo
if hObject == handles.radiobutton7
modo = 1
end
if hObject == handles.radiobutton8
modo = 2
end
if hObject == handles.radiobutton9
modo = 3
end

% --- Executes on button press in Calcular_V.


function Calcular_V_Callback(hObject, eventdata, handles)
% hObject handle to Calcular_V (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global modo;
A = str2double(get(handles.edit6, 'String')); %Amplitus senal de entrada
F = str2double(get(handles.edit7, 'String')); %Frecuencia senal de entrada
R = str2double(get(handles.edit1, 'String')); %Valor de la resistencia
L = str2double(get(handles.edit2, 'String')); %Valor de la inductancia
C = str2double(get(handles.edit3, 'String')); %Valor del condensador
% T = 1/F; % Perido de la senal
% set(handles.text19,'string', R);
% set(handles.text20,'string', L);
% set(handles.text21,'string', C);
%Xc = 1 / (jc w) reactancia capacitiva
%Xl = jl w reactancia inductiva
%Wr = R reactancia ohmica
%Z(w) = R + j(cw - 1/lw) impedancia total
%a0 = (1/T)* int(vin, 0, T); valor medio senal de entrada
%an = (2/T)* int (vin*cos(2*pi*n*(1/T)), 0, T);
%bn = (2/T)* int (vin*sin(2*pi*n*(1/T)), 0, T);

if modo == 1
syms t n;
Wo=2*pi*F;
T=1/F;
tr = A*t;
a0= (1/T)*int(tr,0,T)
pretty (a0)
aN= (2/T)*int((tr*cos(n*Wo*t)),t,0,T)

13
pretty (aN)
bN= (2/T)*int((tr*sin(n*Wo*t)),t,0,T)
pretty (bN)
vt=0;
for n=1:3
vt=vt+((aN*cos(Wo*n*t))+(bN*sin(Wo*n*t)));
end
Vt = (a0/2) + vt;
pretty (Vt)

end
if modo == 2
%senal cuadrada
syms t n;
Wo=2*pi*F;
T=1/F;
tr = A*square(w*t);
a0= (1/T)*int(tr,0,T)
pretty (a0)
aN= (2/T)*int((tr*cos(n*Wo*t)),t,0,T)
pretty (aN)
bN= (2/T)*int((tr*sin(n*Wo*t)),t,0,T)
pretty (bN)
vt=0;
for n=1:3
vt=vt+((aN*cos(Wo*n*t))+(bN*sin(Wo*n*t)));
end
Vt = a0 + vt;
pretty (Vt)

end
if modo == 3
%senal triangular

end

%aca no he hecho ni shit

14
Bibliografa
http://webpersonal.uma.es/de/gfdc/docencia/GuiSection.pdf
http://catarina.udlap.mx/u_dl_a/tales/documentos/lep/garcia_b_s/ca
pitulo3.pdf
http://interfazgraficamatlab.blogspot.com.co/
http://bibing.us.es/proyectos/abreproy/11986/fichero/CAP
%C3%8DTULO+3%252FCAP%C3%8DTULO+3.pdf

15

También podría gustarte