otto cycle p-v graph
https://docs.google.com/document/d/1oLWawEATjqaMz3auXLTkvtxdk2t78ohSzZUhwEYtlWc/edit?usp=sharing
clear all
close all
clc
bore = 1;
stroke = 1;
con_rod = 1.5;
cr = 12;
v_s = pi/4*bore*2*stroke;
v_c = v_s/(cr-1);
%1
v1 = v_s + v_c;
v2 = v_c;
p1 = 101325;
t1 = 500;
gama = 0.4;
t3 = 2300;
%2
p2 = p1 * (cr)^gama;
t2 = p2*v2*t1/p1*v1;
const_c = p1*v1^gama;
vx = ottocyclepart(bore, stroke, con_rod, cr, 0, 180);
pcomp = const_c./(vx.^gama)
%3
v3 = v2;
p3 = p2*t3/t2;
%4
const_c = p3*v3^gama;
vz = ottocyclepart(bore, stroke, con_rod, cr, 180, 360);
pexpand = const_c./(vz.^gama)v4=v1;
p4 = p3*(v3/v4)^gama;
figure(1)
hold on
plot(v1,p1,\'*\',\'color\',\'r\')
plot(v2,p2,\'*\',\'color\',\'b\')
plot(v3,p3,\'*\',\'color\',\'y\')
plot(v4,p4,\'*\',\'color\',\'g\')
plot(vx,pcomp)
plot(vz,pexpand)
plot([v3 vx],[p3 pcomp])plot([v1 v4],[p1 p4])
% function for this program
function[v]= ottocyclepart1(bore, stroke, con_rod, cr, startcrankangle, endcrankangle)
a = stroke/2
R = con_rod/a
v_s = pi/4*bore*2*stroke;
v_c = v_s/(cr-1);
theta = linspace(startcrankangle,endcrankangle,100);
term1 = 0.5*(cr-1);
term2 = R+1-cosd(theta);
term3 = (R^2 - sind(theta).^2).^0.5v = (1+term1*(term2-term3)).*v_c;
end