0% found this document useful (0 votes)
46 views

Taller 3: All Long

The document contains MATLAB code for analyzing and graphically displaying the power factor compensation of an electrical distribution system with multiple loads. It defines variables for load characteristics, calculates equivalent impedances and power quantities, and contains code to generate triangle power graphs and plots of load current over time as the power factor is varied. The code allows the user to select between phase-to-phase or phase-to-neutral compensation configurations and modifies calculations accordingly.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

Taller 3: All Long

The document contains MATLAB code for analyzing and graphically displaying the power factor compensation of an electrical distribution system with multiple loads. It defines variables for load characteristics, calculates equivalent impedances and power quantities, and contains code to generate triangle power graphs and plots of load current over time as the power factor is varied. The code allows the user to select between phase-to-phase or phase-to-neutral compensation configurations and modifies calculations accordingly.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Taller 3

clc; clear; close all; format long;


%%%% datos %%%
%%%Carga 1%%%5
z1=3+6i;

%%%%%Carga 2%%%%

z2=5+8i;
z3=6+7i;
z4=8+5i;

% carga 5
a1=5+8i;
b1=9+4i;
c1=8+7i;

% carga 6
a=5+8i
b=9+4i
c=8+7i

% trnaformacion d-y

R1=(b*c)/(a+b+c)
R2=(a*c)/(a+b+c)
R3=(a*b)/(a+b+c)

vL=440/3;
m = menu('COMPESADOR DE FACTOR DE PORTENCIA'...
,'1. FASE - FASE ','2. FASE - NEUTRO');
switch m
case 2
x=input('Ingrese el nuevo FP:');
% Linea 1-N
%carga 1
zeq1= 1/(1/z1+1/a1+1/R3)

i1=vL/zeq1;
fp1=0.8
P1=vL.*i1*cosd(fp1);
S1=vL*i1;
Q1=vL.*i1.*sind(fp1);
Q11=P1*tand(x)
C1=Q11./2*pi*60*vL^2

%Linea 2-N
zeq2= 1/(1/z3+1/b1+1/R1)
i2=vL/zeq2;
fp1=0.8
P2=vL*i2*cosd(fp1);
S2=vL*i2;
Q2=vL*i2*sind(fp1);
Q2=P2*tand(x)
C2=Q2/2*pi*60*vL^2
%Linea 3-N

zeq3= 1/(1/c1+1/R2)
i3=vL/zeq3;
fp1=0.8
P3=vL*i3*cosd(fp1);
S3=vL*i3;
Q3=vL*i3*sind(fp1);
Q3=P3*tand(x)
C3=Q3/2*pi*60*vL^2
%1111111111111
figure;
subplot(3,1,1)

vectarrow([0 0],[P1 0])


hold on
vectarrow([P1 0],[P1 Q1])
hold on
vectarrow([0 0],[P1 Q1])
hold on
vectarrow([0 0],[P1 Q11])

title('Compesador FP')
ylabel('Potencia Reactiva')
xlabel('Potencia Real');

%22222222222222222

subplot(3,1,2)

vectarrow([0 0],[P2 0])


hold on
vectarrow([P2 0],[P2 Q2])
hold on
vectarrow([0 0],[P2 Q2])
hold on
title('Compesador FP')
ylabel('Potencia Reactiva')
xlabel('Potencia Real');

%3333333333333

subplot(3,1,3)
title('Compesador FP')
ylabel('Potencia Reactiva')
xlabel('Potencia Real');

vectarrow([0 0],[P3 0])


hold on
vectarrow([P3 0],[P3 Q3])
hold on
vectarrow([0 0],[P3 Q3])
hold on
case 1
vL=440
x=input('Ingrese el nuevo FP:');
%%% l-2

zeq73= 1/(1/z4+1/(a1+b1)+1/(R3+R1))
i73=vL/zeq73;
fp1=0.8
P73=vL*i73*cosd(fp1);
S73=vL*i73;
Q73=vL*i73*sind(fp1);
Q73=P73*tand(x)
C73=Q73/2*pi*60*vL^2

%%%2-3
zeq63= 1/z3+1/(b1+c1)+1/(R2+R1)
i63=vL/zeq63;
fp1=0.8
P63=vL*i63*cosd(fp1);
S63=vL*i63;
Q63=vL*i63*sind(fp1);
Q63=P63*tand(x)
C63=Q63/2*pi*60*vL^2

