Challenge

Week 2 Air standard Cycle

Analysis of an Otto-cycle

AIM :- PYTHON program to plot p-v diagram and calculate thermal efficiency of an Otto cycle

OBJECTIVE:-

  • To plot the pressure and volume characteristics of an Otto cycle
  • To find the thermal efficiency of the Otto cycle
  • Understand the Ideal gas laws
  • Understand the nature of curve during the corresponding isentropic processes
  • Analyse the change in volume with respect to crank angle

PROBLEM STATEMENT:

  1. The efficiency of the cycle varies according to various engine geometric parameters
  2. Hence one need to come up with the relationship between the p-v characterictics and the geometrical parameters
  3. And also there is difference in the results between the idead and the actual curcumstance

INPUTS:-

  • v_swept = swept volume of cylinder
  • v_clearance = clearance volume of the cylinder
  • bore = bore diameter of cylinder
  • c_r = compression ratio
  • gamma = adiabatic index
  • V = volume of the cylinder
  • Theta = crank angle
  • Con_rod= length of the connect
  • Stroke = stroke length of the connecting rod
  • Eff_otto = thermal effifieny of the cycle
  • p1, v1, t1 = corresponding pressure, volume and temperature a point 1
  • p2, v2, t2 = corresponding pressure, volume and temperature a point 2
  • p3, v3, t3 = corresponding pressure, volume and temperature a point 3
  • p4, v4, t4 = corresponding pressure, volume and temperature a point 4

EQUATIONS USED:-

  1. `V_(swept)=π/4(D^2×L)`
  2. `v_(clr)=(v_(swept))/((c_r-1))`
  3. `P×V^γ= ∁`
  4. `(P×V)/T= ∁`
  5. `V/(V_(clr))= 1+ 1/2 (c_r-1)[R+1-cos⁡θ-√(R^2 - sin^2⁡θ )]`
  6. `a= (Stroke)/2`
  7. `R= L/a`
  8. `µ_(th=1- 1/(r^(γ-1))`

THEORY:-

  1. Otto cycle is an ideal cycle for spark-ignition reciprocating engines
  2. The cycle consists of four internally reversible process:

I) Isentropic Compression

II) Constant-volume heat addition

III) Isentropic expansion

IV) Constant-volume heat rejection

3. Specific Heat ratio (gamma) affects the thermal efficiency of an ideal otto cycle

4. Ther thermal efficiency of the cycle changes wrt to compression ratio as :

DETAILS:-

  • Programming language used: PYTHON
  • Concet used: Kinematics of engines and Gas Laws
  • Brief Overlay: The program takes help of a made-up function to calculate the various aspects of piston kinematics to help us plot the pressure-volume diagram of a ideal otto cycle.
  • Loops used : For

ASSUMPTIONS:

  1. The working fluid is air, Which Continuously circulates in a closed loop and always behaves as an ideal gas
  2. All the process that make up the cycle are internally irreversible
  3. The combustion process in replaced a heat addition process from an external source
  4. The exhaust process is replaced by a head rejection process that restores the working fluid to its initial stage

PROGRAM AND STEPWISE EXPLAINATION:

# OTTO CYCLE SIMULATION
import math
import matplotlib.pyplot as plt
from engine_kinematics import engine

# initial conditions
p1 = 101325
gamma = 1.4
t1 = 500
t3 = 2300
bore = 0.1
stroke = 0.1
con_rod = 0.15
cr = 12

# geometry
#swept volume
v_s = math.pi/4*bore*bore*stroke
# clearance volume
v_c = v_s/(cr-1)

# for state point 1
v1 = v_c + v_s

# for state point 2
v2 = v_c
# p2.v2^gamma = p1.v1^gamma
p2 = p1*pow(v1, gamma)/pow(v2, gamma)
# p1v1/t1 = p2v2/t2
rhs = p1*v1/t1
t2 = p2*v2/rhs
# invoking the function
V_compression = engine(bore, stroke, con_rod, cr, 180, 0)
# p_compression.v_compression^gamma = constant
const = p2*pow(v2,gamma)
P_compression = []
for v in V_compression:
    # to add the values in existing arrays
    P_compression.append(const/pow(v, gamma))


# for state point 3
v3 = v2
# p2v2/t2 = p3v3/t3
p3 = rhs*t3/v3
# invoking the function for compression
V_expansion = engine(bore, stroke, con_rod, cr, 0, 180)
# p_compression.v_compression^gamma = constant
const = p3*pow(v3,gamma)
P_expansion = []
for v in V_expansion:
    P_expansion.append(const/pow(v, gamma))


# for state point 4
v4 = v1
# p3v3^gamma = p4v4^gamma
p4 = p3*pow(v3, gamma)/pow(v4, gamma)
# p3v3/t3 = p4v4/t4
t4 = p4*v4/rhs

#plotting the p-v diagram
plt.plot([v2, v3],[p2, p3])
plt.plot(V_compression, P_compression)
plt.plot([v1, v4],[p1, p4])
plt.plot(V_expansion, P_expansion)
plt.xlabel('Volume')
plt.ylabel('Pressure')
plt.show()
# to calculate the thermal efficiency
# eff = 1/1-r^gamma
eff = (1-1/pow(cr,gamma-1)) * 100
print('The efficiency of the otto cycle is', eff,'%')

PROGRAM FUNCTION:

# function for engine kinematics
import math
import numpy

# template for the function
def engine(bore,stroke,con_rod,cr,crank_start,crack_end):
    a = stroke/2
    R = con_rod/a
    v_s = math.pi / 4 * bore * bore * stroke
    v_c = v_s / (cr - 1)
    sc = math.radians(crank_start) # starting crack
    ec = math.radians(crack_end)   # ending crank
    dtheta = numpy.linspace(sc,ec,50)  # crate array of theta
    V = []
    # it iterates through all the arrays of dtheta
    for i in range(len(dtheta)):
        theta = dtheta[i]

        term1 = 0.5*(cr-1)
        term2 = R + 1 - math.cos(theta)
        term3 = pow(R,2) - pow(math.sin(theta),2)
        term3 = pow(term3,0.5)
        V.append(v_c*(1+term1*(term2-term3)))
    return V  # to get the following output

** NOTE: SAVE THE FUNCTION CODE IN NEW FILE here (engine_kinematics)**

RESULTS AND DISCUSSION:

  • The Figure shows the plot for pressure-volume charavterictics of an otto cycle
  • Various processes are shown by differenct colors representing various processes
  • Hence it helps us in understanding the working of the cycle and visualisation of various process

This Sceen shot shows the calculated thermal efficiency of the otto cycle of given inputs

CONCLUSION:

  • Therefore we can calculate temperature at any point for given pressure and volume.
  • We can also confirm the IDEAL GAS LAW from the obtained plot.
  • We could also chnage the efficiency of the cycle by changing the input parameters.
  • We could analize the relationship between the curve characterictics and engine geometry.
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.