Project

PV Diagram visualizer for plotting Otto Cycle and Computing the Thermal Efficiency of the cycle

clear all
close all
clc

%inputs
P1=101325;
T1=500;
T3=2300;

%Engine Parameters
bore=0.1;
stroke=0.1;
connr_len=0.15;
cr=12;

%Calculations
Swept_vol=(3.14/4)*bore^2*stroke
Clear_vol=Swept_vol/(cr-1)
v1=Swept_vol+Clear_vol
v2=Clear_vol

% State 2 Calculations
constant=P1*v1^1.4;
v_compression=engine_kinematics(bore,stroke,connr_len,cr,180,0);
P_compression=constant./v_compression.^1.4
P2=P1*cr^1.4; %isentropic process
T2=(P2/P1)*T1/cr;

% State 3 Calculations
v3=v2;
P3=P2*(T3/T2)

%State 4 Calculations
v4=v1;
constant2=P3*v3^1.4;
v_expansion=engine_kinematics(bore,stroke,connr_len,cr,0,180);
P_expansion=constant2./v_expansion.^1.4
P4=P3/(cr^1.4) %isentropic process
T4=(P3/P4)*T3/cr

hold on
plot([v2,v3],[P2,P3])
plot([v1,v4],[P1,P4])
plot(v_compression,P_compression)
plot(v_expansion,P_expansion)

%Thermal Efficiency of the Engine
eeta=1-(1/(cr^(1.4-1)))
Swept_vol =

   7.8500e-04


Clear_vol =

   7.1364e-05


v1 =

   8.5636e-04


v2 =

   7.1364e-05


v_s =

   7.8540e-04


v_c =

   7.1400e-05


theta =

  Columns 1 through 7

  180.0000  178.1818  176.3636  174.5455  172.7273  170.9091  169.0909

  Columns 8 through 14

  167.2727  165.4545  163.6364  161.8182  160.0000  158.1818  156.3636

  Columns 15 through 21

  154.5455  152.7273  150.9091  149.0909  147.2727  145.4545  143.6364

  Columns 22 through 28

  141.8182  140.0000  138.1818  136.3636  134.5455  132.7273  130.9091

  Columns 29 through 35

  129.0909  127.2727  125.4545  123.6364  121.8182  120.0000  118.1818

  Columns 36 through 42

  116.3636  114.5455  112.7273  110.9091  109.0909  107.2727  105.4545

  Columns 43 through 49

  103.6364  101.8182  100.0000   98.1818   96.3636   94.5455   92.7273

  Columns 50 through 56

   90.9091   89.0909   87.2727   85.4545   83.6364   81.8182   80.0000

  Columns 57 through 63

   78.1818   76.3636   74.5455   72.7273   70.9091   69.0909   67.2727

  Columns 64 through 70

   65.4545   63.6364   61.8182   60.0000   58.1818   56.3636   54.5455

  Columns 71 through 77

   52.7273   50.9091   49.0909   47.2727   45.4545   43.6364   41.8182

  Columns 78 through 84

   40.0000   38.1818   36.3636   34.5455   32.7273   30.9091   29.0909

  Columns 85 through 91

   27.2727   25.4545   23.6364   21.8182   20.0000   18.1818   16.3636

  Columns 92 through 98

   14.5455   12.7273   10.9091    9.0909    7.2727    5.4545    3.6364

  Columns 99 through 100

    1.8182         0


P_compression =

   1.0e+06 *

  Columns 1 through 7

    0.1013    0.1013    0.1013    0.1014    0.1016    0.1018    0.1020

  Columns 8 through 14

    0.1023    0.1027    0.1031    0.1035    0.1040    0.1045    0.1051

  Columns 15 through 21

    0.1057    0.1064    0.1072    0.1080    0.1088    0.1098    0.1108

  Columns 22 through 28

    0.1118    0.1130    0.1142    0.1155    0.1169    0.1184    0.1199

  Columns 29 through 35

    0.1216    0.1233    0.1252    0.1272    0.1293    0.1316    0.1340

  Columns 36 through 42

    0.1365    0.1392    0.1420    0.1450    0.1483    0.1517    0.1553

  Columns 43 through 49

    0.1592    0.1633    0.1677    0.1724    0.1773    0.1827    0.1883

  Columns 50 through 56

    0.1944    0.2009    0.2078    0.2153    0.2232    0.2318    0.2410

  Columns 57 through 63

    0.2509    0.2615    0.2730    0.2853    0.2987    0.3131    0.3288

  Columns 64 through 70

    0.3457    0.3641    0.3840    0.4057    0.4294    0.4551    0.4833

  Columns 71 through 77

    0.5140    0.5476    0.5845    0.6249    0.6692    0.7179    0.7714

  Columns 78 through 84

    0.8302    0.8948    0.9657    1.0437    1.1292    1.2227    1.3249

  Columns 85 through 91

    1.4361    1.5566    1.6863    1.8249    1.9718    2.1256    2.2843

  Columns 92 through 98

    2.4452    2.6049    2.7589    2.9024    3.0300    3.1362    3.2163

  Columns 99 through 100

    3.2660    3.2829


