%===============================================================
% Name: Ashwin Rajgopal, Blake Kanoy, Alex Beutel & Daniel Fahmi
% Date: 2/09/17
% Class: ENGR 1182.01
%
% Program Title: Performance Analysis
%
% Program description: Convert Excel data and analyze it.
%
%================================================================
% Load EEPROM data into MATLAB workspace
data = xlsread('lab04data.xlsx');
t = data(:,1);
i = data(:,2);
v = data(:,3);
cwc = data(:,4);
pwc = data(:,5);
t = t / 1000;
i = (i/1024)*2.46*(1/.185);
v = 15*v/1024;
cwc = cwc * .0124;
pwc = pwc * .0124;
p = v .* i;
figure(1);
plot(t, p, 'LineWidth', 2);
grid on
box on
title('AEV Power Usage of Time');
xlabel('Time (s)');
ylabel('Power (Watts)');
% Phase 1
xL = 0; % Right x-coordinate
xR = .18; % Left x-coordinate
iL = knnsearch(t,xL); % Element index of left point
iR = knnsearch(t,xR); % Element index of right point
P1 = p(iL:iR); % Power values of Phase 1
t1 = t(iL:iR); % Time values of Phase 1
% Compute incremental energy of Phase 1
ph1 = [];
for i=1:size(P1)-1
ph1(i) = ((P1(i) + P1(i+1))/2) * (t1(i+1)-t1(i));
end
% Compute total energy of Phase 1
ph1tot = sum(ph1)
% Phase 2
xL = .18; % Right x-coordinate
xR = 6.93; % Left x-coordinate
iL = knnsearch(t,xL); % Element index of left point
iR = knnsearch(t,xR); % Element index of right point
P2 = p(iL:iR); % Power values of Phase 2
t2 = t(iL:iR); % Time values of Phase 2
% Compute incremental energy of Phase 2
ph2 = [];
for i=1:size(P2)-1
ph2(i) = ((P2(i) + P2(i+1))/2) * (t2(i+1)-t2(i));
end
% Compute total energy of Phase 2
ph2tot = sum(ph2)
% Phase 3
xL = 6.93; % Right x-coordinate
xR = 6.963; % Left x-coordinate
iL = knnsearch(t,xL); % Element index of left point
iR = knnsearch(t,xR); % Element index of right point
P3 = p(iL:iR); % Power values of Phase 3
t3 = t(iL:iR); % Time values of Phase 3
% Compute incremental energy of Phase 3
ph3 = [];
for i=1:size(P3)-1
ph3(i) = ((P3(i) + P3(i+1))/2) * (t3(i+1)-t3(i));
end
% Compute total energy of Phase 3
ph3tot = sum(ph3)
% Phase 4
xL = 6.963; % Right x-coordinate
xR = 9.903; % Left x-coordinate
iL = knnsearch(t,xL); % Element index of left point
iR = knnsearch(t,xR); % Element index of right point
P4 = p(iL:iR); % Power values of Phase 4
t4 = t(iL:iR); % Time values of Phase 4
% Compute incremental energy of Phase 4
ph4 = [];
for i=1:size(P4)-1
ph4(i) = ((P4(i) + P4(i+1))/2) * (t4(i+1)-t4(i));
end
% Compute total energy of Phase 4
ph4tot = sum(ph4)
Related