Anda di halaman 1dari 11

CLS

DIM a(7), b(7), fu(7), fudt(7), fv(7), p(2, 300), t(2, 300), u(7, 7),
(work(2, 300), v(2, 300), vaf(7
(DIM energy(2, 300), pbara(300), vafa(300, 7
"******************************************************************"REM
cv = 718
"*******************************************************************"REM
INPUT "number of sets os calculations"; ndset'
FOR nx = 1 TO ndset'
PRINT : INPUT " cylinder diameter"; d
PRINT : INPUT " cylinder stroke "; s
PRINT : INPUT " compression ratio "; cr
PRINT : INPUT " air fuel ratio"; afr
INPUT " precentage carbon by weight in fuel "; ca'
INPUT " precentage hydrogen by weight in fuel "; ha'
INPUT " heat of reaction in joule/kg"; qvs'
PRINT : INPUT " pressure at commencement of compression stroke (kP)";
pin: pin = pin * 1000
PRINT : INPUT " temperature at commencement of compression stroke (k)";
tin
INPUT "refrence pressure example 10132n/m^2"; po'
INPUT "refrence temperature ex 288 k"; ts'
PRINT : INPUT " working cycles per second ex 2000 rpm"; rev
INPUT " number of volume divisions for compression and expansion'
stroke : not exceed 50"; nd
INPUT "number of volume increments in expansion stroke at which mixture'
can be considered to have frozen"; ndfst
INPUT "accuracy for solution of equation 9.14 in white house book";'
accur1
ca = .82: ha = .18
qvs = -4.788 * 10 ^ 9
po = 10132: ts = 288: nd = 200: ndfst = 100
accur1 = .01: accur2 = .01
INPUT "accuracy for solution of equation 9.28 in white house book";'
accur2
FOR ii = 1 TO 7
a(ii) = 0
b(ii) = 0
NEXT ii
REM coefficients
REM co2
u(1, 1)
u(1, 2)
u(1, 3)
u(1, 4)
u(1, 5)
u(1, 6)
u(1, 7)
REM co

=
=
=
=
=
=
=

3.0959
2.73114E-03
-7.88542E-07
8.66002E-11
0
6.5839
-3.9364E+08

u(2,
u(2,
u(2,
u(2,
u(2,
u(2,
u(2,

1)
2)
3)
4)
5)
6)
7)

=
=
=
=
=
=
=

3.317
3.7697E-04
-3.2208E-08
-2.1945E-12
0
4.63284
-1.1395E+08

REM H2O
u(3, 1)
u(3, 2)
u(3, 3)
u(3, 4)
u(3, 5)
u(3, 6)
u(3, 7)

=
=
=
=
=
=
=

3.74292
5.6559E-04
4.9524E-08
-1.81802E-11
0
9.6514E-12
-2.39225E+08

REM H2
u(4, 1)
u(4, 2)
u(4, 3)
u(4, 4)
u(4, 5)
u(4, 6)
u(4, 7)

=
=
=
=
=
=
=

3.43328
-8.181E-06
9.6699E-08
-1.44392E-11
0
-3.8447
0

REM O2
u(5, 1)
u(5, 2)
u(5, 3)
u(5, 4)
u(5, 5)
u(5, 6)
u(5, 7)

=
=
=
=
=
=
=

3.25304
6.5235E-04
-1.49524E-07
1.53897E-11
0
5.71243
0

=
=
=
=
=
=
=

3.34435
2.9426E-04
1.953E-09
-6.5747E-12
0
3.75863
0

REM N2
u(6,
u(6,
u(6,
u(6,
u(6,
u(6,
u(6,

1)
2)
3)
4)
5)
6)
7)

workt = 0
rmol = 8314.3
pi = 3.1415927#
REM set up input data
vs = pi * s * (d / 2) ^ 2
vc = vs / cr
v1 = vs + vc
nd = nd - 1
(dv = vs / ABS(nd

p1 = pin
t1 = tin
REM calculate moles of fuel w
sox = ca + .25 * ha
wf = 12 * ca + ha
REM stoichometric air fuel ratio by weight
afst = 4.7619 * sox * 28.96 / wf
phi = afst / afr
wm1 = 1 + 4.76 * (ca + .25 * ha) / phi
(w = (p1 * v1) / (wm1 * rmol * t1
REM total moles (in Kmol)of O2,N2,CnHm at trapped condition
(famol = phi / (4.7619 * sox
afmol = 1 / famol
(atmol = 1 / (1 + famol
PRINT "AFST,PHI"; afst, phi'
REM convert heat of reaction from J/kg TO J/kgmol
qvs = qvs * wf
FOR i = 1 TO 4
b(i) = 0
NEXT i
b(5) = .21 * atmol * wm1
b(6) = .79 * atmol * wm1
b(7) = 1 / (afmol + 1) * wm1
p(1, 1) = p1
t(1, 1) = t1
v(1, 1) = v1
eo = 1
FOR ii = 1 TO 7
vaf(ii) = b(ii) / wm1 * 100
(eo = eo + b(ii) * u(ii, 7
(vafa(1, ii) = vaf(ii
NEXT ii
n = 1
pbar = p(1, 1) * 1 * 10 ^ -5
pbara(1) = pbar
nc = nd + 1
REM internal energy at trapped state for reactants
FOR i = 5 TO 7
GOSUB 500
NEXT i
GOSUB 600
et1 = rmol * t1 * fut
energy(1, 1) = et1
cv = rmol * fudtt / wm

REM start calculation for compression stroke


FOR n = 2 TO nc
REM estimate T@ , P2
v2 = v1 - dv
(t2 = t1 * (v1 / v2) ^ (rmol / cv
(p2 = p1 * (v1 / v2) * (t2 / t1
REM internal energy at state 2
FOR i = 5 TO 7 13
GOSUB 500
NEXT i
GOSUB 600
et2 = rmol * t2 * fut
cv = rmol * fudtt / wm
REM work
(dw = .5 * (p2 + p1) * (v2 - v2
REM first law
fe = w * (et2 - et1) + dw
(eror = fe / (w * wm * cv
IF ABS(eror) < accur1 THEN GOTO 12
REM if first law not satisfied estimate new
REM value of t2 and p2 and return to statment 12
t2 = t2 - eror
(p2 = p1 * (v1 / v2) * (t2 / t1
GOTO 13
REM first law satisfied
REM store values of pc , tc,dw and reset t1,p1.et1
t(1, n) = t2 12
p(1, n) = p2
v(1, n) = v2
energy(1, n) = et2
work(1, n) = dw
et1 = et2
t1 = t2
p1 = p2
v1 = v2
FOR ii = 1 TO 7

vaf(ii) = b(ii) / wm * 100


(vafa(n, ii) = vaf(ii
NEXT ii
workt = workt + dw
pbar = p(1, n) * 10 ^ -5
pbara(n) = pbar
NEXT n
REM end of COMPRESSION STROKE
tr = t2
pr = p2
(bb = (2 / phi) * (ca + .25 * ha) - (ca + .5 * ha
IF phi < 1 THEN t2 = tr + 2500 * phi
(IF phi > 1 THEN t2 = tr + 2500 * phi - 700 * (phi - 1
FOR i = 5 TO 7
fu(i) = 0
fudt(i) = 0
fv(i) = 0
FOR j = 1 TO 5
(s = ABS(j
(fu(i) = fu(i) + u(i, j) * ts ^ (s - 1
(fudt(i) = fudt(i) + s * u(i, j) * ts ^ (s - 1
IF o = 0 THEN GOTO 3
IF j = 1 THEN GOTO 3
(fv(i) = fv(i) + (u(i, j) * ts ^ (s - 1)) / (s - 1
NEXT j 3
NEXT i
futs = 0
fudts = 0
wm = 0
FOR i = 5 TO 7
(futs = futs + b(i) * (fu(i) - 1
(fudts = fudts + b(i) * (fudt(i) - 1
(wmr = wmr + b(i
NEXT i
FOR i = 5 TO 7
fu(i) = 0
fudt(i) = 0
fv(i) = 0
FOR j = 1 TO 5
(s = ABS(j
(fu(i) = fu(i) + u(i, j) * tr ^ (s - 1
(fudt(i) = fudt(i) + s * u(i, j) * tr ^ (s - 1
IF o = 0 THEN GOTO 2
IF j = 1 THEN GOTO 2
(fv(i) = fv(i) + (u(i, j) * tr ^ (s - 1)) / (s - 1

NEXT j 2
NEXT i
futr = 0
fudtr = 0
wm = 0
FOR i = 5 TO 7
(futr = futr + b(i) * (fu(i) - 1
(fudtr = fudtr + b(i) * (fudt(i) - 1
(wm = wm + b(i
NEXT i
e1 = rmol * tr * futr + eo
REM PRINT COMPRESSION STROKE
CLS
LINE (250, 450)-(250, 100), 3: LINE (250, 100)-(245, 105), 3: LINE (250,
100)-(255, 105), 3
LINE (250, 350)-(600, 350), 3: LINE (600, 350)-(595, 355), 3: LINE (600,
350)-(595, 345), 3
LINE (250, 450)-(245, 445), 3: LINE (250, 450)-(255, 445), 3
COLOR 13
"LOCATE (5), (40): PRINT "compression stroke
"LOCATE (6), (30): PRINT "P
"LOCATE (21), (73): PRINT "V
LOCATE (7), (3): COLOR 15
FOR n = 1 TO nc
PSET ((pbara(n) * 100 / 4 + 50) + 250, (-v(1, n) * 1000000 / 6 - 50) +
350), 10
NEXT n
END
500
fu(i) = 0
fudt(i) = 0
fv(i) = 0
FOR j = 1 TO 5
(s = ABS(j
(fu(i) = fu(i) + u(i, j) * t1 ^ (s - 1
(fudt(i) = fudt(i) + s * u(i, j) * t1 ^ (s - 1
IF o = 0 THEN GOTO 1
IF j = 1 THEN GOTO 1
(fv(i) = fv(i) + (u(i, j) * t1 ^ (s - 1)) / (s - 1
NEXT j 1
RETURN

600
fut = 0
fudtt = 0
wm = 0
FOR i = 5 TO 7
(fut = fut + b(i) * (fu(i) - 1
(fudtt = fudtt + b(i) * (fudt(i) - 1
(wm = wm + b(i
NEXT i
RETURN

Anda mungkin juga menyukai