Challenge

Week 2 Air standard Cycle

Week 2 Air standard Cycle

Otto Cycle:-

The Otto cycle is a set of processes used by spark-ignition internal combustion engines (2-stroke or 4-stroke cycles). These engines-

a) Ingest a mixture of fuel and air

b) Compress it

c) Cause it to react thus, effectively adding heat through converting chemical energy into thermal energy,

d) Expand the combustion products, and then

e) Eject the combustion products and replace them with a new charge of fuel and air.

Processes Involved

  1. Intake stroke, gasoline vapor, and air is drawn into engine ( ).
  2. Compression stroke, , increase ( ).
  3. Combustion (spark), short time, essentially constant volume ( ). Model: heat absorbed from a series of reservoirs at temperatures to .
  4. Power stroke: expansion ( ).
  5. Valve exhaust: valve opens, gas escapes.
  6. ( ) Model: rejection of heat to series of reservoirs at temperatures to .
  7. Exhaust stroke, piston pushes remaining combustion products out of chamber ( ).

Model the processes as all acting on a fixed mass of air contained in a piston-cylinder arrangement, as shown in Figure

The ideal Otto cycle
Sketch of an actual Otto cycle
Figure 3.10: Piston and valves in a four-stroke internal combustion engine

The actual cycle does not have the sharp transitions between the different processes that the ideal cycle has, and might be as sketched in Figure 3.9.

The quantity `(v1)/(v2)= cr is called the compression ratio. In terms of compression ratio, the efficiency of an ideal Otto cycle is:

Aim:

To write a code that can solve an otto cycle and make plots for it.

1. Create a PV diagram

2. Output the thermal efficiency of the engine.

Procedure:

Import the math and matplot library.

Define the 'engine kinematics' function that includes several input variables.

Give geometrical parameters of the engine.

Give swift(the volume swept by the engine piston during one stroke) and clearance volume(the volume that remains in the cylinder when the engine piston is in the top center position) formula in code for volume calculation.

`V_s =pi/4*(BORE)^2*STROKE`

`V_C =V_S/ (C_r-1)`

Starting and end crank angle has to be defined in radians.

We need to convert it to a program that gives us an array of volume for the crank angles that correspond to the expansion and compression process.

So we use this information for the Otto cycle to calculate the pressures corresponding to those volumes.

For this, we need to convert it to a function.

The function is a template that has a set of codes that we keep on reusing again and again.

For loop created to get an array of volume for various values of theta with an increment of dtheta. and return the V value to the array to store.

Here we will just change the starting and ending crank angle to get the volumes for the process.

We need to tell our function explicitly that send the value for V once the calculation is completed.

Provide the geometrical parameters and different state points.

`v2= v_c`

`p2v2^gamma = p1v1^gamma`

`(p2 )(v2)/(t2) = (p1)(v1)/(t1)`

`rhs =( p1)(v1)/(t1)`

`t2 = (p2)(v2)/ (RHS`

Call the created function and define for both V_compression and expansion.

For both callings, we have to create a for loop to append multiple values of compression and expansion into an empty array.

Similerly, for state point three we will have calculate

`(p3)(v3)/(t3) = (p2)(v2)/(t2)`

For state point 4 the pressure is

`p_4 = (p_3) *(v_3^gamma)/(v_4^gamma)`

Efficency in percentage has been calculated here

`Thermal Efficency = (1-1/C_r^(gamma -1))*100`

Plot the corresponding results and show them with labels.

Main Code:

import math
import numpy as np
import matplotlib.pyplot as plt

def engine_kinematics(bore,stroke,con_rod,cr,start_crank, end_crank):


	#Geometric Parameters

	a= stroke/2
	R=con_rod/a 

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

	star_crank_angle = math.radians(start_crank)
	end_crank_angle = math.radians(end_crank)

	num_values = 50
	dtheta= (star_crank_angle- end_crank_angle)/(num_values-1)
	V= []
	for i in range(0,num_values):
		theta=star_crank_angle+i*dtheta
		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((1+term1*(term2-term3))*v_c)
	
	return V



# inputs
p1=101325
t1=500
t3=2300
gamma= 1.4

#Geometric Parameters
bore= 0.1
stroke= 0.1
con_rod = 0.15
cr= 8

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

# state point 2
v2= v_c

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

#p2v2/t2 = p1v1/t1 | rhs = p1v1/t1 | p2v2/t2 | t2 = p2v2/ rhs
rhs= p1*v1/t1
t2= p2*v2/rhs

# calling function 
V_compression= engine_kinematics(bore,stroke,con_rod,cr,180, 0)
constant= p1*pow(v1,gamma)
p_compression= []

for v in V_compression:
	p_compression.append(constant/pow(v,gamma))


#state point 3
v3=v2

#p3v3/t3 = p2v2/t2 | rhs = p2v2/t2 | p3 = rhs*t3/v3
rhs= p2*v2/t2
p3= rhs*t3/v3

# calling function
V_expansion= engine_kinematics(bore,stroke,con_rod,cr,0,180)
constant= p3*pow(v3,gamma)
p_expansion= []

for v in V_expansion:
	p_expansion.append(constant/pow(v,gamma))

#state point 4
v4=v1

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

#p4v4/t4 = rhs
t4 =p4*v4/rhs

# Efficency in percentage

Thermal_Eff= (1-1/pow(cr,(gamma-1)))*100
print(Thermal_Eff)

#Plot
plt.plot([v2,v3],[p2,p3])
plt.plot(V_compression,p_compression)
plt.plot(V_expansion,p_expansion)
plt.plot([v4,v1],[p4,p1])
plt.xlabel('VOLUME')
plt.ylabel('PRESSURE')
plt.show()

Results:

  • This PV curve shows the compression and expansion process very clearly with a non-linear curve, where the volume is the same at 2,3 and 1,4 state points that satisfy for an Otto cycle.
  • The efficiency is 56.47 as a result of the code run.

Reference Links:

https://web.mit.edu/16.unified/www/FALL/thermodynamics/notes/node26.html

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.