Project

Otto Cycle Plot

clear all
close all
clc

bore = 0.1
stroke = 0.15
connt_rod = 0.25
cr = 7

v_s = pi/4*bore^2*stroke
v_c = v_s/(cr - 1)

p1 = 1*(10^5)
t1 = 25 + 273
v1 = v_s + v_c

gamma = 1.4

v2 = v_c
p2 = p1*((v1/v2)^gamma)
t2 = (p2/p1)*(v2*t1/v1)

[vmat1]=volume(bore,stroke,connt_rod,cr,180,0,v_c)
pmat1(1) = p1;
for i=1:(length(vmat1)-1)
    pmat1(i+1) = pmat1(i)*((vmat1(i)/vmat1(i+1))^gamma)
end

v3 = v2
t3 = 1200+273
p3 = (p2*v2*t3)/(t2*v3)

[vmat2]=volume(bore,stroke,connt_rod,cr,0,180,v_c)
pmat2(1) = p3
for i=1:(length(vmat1)-1)
    pmat2(i+1) = pmat2(i)*((vmat2(i)/vmat2(i+1))^gamma)
end

v4 = v1
p4 = p3*((v3/v4)^gamma)

hold on

plot(vmat1,pmat1,vmat2,pmat2,[v2 v3],[p2 p3],[v4 v1],[p4 p1])
efficiency = 1 - (1/(cr^(gamma-1)))

code to plot

function [vmat1] = volume(bore,stroke,connt_rod,cr,start_angle,end_angle,v_c)
    a = stroke/2
    R = connt_rod/a
    x = linspace(start_angle,end_angle,100)
    term1 = 1/2*(cr - 1)
    term2 = R + 1 - cosd(x)
    term3 = (R^2 - (sind(x)).^2).^(1/2)
    vmat1 = v_c*(1+term1*(term2-term3))
end
    

code of function

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.