All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
AIM: To write a MATLAB program to plot p-v diagram and determine the thermal efficiency of the engine. OBJECTIVE : Understand the different processes of otto_cycle Understand how the work is done between gas and piston during each process Understand the assumptions mabe between the reallity and ideal…
Kpooupadang Jacques ABOUZI
updated on 04 Mar 2021
AIM: To write a MATLAB program to plot p-v diagram and determine the thermal efficiency of the engine.
OBJECTIVE :
INPUTS :
EQUATIONS USD :
THEORY:
An Otto cycle is an idealized thermodynamic cycle that describes the functioning of a typical spark ignition piston engine. 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 through the following four internally reversible processes:
DETAILS :
Programming language used : MATLAB
Concept used: Gas laws, engine kinematics
ASUMPTIONS :
PROGRAM AND STEPWISE EXPLANATION :
This program comprises of two sample code. The first code constutes the main part of the program and the second one is the definition of a function called "engine _inematics" .
MAIN PROGRAM
%This program aims to
%plot the p-v diagram;
%calculate the thermal efficiency of the engine for the given data
clear all
close all
clc
%Inputs
gamma = 1.4 %gamma is the adiabatic index
t3 = 2300 % t3 is the temperature at which the combustion takes place
%State variables
p1 = 101325 %p1 represents the atmospheric pressure
t1 = 500 %t1 is thne initial tempereature
% Engine geometric parameters
bore = 0.1; %diameter of the cylinder
stroke = 0.1 ; %Stroke-length of cylinder
con_rod = 0.15; %length of the connwecting-rod
cr = 12; %Compression ratio0p
%Calculating the swept volume and the clearance volume
v_swept = (pi/4)*bore^2*stroke;
v_clearance = v_swept/(cr-1);
v1 = v_swept + v_clearance
v2 = v_clearance
% State variables aat state point 2
% p2v2^gamma = p1v1^gamma
% p2 = p1*(v1/v2)^gamma = p1*cr^gamma
p2 = p1*cr^gamma;
%p1v1/t1 =p2v2/t2| t2 = p2*v2**t1/(p1*v1)
t2 = p2*v2*t1/(p1*v1)
constant_c = p1*v1^gamma;
V_compression = engine_kinematics(bore,stroke,con_rod,cr,180,0)
P_compression = constant_c./V_compression.^gamma;
% State variable at state point 3
v3 = v2
% p3v3/t3 = p2v2/t2 | p3 = p2*t3/t2
p3 = p2*t3/t2
constant_c = p3*v3^gamma;
V_expansion = engine_kinematics(bore,stroke,con_rod,cr,0,180)
P_expansion = constant_c./V_expansion.^gamma;
% State variable at state point 4
v4 = v1
% p3v3^gamma = p4v4^gamma | p4 = p3(v3/v4)^gamma
p4 = p3*(v3/v4)^gamma
%Calculation of the thermal efficiency of the engine| e = 1- 1/cr^(gamma-1)
disp('thermal efficiency')
e = 1- 1/[cr^(gamma-1)]
% All these commands enable us to plot p-v digram
figure(1)
hold on
plot(v1,p1,'*','color','r')
plot(V_compression,P_compression,'color','b')
plot(v2,p2,'*','color','r')
plot(v3,p3,'*','color','r')
plot(V_expansion,P_expansion,'color','b')
plot(v4,p4,'*','color','r')
plot([v1 v4],[p1 p4],'color','b')
plot([v2 v3],[p2 p3],'color','b')
xlabel('Volume in m^3')
ylabel('Pressure in Pa')
title('P-V Diagram of Otto-cycle engine')
PROGRAM FUNTION
% This function aims to calculate the volume and gve the real nature of the
% curve during the isentropijc compressoion and expansion
function [v] = engine_kinematics(bore, stroke,con_rod,cr,start_crank,end_crank)
a = stroke/2;
R = con_rod/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
OUTPUT:
ERRORS OR PROBLEMS FACED WHILE PROGRAMMING :
plot([v1 v2 v3 v4],[p1 p2 p3 p4],'color','b')
xlabel('Volume in m^3')
ylabel('Pressure in Pa')
title('P-V Diagram of Otto-cycle engine')
As solution, we have to check that all the parenthesis in a mathematic expression are balanced
CONCLUSION:
Hence we are able to understand the processes of otto_cycle, how work is done during each process and we can now discuss the assumptions made easily and explain exactly how the volume behaves during isentropic compression and expansion.
Furthermore, we plot the p-v diagram and we calculate the thermal efficiency of the engine
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 - Multivariate Newton Rhapson Solver
AIM: To write a python program to solve the given system of equations using Multivariate Newton solver. Equations INTRODUCTION Life is nonlinear, and its many diverse occurrences are frequently related to one another. Because each equation depends on the variables that have been solved…
03 Jul 2022 04:22 PM IST
Week 5.2 - Literature review: ODE Stability
AIM: To carry out a literature review on ordinary differential equations stability. Introduction A stable problem is the one for which small changes in the initial conditions elicit only small changes in the solution. In other words, stability in mathematics, is the state in which a little change in a system…
26 Jun 2022 12:11 PM IST
Compact Notation Derivation for a simple Mechanism
Aim: To derive the reaction rate ODEs and production for each species in the0 given reaction mechanism. Objective The objective in this work is to determine the net reaction rate for all four reactions using reactant and product matrices. After that, the production of each species is determined with respect to net…
13 May 2022 04:22 PM IST
CURVE FITTING USING PYTHON
AIM: The aim of this program is to write a Python code to fit a linear and cubic polynomial for the cp data. It aims to show the split wise method and explain all the parameters involved in the measurement of the fitness characteristics. OBJECTIVES: Know the importance of curve fitting in real life Learn how…
30 Apr 2022 08:30 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.