Contents

Team KAB's Analysis of Lab 4

Programmer: Aaron Klapheck

% Lab #4 The Reciprocating Air Compressor 26-Sep-08
clear, clc, home
fprintf('The date and time: %s \n', datestr(now))
The date and time: 30-Sep-2008 13:29:37 

Data

% This section consists of data either recorded by hand or by the computer
% used in this experiment.

% Recorded data came from the excel file Data.xls.
% Computer generated data came from the excel file KAB_COMP_LAB.xls.

% The following data is constant throughout the experiment (from Data.xls).
P_atm = 30;     % Atmospheric Pressure in inches of Hg (inHg).
T_room = 23;    % Room temperature in degrees Celcius (C).
N = 150;        % Angular acceleration in revolutions per minute (rpm).
d_low = 7;      % Diameter of low pressure piston in inches (in).
d_high = 3.125; % Diameter of high pressure piston in inches (in).
L = 5;          % Distance the piston travels in one direction measured
                % in inches (in) aka stroke.


% The following data changes with time.
% There are a total of 13 variables being measured. Of those 13, 3 are
% being measured by hand (Voltage, Current, and Power), the 10 others are
% being measured by the computer. For the variables being measured by hand
% there is only one measurement being taken for each "steady-state" reached.
% Whereas the computer takes multiple measurements at each steady state so
% the values being measured are then averaged at each of the five
% steady-states. The data can be distinguished from each other according to
% the different receiver pressure values which are P5. In other words each
% P5 value corresponds to one steady state.
%
% Units:
% Power in kiloWatts (kW)
% Voltage in Volts (V)
% Current in Amps (A)
% Temperature in degrees Celcius (C)
% Pressure in pounds per square inch (psi)
% Ch15 refers to inches of water (in H2O)
%
% T's and P's:
% T1 is the Temperature out of the low pressure Cylinder
% T4 is the Temperature out of the high pressure Cylinder
% T7 is the Temperature into the low pressure Cylinder
% T9 is the Temperature into the high pressure Cylinder
% P1 is the Pressure out of the low pressure Cylinder
% P2 is the Pressure into the high pressure Cylinder
% P3 is the Pressure out of the high pressure Cylinder
% P5 is the Pressure in the receiver tank

%---- Steady-State 1 at P5 = 164 psi
%
% Done by hand (from Data.xls).
Power_1 = 5.25;
Voltage_1 = 490;
Current_1 = 11.5;

% Done by computer (from KAB_COMP_LAB.xls).
T1_1 = 76.*ones(1,13);
T4_1 = 78.*ones(1,13);
T7_1 = 25.*ones(1,13);
T9_1 = [27, 27, 27, 28, 27, 27, 27, 27, 27, 27, 27, 27, 27];
P1_1 = 51.*ones(1,13);
P2_1 = 49.*ones(1,13);
P3_1 = 146.*ones(1,13);
P5_1 = 164.*ones(1,13);
Ch15_1 = [2.83, 2.94, 3.37, 2.78, 3, 3.36, 2.76, 3.04, 3.34, 2.73, ...
    3.09, 3.3, 2.71];


%---- Steady-State 2 at P5 = 208 psi

% Done by hand (from Data.xls).
Power_2 = 6;
Voltage_2 = 490;
Current_2 = 12;

% Done by computer (from KAB_COMP_LAB.xls).
T1_2 = 76.*ones(1,12);
T4_2 = [81, 80, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81];
T7_2 = 25.*ones(1,12);
T9_2 = 30.*ones(1,12);
P1_2 = 53.*ones(1,12);
P2_2 = 52.*ones(1,12);
P3_2 = [190   188   190   188   188   190   190   188   193   190   188   188];
P5_2 = [208   208   208   208   208   208   208   208   208   210   208   208];
Ch15_2 = [1.88
2.02
2.22
1.87
2.04
2.19
1.87
2.1
2.17
1.86
2.1
2.16];



%----- Steady-State 3 at P5 = 247 psi

% Done by hand (from Data.xls).
Power_3 = 6.5;
Voltage_3 = 490;
Current_3 = 12.5;

