Project

Air Standard Cycle -Python

Air standard Cycle Using Python

1.AIM: To Plot the Air standard cycle for Pressure V/s Volume & calculate Thermal Efficiency

2.ASSUMPTIONS:

  1. The value of gamma`(γ)=1.4`
  2. The value of temperature after compression i.e T3 =2100k
  3. P1 is considered at atmosphere i.e 101325 Pa
  4. T1=450K

3.GEOMETRIC ASSMUPTIONS:

  1. Bore Diameter = 0.12 m
  2. Stroke = 0.12m
  3. Compression Ratio (CR)= 12
  4. Length of Connecting Rod =0.2 m

4.OBJECTIVES:

  1. To determine the thermal efficiency of the engine
  2. Create the plot for Pressure V/s Volume for the same engine.

5.EXPLANATION OF THE PROGRAM:

  1. Assign values to the input variables.
  2. Assume the geometric parameters.
  3. Calculate the Swept and Clearance Volumes.
  4. At point 1:
    1. V1=Swept+ Clearance
  5. At point 2:
    1. V2=Clearance
    2. P2= `P1 x (CR)^γ`
    3. T2=`(P2*V2*T1)/(P1*V1)`
  6. At point 3:
    1. V2=V3
    2. P3=`(P2*V3)/ "T2"`
  1. At point 4:
    1. V4=V1
    2. P4=P3 x`("V3"/"V4")^( γ)`
  1. Calculate thermal Efficiency as follows:`ηth=1-1/"CR^(γ-1)"`
  2. Create a function for drawing the curves between 1 2 and 3 4. 2 3 and 41 being straight lines.
  3. In the function we use the equations of volume as given below and return the value of the volume to the main program.

11. We call the function in the main program and hence plot the curves for Compression and expansion.

6.PYTHON CODE

#air standard cycle plot.
import math
import matplotlib.pyplot as abhi

def otto_cycle (bore,stroke,conrod,cr,start_crank,end_crank):    #new function created
	#engine kinematics

	#geometric parameters
	a=stroke/2                                               #crank pin radius
	R=conrod/a  

	#volume parameters
	V_s=(math.pi)/4*pow(bore,2)*stroke
	V_c=V_s/(cr-1)

	sc=math.radians(start_crank)
	ec=math.radians(end_crank)

	num_values=75

	dtheta=(ec-sc)/(num_values-1)
	v=[]

	for i in range(0,num_values):
		theta=sc + i*dtheta
		para1=0.5*(cr-1)
		para2=R + 1 - math.cos(theta)
		para3=pow(R,2)-pow(math.sin(theta),2)
		para4=pow(para3,0.5)
		v.append((1+para1*(para2-para4))*V_c)           #store all the terms in a single array

	return v                                                #return all the values stored in v

#input paramters
p1= 101325             #Pa
t1=450                 #K
t3=2100                #K
gamma=1.4

#geomertic dimensions
bore=0.12             #m
stroke=0.12           #m
cr=8
conrod=0.2            #m


#volume
v_s=((math.pi)/4)*pow(bore,2)*stroke
v_c=v_s/(cr-1)

#state1 
v1=v_s+v_c


rhs=p1*v1/t1

#state2
v2=v_c
p2=p1*pow(v1,gamma)/pow(v2,gamma)                   #p2v2^gamma=p1v1^gamma
t2=p2*v2/rhs

v_comp=otto_cycle (bore,stroke,conrod,cr,180,0)
const=p1*pow(v1,gamma)

p_comp=[]

for V in v_comp:
	p_comp.append(const/pow(V,gamma))

#state3
v3=v2
rhs=p2*v2/t2
p3=(rhs*t3)/v3


v_exp=otto_cycle (bore,stroke,conrod,cr,0,180)
const=p3*pow(v3,gamma)

p_exp=[]

for V in v_exp:
	p_exp.append(const/pow(V,gamma))

#state4
v4=v1

p4=p3*pow(v3,gamma)/pow(v4,gamma)        #p4v4^gamma=p3v3^gamma

t4=p4*v4/rhs

abhi.plot([v2,v3],[p2,p3])    #Heat Addition
abhi.plot(v_comp,p_comp)      #compression Stroke
abhi.plot(v_exp,p_exp)        #expansion Stroke
abhi.plot([v4,v1],[p4,p1])    #Heat Rejection
abhi.xlabel('Volume')
abhi.ylabel('Pressure')
abhi.savefig('otto cycle')
abhi.show()

#thermal efficiency
theff=1-1/(pow(cr,(gamma-1)))
print((theff*100))



8.RESULTS:

The Thermal Efficiency of the engine was found.

The plot of Pressure V/s Volume is as follows

9.CONCLUSION:So the plot of Pressure V/s Volume was obtained and the Thermal Efficiency of the engine was calculated using Python.

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.