Homework_3

m

School

Pennsylvania State University *

*We aren’t endorsed by this school

Course

431

Subject

Mechanical Engineering

Date

Jan 9, 2024

Type

m

Pages

3

Uploaded by ProfessorHornetMaster1035

Report
clc; clear; % Define the file name and open the file file_name = 'ME431 Homework 3 Ford Engine Data Fall 2023.txt'; fileID = fopen(file_name, 'r'); header = fgetl(fileID); % Read the data from the file, starting from the second line data = fscanf(fileID, '%f %f %f', [3, Inf]); fclose(fileID); % Transpose the data to store it as vertical columns data = data'; crank_angle = data(:, 1); pressure = data(:, 2); volume = data(:, 3); gamma = 1.27; % Adjust the crank angle data by adding 43 degrees crank_angle_adjusted = crank_angle; figure(1); % Subplot 1: Pressure (P) versus adjusted crank angle subplot(2, 1, 1); plot(crank_angle_adjusted, pressure, 'b'); xlabel('Crank Angle (degrees)'); ylabel('Pressure (P)'); title('Pressure (P) versus Crank Angle'); % Subplot 2: Volume (V) versus adjusted crank angle subplot(2, 1, 2); plot(crank_angle_adjusted, volume, 'r'); xlabel('Crank Angle (degrees)'); ylabel('Volume (V)'); title('Volume (V) versus Crank Angle'); % 2. P versus V figure(2); plot(volume, pressure, 'g'); xlabel('Volume (V)'); ylabel('Pressure (P)'); title('P versus V'); % 3. log(P) versus V figure(3); semilogy(volume, log(pressure), 'm'); xlabel('Volume (V)'); ylabel('log(P)'); title('log(P) versus V'); V_c = volume(44); fprintf('Clearence volume: %.2f Liters\n', V_c); %V_d = V_BC - V_c V_d = volume(224) - V_c;
fprintf('Volume displaced: %.2f Liters\n', V_d); % compresssion ratio = VBDC/VTDC cr = volume(224)/V_c; fprintf('Compression ratio: %.2f \n', cr); evo = 126; %degrees fprintf('Exhaust valve opening: %.2f degrees\n', evo); ivo = -10; %degrees fprintf('Intake valve opening: %.2f degrees\n', ivo); %% Problem 4 % Define the range of crank angles start_angle = -40; % Start angle in degrees end_angle = 100; % End angle in degrees % Find the indices within the specified range indices = (crank_angle_adjusted >= start_angle) & (crank_angle_adjusted <= end_angle); % Extract the data within the specified range selected_crank_angle = crank_angle_adjusted(indices); selected_pressure = pressure(indices); selected_volume = volume(indices); % Calculate PVγ within the specified range PV_gamma = selected_pressure .* (selected_volume.^gamma); % Create the Harrington Plot figure; plot(selected_crank_angle, PV_gamma, 'b'); xlabel('Crank Angle (degrees)'); ylabel('PV^\gamma'); title('Harrington Plot'); % Find the point on the Harrington plot corresponding to SOC and EOE SOC_index = find(PV_gamma == (PV_gamma(40)), 1, 'first'); EOE_index = find(PV_gamma(SOC_index:end) == (PV_gamma(80)), 1, 'first'); % Calculate θ_ο (spark firing angle) and ∆θ (burn duration) theta_o = selected_crank_angle(SOC_index); delta_theta = selected_crank_angle(SOC_index + EOE_index - 1) - theta_o; fprintf('Spark Firing Angle (θ_ο): %.2f degrees\n', theta_o); fprintf('Burn Duration (∆θ): %.2f degrees\n', delta_theta); %% Problem 5 % Convert pressure from bar to pascals pressure_pa = pressure * 1e5; % Conversion from bar to pascals % Convert volume from liters to cubic meters volume_m3 = volume * 0.001; % Conversion from liters to cubic meters
% Define the crank angles for the intake and exhaust strokes start_intake_angle = crank_angle(224); end_intake_angle = crank_angle(360+44); start_exhaust_angle = crank_angle(end_intake_angle + 180); end_exhaust_angle = crank_angle(719); % Identify the intake and exhaust strokes using crank angle data intake_stroke = (crank_angle >= start_intake_angle) & (crank_angle <= end_intake_angle); exhaust_stroke = (crank_angle >= start_exhaust_angle) & (crank_angle <= end_exhaust_angle); % Calculate the Indicated Work (W_ind) using the pressure and volume data in SI units ind_work = trapz(volume_m3, pressure_pa); % Calculate the Pumping Work (W_pump) for the intake and exhaust strokes in SI units pump_work = -trapz(volume_m3(intake_stroke | exhaust_stroke), pressure_pa(intake_stroke | exhaust_stroke)); % Calculate the Net Work (W_net) in SI units net_work = ind_work - pump_work; % Calculate Mechanical Efficiency (η_mech) mechanical_efficiency = net_work / ind_work; % Display the results fprintf('Indicated Work: %.2f J\n', ind_work); fprintf('Pumping Work: %.2f J\n', pump_work); fprintf('Net Work: %.2f J\n', net_work); fprintf('Mechanical Efficiency: %.2f\n', mechanical_efficiency); % Convert engine displacement from liters to cubic meters V_d = V_d * 0.001; % Conversion to cubic meters % Calculate IMEP in pascals (Pa) IMEP_pa = ind_work / V_d; IMEP_kpa = IMEP_pa / 1000; % Display the IMEP in both pascals and kilopascals fprintf('IMEP (kPa): %.2f kPa\n', IMEP_kpa);
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help