% Done by computer (from KAB_COMP_LAB.xls).
T1_3 = [77    77    77    77    77    78    77    77    77    77    77    77    77    77];
T4_3 = [84    83    83    83    84    83    83    83    84    84    84    84    84    84];
T7_3 = 25.*ones(1,14);
T9_3 = [31    31    30    30    30    30    30    30    30    30    30    30    30    30];
P1_3 = [56    56    56    56    56    56    56    56    56    56    57    56    56    56
];
P2_3 = 55.*ones(1,14);
P3_3 = [227   227   227   227   227   227   227   227   227   227   227   227   229   227];
P5_3 = [247   247   244   247   247   247   247   247   247   247   247   247   247   249];
Ch15_3 = [1.44
1.85
1.6
1.44
1.85
1.6
1.43
1.85
1.62
1.43
1.84
1.62
1.43
1.83];



%----- Steady-State 4 at P5 = 286 psi

% Done by hand (from Data.xls).
Power_4 = 6.75;
Voltage_4 = 490;
Current_4 = 13;

% Done by computer (from KAB_COMP_LAB.xls).
T1_4 = [78    78    78    78    78    78    78    78    78    77    78];
T4_4 = 86.*ones(1,11);
T7_4 = 25.*ones(1,11);
T9_4 = [32    32    32    32    32    32    32    31    31    31    31];
P1_4 = 59.*ones(1,11);
P2_4 = 58.*ones(1,11);
P3_4 = [266   266   264   266   266   266   266   266   266   266   266];
P5_4 = [283   283   286   283   283   286   286   286   286   286   286];
Ch15_4 = [1.23
1.55
1.2
1.21
1.54
1.22
1.19
1.54
1.26
1.17
1.53];



%----- Steady-State 5 at P5 = 325 psi

% Done by hand (from Data.xls).
Power_5 = 7.25;
Voltage_5 = 490;
Current_5 = 14;

% Done by computer (from KAB_COMP_LAB.xls).
T1_5 = 78.*ones(1,12);
T4_5 = 89.*ones(1,12);
T7_5 = 25.*ones(1,12);
T9_5 = [32    32    32    32    32    32    32    32    31    32    32    32];
P1_5 = 62.*ones(1,12);
P2_5 = 61.*ones(1,12);
P3_5 = [305   305   305   305   305   305   305   308   305   305   305   305];
P5_5 = 325.*ones(1,12);
Ch15_5 = [1.17
0.96
1.23
1.22
0.98
1.17
1.24
1.01
1.12
1.26
1.04
1.07];

Calculations

% 1. Get average values for the variables T1, T4, T7, T9, P1, P2, P3, P5,
% and Ch15 for each of the five states measured.

%Means for steady-state 1, P5_1 = 164 psi = 1130.8 kPa
T1_1 = mean(T1_1); T4_1 = mean(T4_1); T7_1 = mean(T7_1); T9_1 = mean(T9_1);
P1_1 = mean(P1_1); P2_1 = mean(P2_1); P3_1 = mean(P3_1); P5_1 = mean(P5_1);
Ch15_1 = mean(Ch15_1);

%Means for steady-state 2, P5_2 = 208 psi = 1435.3 kPa
T1_2 = mean(T1_2); T4_2 = mean(T4_2); T7_2 = mean(T7_2); T9_2 = mean(T9_2);
P1_2 = mean(P1_2); P2_2 = mean(P2_2); P3_2 = mean(P3_2); P5_2 = mean(P5_2);
Ch15_2 = mean(Ch15_2);

%Means for steady-state 3, P5_3 = 247 psi = 1702.6 kPa
T1_3 = mean(T1_3); T4_3 = mean(T4_3); T7_3 = mean(T7_3); T9_3 = mean(T9_3);
P1_3 = mean(P1_3); P2_3 = mean(P2_3); P3_3 = mean(P3_3); P5_3 = mean(P5_3);
Ch15_3 = mean(Ch15_3);

%Means for steady-state 4, P5_4 = 286 psi = 1964.4 kPa
T1_4 = mean(T1_4); T4_4 = mean(T4_4); T7_4 = mean(T7_4); T9_4 = mean(T9_4);
P1_4 = mean(P1_4); P2_4 = mean(P2_4); P3_4 = mean(P3_4); P5_4 = mean(P5_4);
Ch15_4 = mean(Ch15_4);