P3 =

   5.5931e+06


v_s =

   7.8540e-04


v_c =

   7.1400e-05


theta =

  Columns 1 through 7

         0    1.8182    3.6364    5.4545    7.2727    9.0909   10.9091

  Columns 8 through 14

   12.7273   14.5455   16.3636   18.1818   20.0000   21.8182   23.6364

  Columns 15 through 21

   25.4545   27.2727   29.0909   30.9091   32.7273   34.5455   36.3636

  Columns 22 through 28

   38.1818   40.0000   41.8182   43.6364   45.4545   47.2727   49.0909

  Columns 29 through 35

   50.9091   52.7273   54.5455   56.3636   58.1818   60.0000   61.8182

  Columns 36 through 42

   63.6364   65.4545   67.2727   69.0909   70.9091   72.7273   74.5455

  Columns 43 through 49

   76.3636   78.1818   80.0000   81.8182   83.6364   85.4545   87.2727

  Columns 50 through 56

   89.0909   90.9091   92.7273   94.5455   96.3636   98.1818  100.0000

  Columns 57 through 63

  101.8182  103.6364  105.4545  107.2727  109.0909  110.9091  112.7273

  Columns 64 through 70

  114.5455  116.3636  118.1818  120.0000  121.8182  123.6364  125.4545

  Columns 71 through 77

  127.2727  129.0909  130.9091  132.7273  134.5455  136.3636  138.1818

  Columns 78 through 84

  140.0000  141.8182  143.6364  145.4545  147.2727  149.0909  150.9091

  Columns 85 through 91

  152.7273  154.5455  156.3636  158.1818  160.0000  161.8182  163.6364

  Columns 92 through 98

  165.4545  167.2727  169.0909  170.9091  172.7273  174.5455  176.3636

  Columns 99 through 100

  178.1818  180.0000


P_expansion =

   1.0e+06 *

  Columns 1 through 7

    5.5892    5.5604    5.4757    5.3394    5.1585    4.9413    4.6970

  Columns 8 through 14

    4.4348    4.1630    3.8890    3.6188    3.3570    3.1069    2.8709

  Columns 15 through 21

    2.6500    2.4450    2.2557    2.0817    1.9224    1.7769    1.6442

  Columns 22 through 28

    1.5233    1.4133    1.3133    1.2222    1.1393    1.0639    0.9951

  Columns 29 through 35

    0.9324    0.8751    0.8227    0.7748    0.7310    0.6907    0.6538

  Columns 36 through 42

    0.6198    0.5885    0.5597    0.5331    0.5085    0.4858    0.4647

  Columns 43 through 49

    0.4452    0.4271    0.4103    0.3946    0.3801    0.3665    0.3538

  Columns 50 through 56

    0.3420    0.3310    0.3206    0.3110    0.3019    0.2934    0.2855

  Columns 57 through 63

    0.2780    0.2710    0.2644    0.2582    0.2524    0.2469    0.2418

  Columns 64 through 70

    0.2369    0.2324    0.2281    0.2240    0.2202    0.2166    0.2132

  Columns 71 through 77

    0.2100    0.2070    0.2042    0.2015    0.1990    0.1966    0.1944

  Columns 78 through 84

    0.1923    0.1904    0.1886    0.1869    0.1853    0.1838    0.1824

  Columns 85 through 91

    0.1812    0.1800    0.1789    0.1779    0.1770    0.1762    0.1754

  Columns 92 through 98

    0.1748    0.1742    0.1737    0.1733    0.1730    0.1727    0.1725

  Columns 99 through 100

    0.1724    0.1724


P4 =

   1.7251e+05


T4 =

   6.2144e+03


eeta =

    0.6299

\"\"


Published with MATLAB® R2017b

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.