Cpb-us-w2.wpmucdn.com



%% Credit% Author: Zach Lohrman and Dustin West% Date: 02/25/2020% Engineering 1182 Ohio State University % AEV Performance Analysis file will convert data obtained from the AEV to a usable form. %% Future Updates% create while loop to automatically generate names and eliminate the need% for user input % create phase analysis for energy %% Read in variables f_ID = 'halfrun_pinkaev_v2.xlsx'; % file ID for variables to reference. must be changed each time tE = xlsread(f_ID,'A9:A497'); % time iE = xlsread(f_ID,'B9:B497'); % current vE = xlsread(f_ID,'C9:C497'); % voltage mE_cum = xlsread(f_ID,'D9:D497'); % marks from cumulative wheel counts mE_pos = xlsread(f_ID,'E9:E497'); % marks from position wheel counts vR = xlsread(f_ID,'B3:B3'); % reference voltage %% Convert variables to usable form t = tE/1000; % time I = (iE/1024)*vR*(1/0.185); % current V = (15*vE)/1024; % voltage D = 0.0124*mE_cum; % distance in meters P = 0.0124*mE_pos; % position in meters from starting point W = V.*I; % power in Watts J = W./t; % joules %% Calculate incremental energy n = numel(t);k = 1; % counter variable while k < n EJ(k) = ((J(k)+J(k+1))/2).*(t(k+1)-t(k)); % incremental energy k = k+1;endEJ = EJ'; %% Calculate total energy EJ_inf = EJ(2:488); % excludes the infinite value in the first cell of EJ for calculation purposes % make first number 9 lower than the length of the longest cellET = sum(EJ_inf); % total energy (J) E_p_kg = EJ_inf/0.250; % energy per kilogram (J/kg) %% Calculate velocity and kinetic energy k = 2; % counter variablev = zeros(489,1); % make first number 8 lower than the length of the longest cellwhile k <= n v(k) = (D(k)-D(k-1))./(t(k)-t(k-1)); % velocity m/s k = k+1;end EK = 0.5*0.250*(v.^2); % kinetic energy (joules) need to weigh AEV to confirm mass %% Calculate RPM, advance ratio, and propulsion efficiency RPM = (-64.59*(I.^2))+(1927.25*I)-84.56; % motor RPM j = (v./((RPM/60)*0.0762)); % propeller advance ratio for x = 1:n if j(x) <= 0.15 && W(x) == 0 j(x) = 0; elseif j(x) <= 0.15 && W(x) ~= 0 j(x) = 0.15; else j = j; end if RPM(x) <= 0 RPM(x) = 0; endend P_eff = (-454.37*(j.^3))+(321.58*(j.^2))+(22.603*j); % propulsion efficiency for x1 = 1:n if P_eff(x1) <= 0 P_eff(x1) = 0; endend %% Plot data points figure(1)plot(t,W,'b')grid onxlabel('Time, s')ylabel('Power, W')legend('Joules')title('Power vs Time') figure(2)plot(D,W,'r')grid on xlabel('Distance, m')ylabel('Power, W')title('Power vs Distance') figure(3)plot(D,v,'k')grid on xlabel('Distance m')ylabel('Velocity, m/s')title('Velocity vs Distance') figure(4)plot(D,EK,'m')grid on xlabel('Distance, m')ylabel('Kinetic Energy, J')title('Kinetic Energy vs Distance') figure(5)plot(D,P_eff,'g')grid on xlabel('Distance, m')ylabel('Propulsion Efficiency')title('Propulsion Efficiency vs Distance') %% Phase Analysis % Establish left and right boundaries of each phase. % Phase 1xR_1 = 7.6;iR_1 = knnsearch(t,xR_1);% Phase 2xR_2 = 16.2;iR_2 = knnsearch(t,xR_2);% Phase 3xR_3 = 24.7;iR_3 = knnsearch(t,xR_3); % Calculate energy in Joules of each phase.E_Phase_1 = sum(EJ_inf(1:iR_1)); Ekg_phase_1 = E_Phase_1/0.25;E_Phase_2 = sum(EJ_inf(iR_1:iR_2)); Ekg_phase_2 = E_Phase_2/0.25;E_Phase_3 = sum(EJ_inf(iR_2:iR_3)); Ekg_phase_3 = E_Phase_3/0.25;E_Phase_4 = sum(EJ_inf(iR_3:487)); Ekg_phase_4 = E_Phase_4/0.25; % value must be changed each time to ten less %% Write variables to Excel file xlswrite(f_ID,t,'G9:G497'); % time, s xlswrite(f_ID,I,'H9:H497'); % current, amps xlswrite(f_ID,V,'I9:I497'); % voltage, V xlswrite(f_ID,D,'J9:J497'); % distance, m xlswrite(f_ID,P,'K9:K497'); % position, m xlswrite(f_ID,W,'M9:M497'); % power supplied, W xlswrite(f_ID,EJ,'N9:N497'); % incremental energy, J xlswrite(f_ID,ET,'O9:O497'); % total energy, J xlswrite(f_ID,E_p_kg,'P9:P497'); % energy per kg, J/kg xlswrite(f_ID,v,'Q9:Q497'); % velocity, m/s xlswrite(f_ID,EK,'R9:R497'); % kinetic energy, J xlswrite(f_ID,RPM,'S9:S497'); % RPM xlswrite(f_ID,j,'T9:T497'); % advance ratio xlswrite(f_ID,P_eff,'U9:U497'); % propulsion efficiency ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download