subplot(2,1,1)

subplot(2,1,2)
vectarrow([0 0],[P63 0])
hold on
vectarrow([P63 0],[P63 Q63])
hold on
vectarrow([0 0],[P63 Q63])
title('Compesador FP')
ylabel('Potencia Reactiva')
xlabel('Potencia Real');

subplot(2,1,1)

vectarrow([0 0],[P73 0])


hold on
vectarrow([P73 0],[P73 Q73])
hold on
vectarrow([0 0],[P73 Q73])

end

unión
%VECTORES

S=[10 30 45 50 20 45 42 36 48 10 47 15 10 23 33 36 38 50 10 25 29 24 26
47];
fp=[0.6 0.62 0.74 0.78 0.65 0.62 0.59 0.80 0.69 0.6 0.81 0.83 0.6 0.69
0.59 0.59 0.81 0.78 0.6 0.67 0.80 0.79 0.73 0.83];
Ic_1
Volt_1
% m = menu('Graficas'...
% ,'1. Triangulo de Potencia ','2.Corriente');
% switch m ;
% case 1
% x=input('Ingrese el nuevo FP:');
% P=Volt_1.*Ic_1*cosd(fp);
% S1=Volt_1*Ic_1;
% Q1=Volt_1.*Ic_1*sind(fp);
% Q11=Volt_1*Ic_1*sind(x);
% C1=Q11./2*pi*60*Volt_1^2;
% figure;
% %VARIACION DE GRAFICA TRIANGULO DE POTENCIA
% for i=1:length(fp)
% title('Corriente')
% P0 = [0,0];
% P1 = [P(i),0];
% P2 = [P(i),Q1(i)];
% P3=[P(i), Q11];
%
% vectarrow(P0,P1);
% xlim([0 8000])
% ylim([0 100])
% ylabel('Potencia Reactiva')
% xlabel('Potencia Real');
% str = {'P [kW]'};
% text(P(i)/2,0.5,str)
% hold on
%
% vectarrow(P1,P2);
% str = {'Q [kVAr]'};
% text(P(i)+0.5,fp(i)/2,str)
% hold on
%
% vectarrow(P0,P2);
% str = {'S [kVA]'};
% text(P(i)+0.5,fp(i)/2,str)
% hold on
%
% vectarrow(P0,P3);
% str = {'Q [kVAr]'};
% text(P(i)+0.7,fp(i)/2,str)
% pause(2)
% end
%
% case 2

%VARIACION CORRIENTE DE LA CARGA EN EL TIEMPO


for (i=1:24)

I(i)=S(i)./Volt_1.*fp(i);
title('Corriente')
xlim([0 24]);
ylim([0 50]);
plot(I)
stairs(I);
drawnow;
pause(0.8)
end
% Grafica_Ic1=double([(0: length (I)-1)',I']);
% end

Ejemplo
clc
clear all
P11 = [10 30 45 50 20 45 42 36 48 10 47 15 10 23 33 36 38 50 10 25 29 24
26 47];
P22 = [0.6 0.62 0.74 0.78 0.65 0.62 0.59 0.80 0.69 0.6 0.81 0.83 0.6 0.69
0.59 0.59 0.81 0.78 0.6 0.67 0.80 0.79 0.73 0.83];
figure;
for i=1:length(P22)

P0 = [0,0];
P1 = [P11(i),0];
P2 = [P11(i),P22(i)];

vectarrow(P0,P1);
str = {'P [kW]'};
text(P11(i)/2,0.5,str)
xlim([0 12])
ylim([0 12])
hold on
vectarrow(P1,P2);
str = {'Q [kVAr]'};
text(P11(i)+0.5,P22(i)/2,str)
hold on
vectarrow(P0,P2);
str = {'S [kVA]'};
text(P11(i)/2,P22(i)/2,str)
pause(2);
end

ejemplo
clc
clear all
P11 = [10 30 45 50 20 45 42 36 48 10 47 15 10 23 33 36 38 50 10 25 29 24
26 47];
P22 = [0.6 0.62 0.74 0.78 0.65 0.62 0.59 0.80 0.69 0.6 0.81 0.83 0.6 0.69
0.59 0.59 0.81 0.78 0.6 0.67 0.80 0.79 0.73 0.83];
figure;
for i=1:length(P22)

