All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
AIM-To plot the PV diagram of an otto cycle and find its Thermal Efficiency PROGRAMMING LANGUAGE USED IS MATLAB OBJECTIVE OF THE PROJECT: Using the concepts of functions in Matlab we are plotting the PV diagram of an otto cycle and calculating its thermal efficiency An Otto…
Ayush Kumar
updated on 13 Aug 2020
AIM-To plot the PV diagram of an otto cycle and find its Thermal Efficiency
PROGRAMMING LANGUAGE USED IS MATLAB
OBJECTIVE OF THE PROJECT:
Using the concepts of functions in Matlab we are plotting the PV diagram of an otto cycle and calculating its thermal efficiency
It is also known as Petrole Engine Cycle and is used in S.I engines
FIGURE REPRESENTING THE OTTO CYCLE
It consists of the following processes
1)Process 1-2 [INTAKE OF AIR AND FUEL MIXTURE],this process is carried out under constant pressure it is being represented by the first diagram in the figure below
2)Process 2-3 is isentropic compression ,it is being represented by the second diagram in the figure below
3)Process 3-4 is constant volume heat addition,in this step the action of spark plug takes placeand heat is being added enough for the combustion to take place.
4)Process 4-5 is insentropic Expansion and is represented by diagram 3 in the figure below
5)Process 5-6 is constant volume heat rejection
Then at the end the exhaust gasses are being carried out and the process continues
This is the general principle working of the otto cycle
FIGURE REPRESENTING THE WORKING OF A 4-STROKE S.I ENGINE
THEORY OF THE OTTO CYCLE
The Otto Thermodynamic Cycle which is used in all internal combustion engines.
The figure shows a p-V diagram of the Otto cycle. Using the engine stage numbering system, we begin at the lower left with Stage 1 being the beginning of the intake stroke of the engine. The pressure is near atmospheric pressure and the gas volume is at a minimum. Between Stage 1 and Stage 2 the piston is pulled out of the cylinder with the intake valve open. The pressure remains constant, and the gas volume increases as fuel/air mixture is drawn into the cylinder through the intake valve. Stage 2 begins the compression stroke of the engine with the closing of the intake valve. Between Stage 2 and Stage 3, the piston moves back into the cylinder, the gas volume decreases, and the pressure increases because work is done on the gas by the piston. Stage 3 is the beginning of the combustion of the fuel/air mixture. The combustion occurs very quickly and the volume remains constant. Heat is released during combustion which increases both the temperature and the pressure, according to the equation of state. Stage 4 begins the power stroke of the engine. Between Stage 4 and Stage 5, the piston is driven towards the crankshaft, the volume in increased, and the pressure falls as work is done by the gas on the piston. At Stage 5 the exhaust valve is opened and the residual heat in the gas is exchanged with the surroundings. The volume remains constant and the pressure adjusts back to atmospheric conditions. Stage 6 begins the exhaust stroke of the engine during which the piston moves back into the cylinder, the volume decreases and the pressure remains constant. At the end of the exhaust stroke, conditions have returned to Stage 1 and the process repeats itself.
The Thermal Efficiency of the otto cycle is given by
The matlab code is being Divided into Two parts for the Ease of Understanding
The concepts of Functions in matlab is being applied and the code is being made as easy as possible for anyone to understand
Comment statements are also being added and is written in layman language
PART - 1
clear all
close all
clc
%Input---
gamma=1.4;
T3=2300; %The temperature at the end of compression stroke is assumed to be 2300k
%%Providing the State Variables at point 1
P1=101325; % Taking the pressure at point 1 to be atmospheric pressure S.I Unit is atm.
T1=500;%Assuming the Temperature at point 1 to be 500K,The unit of measurment is Kelvin
%Engine Parameters
Bore=0.1;%Bore is the inner diameter of the cylinder
Stroke=0.1;
%A phase of the engine's cycle (e.g. compression stroke, exhaust stroke),
%during which the piston travels from top to bottom or vice versa
Con_length=0.15;%Length of the Connecting Rod
CR=12;%Compression Ratio
%Calculating the swept volume and the clearance volume
V_Swept=(pi/4)*(Bore)^2*(Stroke);%Calculating the swept volume
V_Clearance=V_Swept/(CR-1);%Calculating the clearance volume
V1=V_Swept+V_Clearance;%Volume at point 1 is The sum of the volume clearance
%and the volume swept
V2=V_Clearance;%Volume at state 2 is just the volume clearance
%State Variables at point 2
%P1*V1^gamma=P2*V2^gamma[Since the process is a isentropic compression
%process so it follows the pressure volume relation as P*V^gamma=Constant
%P2=P1(V1/V2)^gamma-->Here [V1/V2=CR]-->P2=P1(CR)^gamma
P2=P1*(CR)^gamma;
% In order to calculate the Temperature at point number 2 we will use the
% Ideal gas equation
% P1*V1/T1=P2*V2/T2
T2=P2*V2*T1/(P1*V1);
constant_c=P1*V1^gamma;
V_Compression=engineworkinng(Bore,Stroke,Con_length,CR,180,360);
P_Compression=constant_c./V_Compression.^gamma;
%State point number 3
%We have to assume the temperature at state point number 3 is 2300k
%Using the ideal gas equation
%P2*V2/T2=P3*V3/T3
V3=V2; %The Process is a constant volume process hence V2=V3
P3=(T3*P2*V2)/(T2*V3);
constant_c=P3*V3^gamma;
V_Expansion=engineworkinng(Bore,Stroke,Con_length,CR,360,540);
P_Expansion=constant_c./V_Expansion.^gamma;
%State variable at point 4
V4=V1;
%Isentropic Expansion process so it follows the P,V relation P*V^gamma=constant
% P3*V3^gamma=P4*V4^gamma;
%V3/V4 is equivalent to 1/CR
%Calculating the THERMAL EFFICIENCY of the OTTO cycle
NTH=1-1/(CR^gamma-1);
P4=(P3)*(1/CR)^gamma;
figure(1)
xlabel('volume --->');
ylabel('pressure --->');
hold on
plot(V1,P1,'*','Color','r')
plot(V_Compression,P_Compression)
plot(V2,P2,'*','Color','r')
line([V2,V3],[P2,P3],'color','g','linewidth',1)
plot(V3,P3,'*','Color','r')
plot(V_Expansion,P_Expansion)
plot(V4,P4,'*','Color','r')
line([V4,V1],[P4,P1],'color','g','linewidth',3)
ERROR 1- Save the PART-2 of the code in a different Script and the file name should be the same as the function name if you fail to do so MATLAB will show error.
PART -2
function[V]=engineworkinng(Bore,Stroke,Con_length,CR,start_Crank,End_Crank)
a=Stroke/2;
R=Con_length/a;
V_S=pi/4*(Bore)^2*Stroke;
V_C=V_S/(CR-1);
theta=linspace(start_Crank,End_Crank,100);
term1= 0.5*(CR-1);
term2=R+1-cosd(theta);
term3=(R^2-sind(theta).^2).^0.5;
V=(1+term1*(term2-term3)).*V_C;
end
CACLUATION OF THERMAL EFFICIENCY
The Thermal Efficiency of the otto cycle comes out to be around 0.96 ,hence it can be concluded that the cycle is 96% Efficient.
OUTPUT OF THE CODE EXPLAINED:--
-->got the PV plot and also calculated the thermal Efficiecy of the cycle.
In order to understand the code one must have some basic knowledge of the otto cycle.
In the code above we have used the concept of functions we have divided the code into two parts in the first part of the code we are plotting the state points of all the four processes
FIGURE SHOWING THE OUTPUT OF PART-1 OF THE CODE ,ITS SHOWING THE
PRESSURE AND VOLUME AT STATE POINTS 1,2,3,4.
The second part of the code is used to relate with the first part of the code
We are using the Engine kinematics equation and plotting a curve between change in volume with the change in crank angle.
The graph is governed by the following equation
In order to understand the movement of PISTON with change in crank angle go through the following link
https://en.wikipedia.org/wiki/File:TRUE_piston3_ANI.gif
The second code is created using the concept of Fuctions.
we are using the concept of functions to relate the motion of crank and the change in volume ,then we are calling the function in our Part1 of code and then plotting it using the plot command
OUTPUT OBTAINED
1)Thermal Efficiency was found to be around 96 percent.
----->Here ITPC -Isentropic Compression
----->ITPE-Isentropic Expansion
----->C.V denotes the constant volume process
----//Errors faced while programming//----
This is not a complicated code so the only error that can occur is while creating the functions and only minute issues and can be solved by the following methods
Error 1-Saving the name of the file different as that given in matlab
solution--The file name should be the same as that of the function name other wise it may cause error
Error 2- writing the equations wrong ,always write the correct equations and cross check with the value obtained mathematically with the values obtained through the code.
Error 3- While using the plot function always check to give the right parameters
Error4 --Matlab is Case Sensitive so take care of that
Error5-- Make sure to provide % sign before command statements .
Use help command to get information of any function or go to the mathworks website to know more about the function
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Week 6 - Data analysis
AIM :TO WRITE A PYTHON PROGRAM WHICH READS THE ENGINE OUTPUT PARAMETER DATA FILE AND PERFORM THE REQUIRED OBJECTIVES The programming language used is Python 2.OBJECTIVE : To read the data from a given data file. To take the file name as an input from the user and check whether the file is present or not. To plot a graph…
16 Aug 2021 10:01 AM IST
Week 3 - Solving second order ODEs
Aim: To write a program to simulate the transient behavior of a simple pendulum.(Simulate the motion between 0-20 sec, for angular displacement=0,angular velocity=3 rad/sec at time t=0) To create an animation of its motion. Theory: A pendulum is a weight suspended from a pivot so that it can swing freely. When…
14 Jul 2021 08:05 AM IST
Week 5 - Curve fitting
AIM- To write a PYTHON code that performs curve-fitting on the relationship between cp and Temperature and finding the PERFECT FIT for the following. THEORY- Curve fitting is the process of constructing a curve, or mathematical functions, which possess the closest proximity to the real series of…
14 Jul 2021 06:10 AM IST
Week 2 Air standard Cycle
AIM:To generate the PV diagram and to determine the thermal efficiency of the engine. The programming language used is Python THEORY: Otto Cycle is an idealized thermodynamic cycle that describes the working of a spark-ignition engine. The cycle consists of 4 processes as illustrated in the figure below: it consists…
12 Jul 2021 09:38 AM IST
Related Courses
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.