You are on page 1of 5

Calculo de Ybarra, Sistemas Eléctricos de Potencia.

Al iniciar la aplicación se muestra el cuadro de dialogo de la figura 1, donde digitaremos el número


de nodos del circuito en análisis sin tomar en cuenta el nodo de referencia, el método de análisis es
el de simple inspección.

Figura 1: Ventana de introducción de nodos del sistema.

Figura 2: Ventana de informativa para solicitud de admitancias.

Figura 3: Proceso de introducción de admitancias.

La barra de desplazamiento lateral permite verificar que los datos introducidos de las admitancias
correspondan a nuestro circuito en análisis. Luego de introducidos los datos hay que dar clic sobre
el botón calcular. Lo que hace redimensionar la tabla de datos para formar la Ybarra en el lugar
donde antes introducimos los valores individuales de cada admitancia, esto puede apreciarse en la
figura 4.

Figura 4: La tabla muestra los valores de Ybarra.

Al dar clic sobre el botón << se inicia el proceso nuevamente desde la figura 1.

Kelman Belloso 1
Calculo de Ybarra, Sistemas Eléctricos de Potencia.

Figura 5: Circuito Eléctrico de Potencia para calcular Ybarra en el ejemplo.


function varargout = Ybarra(varargin)
%%*************************************************************************
%Calc_Ybarra Calcula el Ybarra de un circuito de potencia
% por el método de simple inspección
%
% Autor : Kelman Belloso
% Revision : 1.1
% Date : 2013/02/20 11:35:30
%
% Ejemplo :
% y10 = 0.4425 - 6.6372i
% y20 = 0.0000 + 0.0000i
% y30 = 0.0000 + 0.0000i
% y40 = 0.4425 - 6.6372i
% y12 = 2.0000 - 6.0000i
% y13 = 1.0000 - 3.0000i
% y14 = 0.0000 + 0.0000i
% y23 = 0.6700 - 2.0000i
% y24 = 1.0000 - 3.0000i
% y34 = 2.0000 - 6.0000i
%
% Ybarra =
% 3.4425 -15.6372i -2.0000 + 6.0000i -1.0000 + 3.0000i 0
% -2.0000 + 6.0000i 3.6700 -11.0000i -0.6700 + 2.0000i -1.0000 + 3.0000i
% -1.0000 + 3.0000i -0.6700 + 2.0000i 3.6700 -11.0000i -2.0000 + 6.0000i
% 0 -1.0000 + 3.0000i -2.0000 + 6.0000i 3.4425 -15.6372i
%
% YBARRA M-file for Ybarra.fig
% YBARRA, by itself, creates a new YBARRA or raises the existing
% singleton*.
%
% H = YBARRA returns the handle to a new YBARRA or the handle to
% the existing singleton*.
%
% YBARRA('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in YBARRA.M with the given input arguments.
%
% YBARRA('Property','Value',...) creates a new YBARRA or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Ybarra_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Ybarra_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help Ybarra
% Last Modified by GUIDE v2.5 19-Feb-2013 12:01:34%
% Begin initialization code - DO NOT EDIT
%%
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Ybarra_OpeningFcn, ...
'gui_OutputFcn', @Ybarra_OutputFcn, ...
'gui_LayoutFcn', [] , ...

Kelman Belloso 2
Calculo de Ybarra, Sistemas Eléctricos de Potencia.

'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 Ybarra is made visible.
function Ybarra_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to Ybarra (see VARARGIN)

% Choose default command line output for Ybarra


handles.output = hObject;

% Update handles structure


guidata(hObject, handles);

% UIWAIT makes Ybarra wait for user response (see UIRESUME)


% uiwait(handles.figure1);
format compact;
scrsz=get(0,'Screensize');
pos_act=get(gcf,'Position');
xr=round((scrsz(3)-pos_act(3))/2);
yr=round((scrsz(4)-pos_act(4))/2);
set(gcf,'Position',[xr yr pos_act(3:4)])
handles.output = hObject;
guidata(hObject, handles);
Obtener_elementos(hObject, eventdata, handles)

%*************************************************************************
% --- Outputs from this function are returned to the command line.
function varargout = Ybarra_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure


varargout{1} = handles.output;
helpdlg('Escriba en la tabla los valores de las admitancias de cada rama','ASP2');

%*************************************************************************
% --- Executes on button press in PushB_Close.
function PushB_Close_Callback(hObject, eventdata, handles)
% hObject handle to PushB_Close (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close
clear

%*************************************************************************
% --- Executes on button press in PushB_Regresar.
function PushB_Regresar_Callback(hObject, eventdata, handles)
% hObject handle to PushB_Regresar (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

Kelman Belloso 3
Calculo de Ybarra, Sistemas Eléctricos de Potencia.

Obtener_elementos(hObject, eventdata, handles)

%*************************************************************************
% --- Executes on button press in PushB_Calcular.
function PushB_Calcular_Callback(hObject, eventdata, handles)
% hObject handle to PushB_Calcular (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
h=get(handles.Table_Data,'Data');
Yadm3=handles.admitan;
for m=1:1:length(h)
Yadm3(m).Valor=h(m,1);
end
Num_nodos=handles.Num_nodos;
Num_ramas=handles.Num_ramas;
Ybar=zeros(Num_nodos);
Yadm={};
for m=1:1:Num_nodos
Yadm(m)={m};
for n=1:1:Num_nodos
if m==n
for k=1:1:length([Yadm3(:).Valor])
if m==Yadm3(k).Sub1 || m==Yadm3(k).Sub2
Ybar(m,n)=Ybar(m,n)+Yadm3(k).Valor;
end
end
else
for k=1:1:length([Yadm3(:).Valor])
if
eval([num2str(m),num2str(n)])==eval([num2str(Yadm3(k).Sub1),num2str(Yadm3(k).Sub2)]) ||
eval([num2str(n),num2str(m)])==eval([num2str(Yadm3(k).Sub1),num2str(Yadm3(k).Sub2)])
Ybar(m,n)=Ybar(m,n)-Yadm3(k).Valor;
end
end
end
end
end

Yadm2=cell(1,Num_nodos);
Yadm2(:)={150};
set(handles.Table_Data,'ColumnName',Yadm,'RowName',Yadm,'Data',Ybar,...
'ColumnWidth',Yadm2);
fprintf('\n');
Ybar
handles.output = hObject;
guidata(hObject, handles);

%*************************************************************************
% --- Executes when entered data in editable cell(s) in Table_Data.
function Table_Data_CellEditCallback(hObject, eventdata, handles)
% hObject handle to Table_Data (see GCBO)
% eventdata structure with the following fields (see UITABLE)
% Indices: row and column indices of the cell(s) edited
% PreviousData: previous data for the cell(s) edited
% EditData: string(s) entered by the user
% NewData: EditData or its converted form set on the Data property. Empty if Data was not
changed
% Error: error string when failed to convert EditData to appropriate value for Data
% handles structure with handles and user data (see GUIDATA)
h=get(handles.Table_Data,'Data');
[Row_dim,Col_dim]=size(h);
Yadm=cell(1,Col_dim);
Yadm(:)={150};
set(handles.Table_Data,'ColumnWidth',Yadm(:));
handles.output = hObject;
guidata(hObject, handles);

Kelman Belloso 4
Calculo de Ybarra, Sistemas Eléctricos de Potencia.

%*************************************************************************
% --- Obtiene los datos para iniciar la aplicación.
function Obtener_elementos(hObject, eventdata, handles)
Num_nodos=inputdlg('Digite el número de nodos: ','ASP2');
Num_nodos=str2num(Num_nodos{1});
Num_ramas=factorial(Num_nodos)/(factorial(2)*factorial(Num_nodos-2));
Num_ramas=Num_nodos+Num_ramas;
Ybarra=zeros(Num_nodos);
Yadm2={};

for m=1:1:Num_nodos
Yadm2{m}=['y',num2str(m),num2str(0)];
Yadm3(m)=struct('Name',['y',num2str(m),num2str(0)],'Sub1',m,'Sub2',0,'Valor',0);
end
n2=Num_ramas-Num_nodos;
n=n2;
k=1;
while n~=0
for m=1:1:Num_nodos
if k>=m
else
Yadm2{n2-n+Num_nodos+1}=['y',num2str(k),num2str(m)];
Yadm3(n2-
n+Num_nodos+1)=struct('Name',['y',num2str(k),num2str(m)],'Sub1',k,'Sub2',m,'Valor',0);
n=n-1;
end
end
k=k+1;
end
set(handles.Table_Data,'Enable','on','ColumnName',{'Y'},'RowName',Yadm2,...
'Data',zeros(Num_ramas,1),'ColumnWidth',{'auto'});
handles.admitan=Yadm3;
handles.Num_nodos=Num_nodos;
handles.Num_ramas=Num_ramas;
handles.output = hObject;
guidata(hObject, handles);

Kelman Belloso 5

You might also like