Engine kinematics of Otto Cycle and thermal efficiency
THE BASE CODE OF THE PROGRAM
close all;
clear all;
clc
% Otto Cycle
% setting up variables
gamma = 1.4; % Gamma = Cp/Cv
% defining engine geometry
bore = 0.1; % cylinder bore radius (m)
stroke = 0.1; % stroke length (m)
conn_rod = 0.15; % connecting rod length (m)
cr = 10; % compession ratio V1/V2
% known state variables
p1 = 101375; % initial pressure (Pa)
t1 = 275; % initial temperature (K)
t3 = 2050; % after combustion temperature (K)
% volume considerations
v_swept = (1/4)*pi*bore^2*stroke; % swept volume of the piston head (m^3)
v_clear = v_swept/(cr-1); % clearance volume (m^3)
v1 = v_swept + v_clear; % Volume at BDC
v2 = v_clear; % Volume at TDC
% defining pressure along the compression path
c1 = p1*v1^gamma;
V_comp = engine_kinematics(bore, stroke, conn_rod, cr, 180, 0);
P_comp = c1./V_comp.^gamma;
% state variables at second state
% p1*v1^gamma = p2*v2^gamma
% v1/v2 = cr
p2 = p1*cr^gamma;
% p1*v1/t1 = p2*v2/t2;
t2 = p2*t1/(cr*p1);
% state varibles in third state
% volume is constant
v3 = v2;
% pressure is proportional to temperature
% p3/t3 = p2/t2
p3 = t3*p2/t2;
% defining pressure along the expansion path
c3 = p3*v3^gamma;
V_exp = engine_kinematics(bore, stroke, conn_rod, cr, 0, 180);
P_exp = c3./V_exp.^gamma;
% state variables for fourth state
% volume comes back to initial
v4 = v1;
% pressure is given as
% p3*v3^gamma = p4*v4^gamma
p4 = p3/cr^gamma;
% temperature from ideal gas equation
t4 = t3*p4/p3;
% plotting the final path
hold on;
plot(v1,p1,v2,p2,v3,p3,v4,p4,\'color\',\'k\',\'marker\',\'o\');
plot(V_comp,P_comp,\'color\',\'g\');
plot(V_exp,P_exp,\'color\',\'r\');
plot([v2 v3],[p2 p3],[v4 v1],[p4 p1],\'color\',\'b\');
% Energy Efficiency
% for ita being the energy efficiency
% ita = W/Qh = (Qh-Qc)/Qh = 1 - Qc/Qh
% by solving we get ita = 1 - (V2/V1)^(gamma-1) = 1 - 1/cr^(gamma -1)
t = cr^(gamma - 1);
ita = 1 - 1/t;
fprintf(\'The efficiency of the \'\'Otto Cycle\'\' is %f percent. \\n\',ita*100);
THE FUNCTION OF THE PATH
function [V] = engine_kinematics(bore, stroke, conn_rod, cr, start_crank, end_crank)
% equation of engine kinematics we have following equation
% V / Vc = 1 + 1/2*(cr - 1)*(r + 1 - cos(theta) - (r^2 - sin(theta)^2)^1/2)
% setting up values
a = stroke/2; % connecting pin radius (m)
r = conn_rod/a; % ratio of connecting pin and connecting rod ratio
% setting up angle
theta = linspace(start_crank,end_crank,100);
% engine cylinder size parameters
v_swept = (1/4)*pi*bore^2*stroke;
v_clear = v_swept/(cr-1);
t1 = 0.5*(cr - 1);
t2 = r + 1 - cosd(theta);
t3 = (r^2 - sind(theta).^2).^0.5;
% final volume taken
V = (1 + t1*(t2-t3)).*v_clear;
end