%Means for steady-state 5, P5_5 = 325 psi = 2240.9 kPa
T1_5 = mean(T1_5); T4_5 = mean(T4_5); T7_5 = mean(T7_5); T9_5 = mean(T9_5);
P1_5 = mean(P1_5); P2_5 = mean(P2_5); P3_5 = mean(P3_5); P5_5 = mean(P5_5);
Ch15_5 = mean(Ch15_5);

T1 = [T1_1; T1_2; T1_3; T1_4; T1_5];
T4 = [T4_1; T4_2; T4_3; T4_4; T4_5];
T7 = [T7_1; T7_2; T7_3; T7_4; T7_5];
T9 = [T9_1; T9_2; T9_3; T9_4; T9_5];
P1 = [P1_1; P1_2; P1_3; P1_4; P1_5];
P2 = [P2_1; P2_2; P2_3; P2_4; P2_5];
P3 = [P3_1; P3_2; P3_3; P3_4; P3_5];
P5 = [P5_1; P5_2; P5_3; P5_4; P5_5];
Ch15 = [Ch15_1; Ch15_2; Ch15_3; Ch15_4; Ch15_5];

Power_sup = [Power_1; Power_2; Power_3; Power_4; Power_5];


% 2. Get Pi, Ti, Pd, and Td for both the low pressure cylinder and
% the high pressure cylinder.

% Low pressure cylinder:
Ti_low = T_room;
Td_low = T1;
% Pi_low = P_atm
Pi_low = 14.7;      % given that P_atm = 29.92 inHg = 14.7 psi
Pd_low = P1;

% High pressure cylinder:
Ti_high = T7;
Td_high = T4;
Pi_high = P2;
Pd_high = P3;



% 3. Convert all values to metric.

L = L/39.37;                % Meters
P5 = 6.895.*P5;             % kPa
T9 = 6.895.*T9;             % kPa

% Low pressure cylinder:
Ti_low = T_room + 273.15;   % Kelvin
Td_low = T1 + 273.15;       % Kelvin
Pi_low = 101;               % given that P_atm = 29.92 inHg = 101kPa
Pd_low = 6.895.*P1;         % kPa
d_low = d_low/39.37;        % Meters

% High pressure cylinder:
Ti_high = T7 + 273.15;      % Kelvin
Td_high = T4 + 273.15;      % Kelvin
Pi_high = 6.895.*P2;        % kPa
Pd_high = 6.895.*P3;        % kPa
d_high = d_high/39.37;      % Meters



% 4. Find n, Vi, and Vd.

% Rearrange Td/Ti = (Pd/Pi)^((n-1)/n) to get
% n = -1/(ln(Td/Ti)/ln(Pd/Pi) - 1)... (eqn 1).
% Volume displaced by Piston/stroke (D): D = (L*pi*d^2)/4 ... (eqn 2).
% Assume: Vc = 0.05*Vi ... (eqn 3).
% Given: D = Vi - Vc ... (eqn 4).
% Combine (eqn 3) and (eqn 4): D = .95*Vi, Vi = D/.95 ... (eqn 5)
% Definition of polytropic process: Vi/Vd = (Pd/Pi)^(1/n) ... (eqn 6)

fprintf('%%%%%%4. First, get Vi through (eqn 2) and (eqn 5).%%%%%% \n')
D_low = (L*pi*d_low^2)/4     % units: m*m^2 = m^3
D_high = (L*pi*d_high^2)/4   % units: m*m^2 = m^3

Vi_low = D_low/.95     % units: m^3
Vi_high = D_high/.95   % units: m^3


fprintf('%%%%%%4. Second, use (eqn 6) and (eqn 1) to find Vd.%%%%%% \n')
n_low = -1./(log(Td_low./Ti_low)./log(Pd_low./Pi_low) - 1)
n_high = -1./(log(Td_high./Ti_high)./log(Pd_high./Pi_high) - 1)

Vd_low = Vi_low./(Pd_low./Pi_low).^(1./n_low)       % units: kPa
Vd_high = Vi_high./(Pd_high./Pi_high).^(1./n_high)  % units: kPa



