Air standard Cycle (PYTHON)
Air standard Cycle (Python)
1. OBJECTIVES:-THE OBJECTIVE IS TO FIND THE THERMAL EFFICIENCY AND PLOT THE P-V DIAGRAM FOR THE OTTO CYCLE
2. THEORY
An Otto cycle is an idealized thermodynamic cycle that describes the functioning of a typical spark ignition piston engine. It is the thermodynamic cycle most commonly found in automobile engines.
The Otto cycle is a description of what happens to a mass of gas as it is subjected to changes of pressure, temperature, volume, addition of heat, and removal of heat. The mass of gas that is subjected to those changes is called the system. The system, in this case, is defined to be the fluid (gas) within the cylinder. By describing the changes that take place within the system, it will also describe in inverse, the system's effect on the environment. In the case of the Otto cycle, the effect will be to produce enough net work from the system so as to propel an automobile and its occupants in the environment.
The Otto cycle is constructed from:
- Top and bottom of the loop: a pair of quasi-parallel and isentropic processes (frictionless, adiabatic reversible).
- Left and right sides of the loop: a pair of parallel isochoric processes (constant volume).
The isentropic process of compression or expansion implies that there will be no inefficiency (loss of mechanical energy), and there be no transfer of heat into or out of the system during that process. The cylinder and piston are assumed to be impermeable to heat during that time. Work is performed on the system during the lower isentropic compression process. Heat flows into the Otto cycle through the left pressurizing process and some of it flows back out through the right depressurizing process. The summation of the work added to the system plus the heat added minus the heat removed yields the net mechanical work generated by the system.
PROCESS:
The processes are described by:
- Process 0–1 a mass of air is drawn into piston/cylinder arrangement at constant pressure.
- Process 1–2 is an adiabatic (isentropic) compression of the charge as the piston moves from bottom dead centre(BDC) to top dead centre (TDC).
- Process 2–3 is a constant-volume heat transfer to the working gas from an external source while the piston is at top dead centre. This process is intended to represent the ignition of the fuel-air mixture and the subsequent rapid burning.
- Process 3–4 is an adiabatic (isentropic) expansion (power stroke).
- Process 4–1 completes the cycle by a constant-volume process in which heat is rejected from the air while the piston is at bottom dead centre.
- Process 1–0 the mass of air is released to the atmosphere in a constant pressure process.
The Otto cycle consists of isentropic compression, heat addition at constant volume, isentropic expansion, and rejection of heat at constant volume. In the case of a four-stroke Otto cycle, technically there are two additional processes: one for the exhaust of waste heat and combustion products at constant pressure (isobaric), and one for the intake of cool oxygen-rich air also at constant pressure; however, these are often omitted in a simplified analysis. Even though those two processes are critical to the functioning of a real engine, wherein the details of heat transfer and combustion chemistry are relevant, for the simplified analysis of the thermodynamic cycle, it is more convenient to assume that all of the waste-heat is removed during a single volume change.
Basic terms used in derivation of air-standard efficiency of Otto cycle:
Total Cylinder Volume:
It is the total volume (maximum volume) of the cylinder in which Otto cycle takes place. In Otto cycle,
Total cylinder volume = V1 = V4 = Vc + Vs
where,
Vc → Clearance Volume
Vs → Stroke Volume
Clearance Volume (Vc):
At the end of the compression stroke, the piston approaches the Top Dead Center (TDC) position. The minimum volume of the space inside the cylinder, at the end of the compression stroke, is called clearance volume (Vc). In Otto cycle,
Clearance Volume, Vc = V2
Stroke Volume (Vs):
In Otto cycle, stroke volume is the difference between total cylinder volume and clearance volume.
Stroke Volume, Vs = Total Cylinder Volume – Clearance Volume = V1 – V2 = V4 – V3
Compression Ratio:
Compression ratio (r) is the ratio of total cylinder volume to the clearance volume.
Now that we know the basic terms, let us derive expressions for T2 and T3. These expressions will be useful for us to derive the expression for air-standard efficiency of otto cycle. For finding T2, we take process 1-2 and for finding T3, we take process 3-4.
Process 1-2:
This process is an isentropic (reversible adiabatic) process. For this process, the relation between T and V is as follows:
Process 3-4:
This is also an isentropic process. The relation between T and V in this process is similar to the relation between T and V in process 1-2:
Here,
Air-standard efficiency of Otto cycle:
It is defined as the ratio between work done during Otto cycle to the heat supplied during Otto cycle.
Air-Standard Efficiency (thermal efficiency) of Otto cycle,
The following equation shows the relationship between crank angle and volume inside the chamber -
Here,
a = stroke/2
R = connecting rod length / a
3. PROGRAM
INPUTS: - (Inputs are assumed based on standard values)
- ENGINE GEOMETRIC PARAMETERS
Bore diameter = 0.1m
Stroke length = 0.1m
Connecting rod length = 0.15m
Compression ratio = 12
- STATIC VARIABLES AT STATE POINT-1
Pressure at state-1 = 101325 Pa
Temperature at state-1 = 500 K
- RATIO OF SPECIFIC HEAT
gamma = 1.4 (for air)
- Temperature at state-3 = 2300 K
4. PYTHON CODE:-
#OTTO CYCLE SIMULATOR
#Importing necessary module
import math
import matplotlib.pyplot as plt
#Engine Kinematics function
def engine_kinematics(bore,stroke,con_rod,cr,start_angle,end_angle):
#Engine parameters
a = stroke/2
R = con_rod/a
#Volume computation
v_s = (math.pi/4)*pow(bore,2)*stroke
v_c = v_s/(cr-1)
sc = math.radians(start_angle)
ec = math.radians(end_angle)
num_values = 100
dtheta = (sc-ec)/(num_values-1)
v = []
for i in range(0,num_values):
theta = sc + i*dtheta
term1 = 0.5*(cr-1)
term2 = R+1-math.cos(theta)
term3 = pow(pow(R,2) - pow(math.sin(theta),2),0.5)
v.append((1+term1*(term2-term3))*v_c)
return v
#INPUTS
p1 = 101325
t1 = 500
gamma = 1.4
t3 = 2300
#Engine parameters
bore = 0.1
stroke = 0.1
con_rod = 0.15
cr = 8
#Volume calculation
v_s = (math.pi/4)*pow(bore,2)*stroke
v_c = v_s/(cr-1)
v1 = v_s + v_c
#STATE POINT-2
v2 = v_c
p2 = p1*pow(v1,gamma)/pow(v2,gamma)
rhs = p1*v1/t1
t2 = p2*v2/rhs
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
rhs = p2*v2/t2
p3 = rhs*t3/v3
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
p4 = p3*pow(v3,gamma)/pow(v4,gamma)
t4 = p4*v4/rhs
#PLOTTING
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.title('P-V DIAGRAM OF OTTO CYCLE')
plt.xlabel('Volume (m^3/s)')
plt.ylabel('Pressure (Pa)')
plt.show()
#THERMAL EFFICIENCY
n = 1 - (pow(cr,(1-gamma)))
print(n)
5. EXPLANATION OF THE PYTHON CODE:-
- Import the necessary modules.
- Based on the relationship between crank angle and volume inside the chamber we make a function named engine_kinematics, which takes the following inputs - stroke,con_rod,cr,v_clearence,start_crank_angle,end_crank_angle And it returns an array of the volumes inside the chamber as an output for the variation of crank angle.
- Assign the input values.
- Calculate the swept volume, clearance volume, v1 & v2.
- Calculate of static variables based on the derived formulas using the given data.
- Calculate the pressure & volume during compression and expansion calling the engine_kinematics function.
- Plot of the curves which represent the thermal process based on the p & v values of four states.
- Give title and label to the graph.
- Calculation of thermal efficiency.
RESULTS
OUTPUT:-
Output in the command window –
P-V Diagram –
CONCLUSION:-
- The thermal efficiency of the otto cycle is 0.5647 or 56.47 %.. Efficiency is typically less than 100% because there are inefficiencies such as friction and heat loss that convert the energy into alternative forms.
- The graph which we get is the ideal otto cycle p-v diagram. The actual otto cycle diagram is different but for the ease of calculation we generally use the ideal diagram.