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:
- The value of gamma`(γ)=1.4`
- The value of temperature after compression i.e T3 =2100k
- P1 is considered at atmosphere i.e 101325 Pa
- T1=450K
3.GEOMETRIC ASSMUPTIONS:
- Bore Diameter = 0.12 m
- Stroke = 0.12m
- Compression Ratio (CR)= 12
- Length of Connecting Rod =0.2 m
4.OBJECTIVES:
- To determine the thermal efficiency of the engine
- Create the plot for Pressure V/s Volume for the same engine.
5.EXPLANATION OF THE PROGRAM:
- Assign values to the input variables.
- Assume the geometric parameters.
- Calculate the Swept and Clearance Volumes.
- At point 1:
- V1=Swept+ Clearance
- At point 2:
- V2=Clearance
- P2= `P1 x (CR)^γ`
- T2=`(P2*V2*T1)/(P1*V1)`
- At point 3:
- V2=V3
- P3=`(P2*V3)/ "T2"`
- At point 4:
- V4=V1
- P4=P3 x`("V3"/"V4")^( γ)`
- Calculate thermal Efficiency as follows:`ηth=1-1/"CR^(γ-1)"`
- Create a function for drawing the curves between 1 2 and 3 4. 2 3 and 41 being straight lines.
- 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.