% 5. Obtain constants (C's)

fprintf('%%%%%%5. Use P*V^n = C to solve for the constant C.%%%%%% \n')
C_low = Pi_low.*Vi_low.^n_low       % Check both i and d values to make
C_low = Pd_low.*Vd_low.^n_low       % sure they lead to the same C values.

C_high = Pi_high.*Vi_high.^n_high       % Check both i and d values to make
C_high = Pd_high.*Vd_high.^n_high       % sure they lead to the same C values.
%%%4. First, get Vi through (eqn 2) and (eqn 5).%%% 

D_low =

    0.0032


D_high =

  6.2844e-004


Vi_low =

    0.0033


Vi_high =

  6.6152e-004

%%%4. Second, use (eqn 6) and (eqn 1) to find Vd.%%% 

n_low =

    1.1520
    1.1468
    1.1428
    1.1391
    1.1339


n_high =

    1.1763
    1.1535
    1.1448
    1.1393
    1.1374


Vd_low =

    0.0011
    0.0011
    0.0010
    0.0010
    0.0009


Vd_high =

  1.0e-003 *

    0.2615
    0.2159
    0.1916
    0.1739
    0.1606

%%%5. Use P*V^n = C to solve for the constant C.%%% 

C_low =

    0.1408
    0.1450
    0.1484
    0.1516
    0.1561


C_low =

    0.1408
    0.1450
    0.1484
    0.1516
    0.1561


C_high =

    0.0615
    0.0771
    0.0869
    0.0954
    0.1018


C_high =

    0.0615
    0.0771
    0.0869
    0.0954
    0.1018

Graph of 3 Polytropic processes from i to d for the low pressure pump

% Three processes have bean chosen to establish the general trend for how
% P5 (receiver tank pressure) values effect the polytropic processes. The
% three P5 values chosen are the smallest, middle, and larges values.

V_domain_1 = [Vd_low(1,1):0.01*Vd_low(1,1):Vi_low(1,1)];
P_range_1 = C_low(1,1)./(V_domain_1.^n_low(1,1));

V_domain_3 = [Vd_low(3,1):0.01*Vd_low(3,1):Vi_low(1,1)];
P_range_3 = C_low(3,1)./(V_domain_3.^n_low(3,1));

V_domain_5 = [Vd_low(5,1):0.01*Vd_low(5,1):Vi_low(1,1)];
P_range_5 = C_low(5,1)./(V_domain_5.^n_low(5,1));

% Using "x"'s and "."'s because regulare lines will not appear in the
% graph (they will be hidden underneith the other lines).
plot(V_domain_1, P_range_1, '.', ...
    V_domain_3, P_range_3, 'x', V_domain_5, P_range_5,'r'), ...
    grid, axis([0.0005 .004 50 500]), ...
    title('Graph of LP Pump PV^n = C for three P5 values'), ...
    xlabel('Volume (m^3)'), ylabel('Pressure (N/m^2)'), ...
    legend('P5 = 1130.8 kPa', 'P5 = 1702.6 kPa', 'P5 = 2240.9 kPa')

Graph of Polytropic processes from i to d for the high pressure pump

% Three processes have bean chosen to establish the general trend for how
% P5 (receiver tank pressure) values effect the polytropic processes. The
% three P5 values chosen are the smallest, middle, and larges values.

V_domain_1 = [Vd_high(1,1):0.01*Vd_high(1,1):Vi_high(1,1)];
P_range_1 = C_high(1,1)./(V_domain_1.^n_high(1,1));

V_domain_3 = [Vd_high(3,1):0.01*Vd_high(3,1):Vi_high(1,1)];
P_range_3 = C_high(3,1)./(V_domain_3.^n_high(3,1));

V_domain_5 = [Vd_high(5,1):0.01*Vd_high(5,1):Vi_high(1,1)];
P_range_5 = C_high(5,1)./(V_domain_5.^n_high(5,1));

plot(V_domain_1, P_range_1, V_domain_3, P_range_3, V_domain_5, P_range_5), ...
    grid, axis([0.0001 .00075 250 2200]), ...
    title('Graph of HP Pump PV^n = C for three P5 values'), ...
    xlabel('Volume (m^3)'), ylabel('Pressure (N/m^2)'), ...
    legend('P5 = 1130.8 kPa', 'P5 = 1702.6 kPa', 'P5 = 2240.9 kPa')

Find the work done in a single, double-acting cylinder

% polytropic work: Wid = (PdVd - PiVi)/(1-n) - Pi(Vd - Vi) ... (eqn 7)
% Pc = Pd ... (eqn 8)
% Work done per stroke: Wdc = Pc(Vc - Vd) - Pi(Vc - Vd) ... (eqn 9)
% Total work for complete cycle: W = Wid + Wdc ... (eqn 10)

% W(low-pressure):

% use (eqn 7)
Wid_low = ((Pd_low.*Vd_low - Pi_low.*Vi_low)./(1-n_low) - ...
    Pi_low.*(Vd_low - Vi_low)).*1000    % J per isentropic compression
% use (eqn 3)
Vc_low = 0.05.*Vi_low;
% use (eqn 8)
Pc_low = Pd_low;
% use (eqn 9)
Wdc_low = (Pc_low.*(Vc_low - Vd_low) - ...
    Pi_low.*(Vc_low - Vd_low)).*1000     % J/Stroke
% use (eqn 10)
W_low = Wdc_low + Wid_low                % J


% W(high-pressure)

% use (eqn 7)
Wid_high = ((Pd_high.*Vd_high - Pi_high.*Vi_high)./(1-n_high) - ...
    Pi_high.*(Vd_high - Vi_high)).*1000    % J per isentropic compression
% use (eqn 3)
Vc_high = 0.05.*Vi_high;
% use (eqn 8)
Pc_high = Pd_high;
% use (eqn 9)
Wdc_high = (Pc_high.*(Vc_high - Vd_high) - ...
    Pi_high.*(Vc_high - Vd_high)).*1000     % J/Stroke
% use (eqn 10)
W_high = Wdc_high + Wid_high                % J
Wid_low =

 -172.8936
 -182.6275
 -197.0478
 -210.4010
 -223.7432


Wdc_low =

 -240.1193
 -242.1145
 -245.4795
 -247.9820
 -249.4018


W_low =

 -413.0129
 -424.7420
 -442.5273
 -458.3831
 -473.1450


Wid_high =

  -90.2243
 -130.0337
 -162.2201
 -193.5202
 -224.1315


Wdc_high =

 -152.7613
 -172.9690
 -188.2101
 -201.7448
 -214.7157


W_high =

 -242.9855
 -303.0027
 -350.4302
 -395.2650
 -438.8471

Find the total work and power done in a 2-stage double-acting compressor

% Total work done by both compressers: W_tot = W_low + W_high ... (eqn 11)
% Power consumed: P = W_tot * 2strokes/rev * N / (60min/sec) / (1000J/kJ) ... (eqn 12)

% use (eqn 11)
W_tot = W_low + W_high          % J

% use (eqn 12)
P_tot = W_tot.*2.*N./60./1000   % kW
W_tot =

 -655.9984
 -727.7447
 -792.9575
 -853.6481
 -911.9922


P_tot =

   -3.2800
   -3.6387
   -3.9648
   -4.2682
   -4.5600

Compare the supplied power consumed to the calculated one.

% Fit the data to a line
P_tot_line = polyfit(P5, abs(P_tot), 1)
P_sup_line = polyfit(P5, abs(Power_sup), 1)

fprintf('P_calc: Power = %g*P5 + %g \n', P_tot_line)
fprintf('P_sup: Power = %g*P5 + %g \n', P_sup_line)

eval = [P5(1,1):10:P5(5,1)];
P_calc_line = polyval(P_tot_line, eval);
P_sup_line = polyval(P_sup_line, eval);

% Graph Power Consumed as a function of Receiver Tank Pressure (P5)
plot(P5, abs(P_tot), 'o', eval, P_calc_line, P5, Power_sup, 'x', eval, P_sup_line), ...
    xlabel('P5, Receiver Tank Pressure (kPa)'), ...
    ylabel('Power Consumed (kW)'), ...
    text(1600, 6.0, 'Power sup  = 0.00173413*P5 + 3.411 '), text(1600, 3.6, 'Power calc = 0.00116031*P5 + 1.97585 '), ...
    title('Power Supplied and Calculated vs. Receiver Pressure'), ...
    legend('Power calc.', 'Line fit', 'Power supplied', 'Line fit', 'Location', 'NorthWest')
P_tot_line =

    0.0012    1.9759


P_sup_line =

    0.0017    3.4110

P_calc: Power = 0.00116031*P5 + 1.97585 
P_sup: Power = 0.00173413*P5 + 3.411