P0 = [0,0];
P1 = [P11(i),0];
P2 = [P11(i),P22(i)];

vectarrow(P0,P1);
str = {'P [kW]'};
text(P11(i)/2,0.5,str)
xlim([0 12])
ylim([0 12])
hold on
vectarrow(P1,P2);
str = {'Q [kVAr]'};
text(P11(i)+0.5,P22(i)/2,str)
hold on
vectarrow(P0,P2);
str = {'S [kVA]'};
text(P11(i)/2,P22(i)/2,str)
pause(2);
end

Cd domingo
Vlp=500;
i1=100;
S=[10 30 45 50 20 45 42 36 48 10 47 15 10 23 33 36 38 50 10 25 29 24 26
47].*1000;
fp=[0.6 0.62 0.74 0.78 0.65 0.62 0.59 0.80 0.69 0.6 0.81 0.83 0.6 0.69
0.59 0.59 0.81 0.78 0.6 0.67 0.80 0.79 0.73 0.83];
for (i=1:24)
I(i)=S(i)./Vlp.*fp(i);
title('Corriente')
xlim([0 24]);
ylim([0 50]);
stairs(I);
drawnow;
pause(0.8)
end
pio=double([(0: length (I)-1)',I']);
% fp1=0.8
%
% P1=Vlp.*i1*cosd(fp1);
% S1=Vlp*i1;
% Q1=Vlp.*i1.*sind(fp1);
% Q11=P1*tand(30);
% C1=Q11./2*pi*60*Vlp^2
% figure(2);
% subplot(1,1,1)
% vectarrow([0 0],[P1 0])
% hold on
% vectarrow([P1 0],[P1 Q1])
% hold on
% vectarrow([0 0],[P1 Q1])
% hold on
% vectarrow([0 0],[P1 Q11])
%
% title('Compesador FP')
% ylabel('Potencia Reactiva')
% xlabel('Potencia Real');
Prueba
function varargout = prueba(varargin)
% PRUEBA MATLAB code for prueba.fig
% PRUEBA, by itself, creates a new PRUEBA or raises the existing
% singleton*.
%
% H = PRUEBA returns the handle to a new PRUEBA or the handle to
% the existing singleton*.
%
% PRUEBA('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in PRUEBA.M with the given input
arguments.
%
% PRUEBA('Property','Value',...) creates a new PRUEBA or raises the
% existing singleton*. Starting from the left, property value pairs
are
% applied to the GUI before prueba_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property
application
% stop. All inputs are passed to prueba_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 prueba

% Last Modified by GUIDE v2.5 20-Jan-2020 11:40:23

% Begin initialization code - DO NOT EDIT


gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @prueba_OpeningFcn, ...
'gui_OutputFcn', @prueba_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 prueba is made visible.


function prueba_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 prueba (see VARARGIN)
% Choose default command line output for prueba
handles.output = hObject;

% Update handles structure


guidata(hObject, handles);

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


% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = prueba_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;

% --- Executes on slider movement.


function Valor_Callback(hObject, eventdata, handles)
A=get(hObject,'Value');
Vlp=13800;
Qr=50000*sind(acosd(0.85));
S=[10 30 45 50 20 45 42 36 48 10 47 15 10 23 33 36 38 50 10 25 29 24 26
47].*1000;
fp=[0.6 0.62 0.74 0.78 0.65 0.62 0.59 0.80 0.69 0.6 0.81 0.83 0.6 0.69
0.59 0.59 0.81 0.78 0.6 0.67 0.80 0.79 0.73 0.83];
for (i=1:24)
I(i)=S(i)./Vlp.*fp(i);
title('Corriente')
xlim([0 24]);
ylim([0 50]);
stairs(I);
drawnow;
pause(0.8)
end
% hObject handle to Valor (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,'Value') returns position of slider


% get(hObject,'Min') and get(hObject,'Max') to determine range of
slider

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


function Valor_CreateFcn(hObject, eventdata, handles)
% hObject handle to Valor (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns
called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end

% --- Executes on slider movement.


function slider3_Callback(hObject, eventdata, handles)
% hObject handle to slider3 (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,'Value') returns position of slider


% get(hObject,'Min') and get(hObject,'Max') to determine range of
slider

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


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

% Hint: slider controls usually have a light gray background.


if isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end

You might also like