All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
AIM- A MATLAB code for Air Standard Cycle(otto cycle):- The otto cycle approximates the processes in petrol or diesel engines. At constant volume, Heat is transferred to the working fluid. It consists of four internally reversible processes Isentropic compression. Constant volume heat addition. Isentropic expansion. Constant…
Shubhranshu Mishra
updated on 03 Jul 2020
AIM- A MATLAB code for Air Standard Cycle(otto cycle):-
The otto cycle approximates the processes in petrol or diesel engines. At constant volume, Heat is transferred to the working fluid. It consists of four internally reversible processes
Main Code:-
vs=π4⋅bore2⋅strokevs=π4⋅bore2⋅stroke and
vc=vscr−1vc=vscr-1
For the isentropic compression, we know
p2⋅v2γ=p1⋅v1γp2⋅v2γ=p1⋅v1γ
p2=p1⋅(v1v2)γp2=p1⋅(v1v2)γ
so p2=p1⋅crγp2=p1⋅crγ
For an ideal gas p1⋅v1t1=p2⋅v2t2p1⋅v1t1=p2⋅v2t2
so t2=p2⋅v2⋅t1p1⋅v1t2=p2⋅v2⋅t1p1⋅v1
p⋅vγ=constantp⋅vγ=constant
p3v3t3=p2v2t3p3v3t3=p2v2t3
so p3=p2⋅t3t2p3=p2⋅t3t2
p3⋅v3γ=p4⋅v4γp3⋅v3γ=p4⋅v4γ
p4=p3⋅(v3v4)γp4=p3⋅(v3v4)γ
% creating a PV diagram otto cycle
clear all
close all
clc
% given values
bore= 1;
stroke= 1;
connecting_rod= 1.5;
gamma=1.5;
% compression ratio
cr = 5;
% swept volume
v_swept= pi/4*bore^2*stroke;
% clearance volume
v_clearance= v_swept/(cr-1);
% at state point 1
p1 = 1000;
t1 = 500;
v1 = v_clearance + v_swept;
v2 = v_clearance;
% Compression
p2 = p1*cr^gamma;
t2 = p2*v2*t1/p1*v1;
V_compression = engine_keinematics(bore, stroke, connecting_rod, cr, 180 , 0);
constant_c = p1* v1 ^gamma;
P_compression = constant_c./V_compression.^gamma;
% at state point 2-3
v3=v2;
t3 = 2000;
p3= p2*t3/t2;
% Expansion
constant_c = p3* v3 ^gamma;
V_expansion = engine_keinematics(bore, stroke, connecting_rod, cr, 0 ,180);
P_expansion = constant_c./V_expansion.^gamma;
v4 = v1;
p4 = p3*(v3/v4)^gamma;
t4 = p4*v4*t3/p3*v3;
hold on
plot(v1,p1, '*' , 'color', 'g' )
plot( V_compression ,P_compression)
plot(v2,p2, '*' , 'color', 'g' )
plot(v3,p3, '*' , 'color', 'g' )
plot( V_expansion ,P_expansion )
plot(v4,p4, '*' , 'color', 'g' )
plot([v2 v3],[p2 p3], 'color', 'b')
plot([v4 v1],[p4 p1], 'color', 'b')
xlabel('VOLUME')
ylabel('PRESSURE')
% Thermal Efficency
Th_eff = (1-(1/cr^(gamma-1)))* 100;
Code for function calling:
% calling a function
function [V] = engine_keinematics(bore, stroke, connecting_rod, cr, start_cranc, end_cranc)
a = stroke/2;
r = connecting_rod/a;
v_swept= pi/4*bore^2*stroke;
v_clearance= v_swept/(cr-1);
theta= linspace(start_cranc,end_cranc,180);
term1 = 0.5*(cr-1);
term2 = r + 1 - cosd(theta);
term3 = (r^2 - sind(theta)).^0.5;
V = (1 + term1*(term2 - term3)).* v_clearance ;
end
Results-
Thermal efficiency = 55.27864
Error:-
Wrong closing of brackets in the following expression
"V = (1 + term1*(term2 - term3)).* v_clearance"
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...
Frequency Analysis of a rotating shaft (Finite Element Analysis using SolidWorks)
Aim- The aim of this project is to perform a frequency analysis on a rotating shaft, from there we need to determine the critical frequencies and the mode shapes. 5 Mode Shapes were simulated and analyzed. Introduction:- Frequency is the number of occurrences of a repeating event per unit of time. The formula…
06 Jul 2020 03:57 PM IST
Project - Rankine cycle Simulator (MATLAB)
AIM: To create a basic 'RANKINE CYCLE SIMULATOR'. THEORY: The Rankine cycle is the fundamental operating cycle of all power plants where an operating fluid is continuously evaporated and condensed. The selection of operating fluid depends mainly on the available temperature range. The above figure shows us the basic rankine…
03 Jul 2020 10:43 AM IST
Curve fitting (MATLAB)
AIM: To write a program to fit a linear and cubic polynomial for the specific heat data set then calculate the goodness of fit using different parameters and different ways to improve the fit in MATLAB THEORY: Curve fitting is the process of constructing a curve or mathematical function that best fits the data points,…
03 Jul 2020 10:24 AM IST
Solving second order ODEs (MATLAB)
Aim: To solves the ODE which represents the equation of motion of a simple pendulum with damping. Objective: To write a program that solves the following ODE which represents the equation of motion of a simple pendulum with damping and create an animated video of output obtains by solving this ODE. Theory:…
03 Jul 2020 10:20 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.