Главная | Обратная связь | Поможем написать вашу работу!
МегаЛекции

Пакет программ на алгоритмическом языке Turbo Pascal




К лабораторным работам

А1 Программа № 1

 

program lab_1;

uses printer;

label 1;

var k,p,ca0,cb0,kr,t,xp,xp1,h,s,x,xx,r:real;

var i,j:integer;

function f(x:real):real;

var a,b,d,q:real;

begin

a:=k*p/ca0;b:=(cb0-0.5*ca0*x)/(l-0,5*ca0*x);

d:=(l-x)/(l-0.2*x);q:=(1-1/p*sqr(x/(kr*(l-x))))/b;

f:=l/(a*b*d*q);

end;

begin

p:=1.; t:=893;ca0:=0.0;

writeln (1st,'t=',t);

for i:=1 to 5 do begin

{t:=t+40;}

ca0:=ca0+0.05;writeln(1st, 'ca0=',ca0);

x:=0.1;

cb0:=0,21*(l-ca0);

kr:=exp((4905.5/t-4.6455)*ln(10));.

if t<673 then k:=exp(2.3*(21.9-14850/t));

if (t>673) and (t<806) then k:=exp(2.3*(1.66-1230/t));

if t>806 then k:=1.361;

xp:=x; {method simple iteration}

1:xp1:=kr/(kr+sqrt((l-0,5*ca0*xp)/(p*(cb0-0.5*ca0*xp))));

if abs(xp-xp1)>0.0001 then begin

xp:=xpl; goto 1;

end;

{writeln (1st,'t=',t,'kr=',kr, 'xp=',xp, 'k=',k);}

writeln (1st, 'kr=',kr,'xp=',xp, 'k=',k);

x:=0;

while (x<xp) do begin

x:=x+0.1;

h:=0.01*x;{integral}

s:=f(0)+f(x); r:=l/f(x);

xx:=0;

for j:=l to 99 do

begin

xx:=xx + h;

s:=s+2*f(xx);

end;

s:=h/2*s;

writeln (1st,'x=',x, 'tau=',s,'r',r);

end;

end;

end.

 

А2 Программа № 2

program lab_1;

uses printer;

label 1,2;

var k,p,ca0,cb0,kr,t,xp,xp1,h,s,x,xx,r,dr,lk,v,VR,sr,ca,l:real;

var i,j: integer;

function f(x:real):real;

var a,b,d,q:real;

begin

a:=k*p/ca0; b:=(cb0-0.5*ca0*x)/(l-0.5*ca0*x);

d:=(l-x)/(l-0.2*x); q:=(l-l/p*sqr(x/(kr*(l-x))))/b;

f:=l/(a*b*d*q);

end;

begin

dr:=0.1; lk:=0.4; v:=7.85E-03; VR:=3.14E-03; sr:=pi*sqr(dr)/4;

p:=l.; t:=693; ca0:=0.2;

writeln (1st,'ca0=',ca0);

{ for i:=l to 6 do begin

t:=t+40;

ca0:=ca0+0.05}; writeln (1st,'t=',t);

x:=0.1;

cb0:=0.21*(l-ca0);

kr:=exp((4905.5/t-4.6455)*ln(10));

if t<673 then k:=exp(2.3*(21.9-14850/t));

if (t>673) and (t<806) then k:=exp(2,3*(1.66-1230/t));

if t>806 then k:=1.361;

xp:=x; {method simple iteration}

l:xpl:=kr/(kr+sqrt((l-0.5*ca0*xp)/(p*(cb0-0,5*ca0*xp))));

if abs(xp-xp1)>0,0001 then begin

xp:=xpl; goto 1;

end;

writeln(lst,'kr=',kr, 'xp=', xp,'k=',k);

x:=0;s:=0; ca:=ca0;

while (x<xp) do begin

ca:=ca0*(l-x);

h:=0.01*x:{integral};

s:=f(0)+f(x);

r:=l/f(x);

xx=0;

for j:=l to 99 do

begin xx:=xx+h;

s:=s+2*f(xx);

end;

s:=h/2*s; l:=s*v/sr; if (l>lk) then goto 2;

writeln (lst,'x=',x,'tau=',s, 'r=',r);

writeln (lst, 'l=',l,'ca=',ca);

x:=x+0.1;

end;

2: {end;}

end.

А3 Программа № 3

program lab_2;

USES PRINTER;

var A,T,P0,R0,SIG,V0,Kl,K2,X,HsS,XX,TAU,Q,R:REAL;

L,I,J:INTEGER;

FUNCTION F(X:REAL):REAL;

VARQ,Z:REAL;

BEGIN

Q:=(l-X)/(l/P042*K2*X);

Z:=K1/A*SQRT(Q);

F:=l/Z;

END;

BEGIN

T:=1000; P0:=0.1E-4; R0:=260; SIG:=57E+03; V0:=0.041;

A:=1/(SIG*R0*V0);

K1:=EXP(0.001*(LN(0.325E+06)-48000/T));

K2:=EXP(0.001*(LN(0.53E-10)+58500/T));

WRITELN(LST,' A=',A5'K1=',K1, 'K2=',K2);

FOR L:=l TO 9 DO BEGIN

WRITELN(LST,' PO=',PO);

X:=0; {8:=Р(Х); WRITELN(Т(Х)=*,8);}

FOR I:=1 TO 10 DO

BEGIN

H:=0.01*X;

S:=F(0)+F(X);

XX:=0;

FOR J:=1 TO 99 DO

BEGIN XX:=XX+H;

S:=S+2*F(XX);

END;

S:=H/2*S*3600;

Q:=(l-X)/(l/P0+2*K2*X);

R:=Kl*SQRT(Q)*3600;

WRITELN(LST,' X=',X, 'TAU=',S, 'R=',R);

X:=X+0.1;

END;

P0:=P0+0.1E-4;

END;

END.

А4 Программа № 4

program lab_3;

const m=2;

var k, tau, dtau, са0, сb0, са, сb, сs, сr, z, ха, а, b, с, d, ca1, са2:геа1;

var i,j,N:integer;

var AM, BM, CM, DM:array[l..M] OF REAL;

VAR CAM, CAM1, CAM2, CBM2, CRM, CSM:array[0..M] OF REAL;

begin

N:=2;

k:=0.08;

tau:=600;

ca0:=0.1/N; cb0:=0.1*(N-l)/N;

writeln ('______________________riv____________________');

writeln;

dtau:=0.01*tau;

ca:=ca0; cb:=cb0; cr:=0; cs:=0; t:=0;

writeln('i ca cb cr');

for i:=l to 100 do

begin

z:=k*ca*cb;

ca:=ca-dtau*z;

cb:=cb-dtau*z;

cr:=cr+dtau*z;

cs:=cs+dtau*z;

{t:=t+dtau;}

if (i=10)or(i=20)or(i=30)or(i=40)or(i=50) then writeln(i,ca,cb,cr);

if (i=60)or(i=70)or(i=80)or(i=90)or(i=100) then writeln(i,ca,cb,cr);

end;

xa:=(ca0-ca)/ca0;

writeln ('xa=',xa,'; tau=i*dtau;',' dtau=',dtau);

writeln ('_____________________ ris_____________________');

writeln;

A:=tau*k; B:=(1+tau*k*(cb0-ca0));

с:=-cа0; D:=sqrt(sqr(B)-4*A*C);

cal:=(-B+D)/(2*A);

ca2:=(-B-D)/(2*A);

if cal<0 then ca:=ca2;

ifca2<0 then ca:=ca1;

cb:=cb0/(1+tau*k*ca);

cr:=tau*k*ca*cb;

cs:=сr; ха:=(са0-cа)/са0;

writeln('tau=',tau,' ca=',ca,' cb=',cb);

writeln('cr=',cr,' cs=',cs,' xa=',xa);

writeln('_____________________ris-m __________________');

writeln;

writeln. ('j ca cb cr cs');

cam[0]:=ca0; cbm[0]:=cb0; crm[0]:=0; csm[0]:=0; t:=tau/m;

for j:=l to m do begin

Am[j]:=t*k; Bm[j]:=(l+t*k*(cbm[j-l]-cam[j-l]));

cm[j]:=-cam[j-l]; Dm[j]:=sqrt(sqr(Bm[j])-4*Am[j] *Cm[j]);

caml [j]:=(-Bm[j]+Dm[j])/(2*Am[j]);

cam2[j]:=(-Bm[j]-Dm[j])/(2*Am[J]);

if caml [j]<0 then cam[j]:=cam2[j];

if cam2[j]<0 then cam[j]:=caml[j];

cbm[j]:=cbm[j-l]/(l+t*k*cam[j]);

crm[j]:=t*k*cam[j]*cbm[j];

csm[j]:=crm[j];

writeln (j, cam[j], cbm[j], crm[j], csm[j]);

end;

xa:=(cam[0]-cam[m])/cam[0];

writeln ('m=',m,' xa=',xa);

end.

 

А5 Программа № 5

program lab_3_l;

var a,b,c,d,a1,b1,kl,k2,t,ca0,cb0,xa,xariv,xaris:real;

var tau, dtau, x, y, y1,ca,cb,cr,cs,cq,cd,friv,fris:real;

var i,j,n:integer;

label 1,11,10,100;

function f(x:real):real;

begin

f:=A*exp(3*ln(x))+b*sqr(x)+c*x+d;

end;

begin

tau:=100; t:=tau;

kl:=1.692E-3; k2:=1.708E-3;

ca0:=l; cb0:=l;

writeln ('______________________riv_______________________');

writeln;

dtau:=0.01*tau;

ca:=ca0; cb:=cb0; cr:=0; cq:=0;

writeln('i ca cb cr cq’);

for i:=l to l00 do

begin

ca:=ca-dtau*(kl *ca+k2*ca*cb);

cb:=cb-dtau*k2*ca*cb;

cr:=cr+dtau*k1*ca;

cq:=cq+dtau*k2*ca*cb;

if (i=10)or(i=20)or(i=30)or(i=40)or(i=50) then writeln (i,ca,cb,cr,cq);

if (i=60)or(i=70)or(i=80)or(i=90)or(i= 100) then

writeln(i,ca,cb,cr,cq);

end;

xariv:=(ca0-ca)/ca0;

writeln ('tau=i*dtau;',' dtau=',dtau);

friv:=cr/ca0;

writeln (' xariv=',xariv,' friv=',friv);

writeln ('____________________ris_______________________');

writeln;

a:=sqr(tau)*kl*k2;

b:=t*k2+tau*kl+tau*k2*cb0;

c:=l-tau*k2*ca0;

d:=-ca0;

al:=0.0l; bl:=cb0;

1:x:=(al+bl)/2;

y:=f(x);

if abs(al-bl)<0.001 then goto 10;

yl:=f(al);

if y*yl<0 then bl:=x else al:=x; goto 1;

10:ca:=x; cb:=cb0/(l+tau*k2*ca);

cr:=tau*kl*ca; cs:=cr;

cq:=Tau*k2*ca*cb; cd:=cq;

xaris:=(ca0-ca)/ca0;

fris:=cr/ca0;

writeln('ca=',ca,'cb=',cb,'cr=’,cr,'cq=',cq);

writeln (' xaris=',xaris,' fris=',fris);

xa:=0.1; while xa<xariv do begin tau:=tau+l;

a:=sqr(tau)*kl*k2;

b:=t*k2+tau*k1+tau*k2*cb0;

c:=l-tau*k2*ca0;

d:=-ca0;

al:=0.01; b:=eb0;

ll:x:=(al+bl)/2;

y:=f(x);

if abs(al-bl)<0.001 then goto 100;

yl:=f(al);

if y*yl<0 then bl:=x else al:=x; goto 11;

100:ca;=x; cb:=cb0/(l+tau*k2*ca);

cr:=tau*kl*ca; cs:=cr;

cq:=Tau*k2*ca*cb; cd:=cq;

xa:=(ca0-ca)/ca0;

end;

fris:=cr/ca0;

writeln (‘________________xa riv = xa ris__________________');

writeln;

writeln ('ха=’,хаriv,' tau riv=',t,' friv=',friv);

writeln (‘ tau ris=',tau,' fris=',fris);

end.

А6 Программа № 6

program lab_4;

var bn0,t,P,k,cb0,ca0,e,xp,x,xx,h,s,Vr,r:real;

var i,j:integer;

function f(x:real):real;

begin

f:=exp(3*LN(l+e*x))*exp(3*LN(T))/k/(sqr(l-x)*(Cb0-

0.5*Ca0*x)*exp(3 *LN(P))); end;

begin

bn0:=0.757;

T:=273; P:=5; k:=1.4E+4;

Cb0:=0.08; Ca0:=0.09; e:=-0.45; xp:=0.8; x:=0;

while (x<xp) do begin

x-x+0.1;

{T:=298+(12.15*x-35.25)/(7.005-0.143*x);

k:=1.4E+4*exp(1.7*LN(293/T));}

h:=0.01*x;{integral}

s:=f(0)+f(x);

xx:=0;

 

for j:=l to 99 do

begin

xx:=xx+h;

s:=s+2*f(xx);

end;

s:=h/2*s; VR:=bn0*s;

writeln ('x=',x,'Vr=',VR);

end;

end.

 

А7 Программа № 7

program lab_5;

var y,y1,a1,b1,cp,ca,cb,ca0,cb0,cr0,kt,tau,dtau,ro:real;

var t,t0,tt,tt0,ttk,xa,k,k0,ft,e,r,H,V,x,vt,cpt,cpa,cpr:real;

var i,j,m:integer;

label 1,10;

function f(vt:real):real;

begin

t:=t0; tt:=ttk; ca:=ca0; cb:=cb0; dtau:=0.01*tau;

for i:=l to 100 do begin

k:=exp(ln(k0)-E/(8.31*t));

{ writeln(‘k=’,k,’ca=’,ca,’t’t,'tt=',tt);}

r:=k*ca;

ca:=ca-dtau*r;

cb:=cb+dtau*r;

t:=t+dtau*(H*r+FT*kt/V*(tt-t))/(cp*ro);

tt:=tt+dtau*(ft*kt/(tau*vt*cpt)*(tt-t));

end;

f:=tt-284;

end;

begin

t0:=301; ca0:=1.8; cb0:=0; cr0:=10.8;

cpa:=62; cpr:=53; ro:=1000;

k0:=1.84E+5; e:=4.49E+4; h:=-448E+4; tt0:=284;

ttk:=293; kt:=0.320;

tau:=360; V:=0.283; FT:=14.16; cpt:=4.190;

cp:=ca0*cpa+cr0*cpr;

al:=0,l; bl:=4.5;

l:x:=(al+bl)/2;

y:=f(x);

{ writeln (‘x=’,x,'y=’,y);}

if abs(y)<0.1 then goto 10;

yl:=f(al);

if y*yl<0 then bl:=x else al:=x; goto 1;

10:

writeln (‘t0=',t0);

vt:=x;

t:=t0; tt:=ttk; ca:=ca0; cb:=cb0; dtau:=0.01*tau;

for i:=l to 100 do begin

k:=exp(ln(k0)-E/(8.31*t));

r:=k*ca;

ca:=ca-dtau*r;

cb:=cb+dtau*r;

t:=t+dtau*(H*r+FT*WV*(tt-t))/(cp*ro);

tt:=tt+dtau*(ft*kt/(tau*vt*cpt)*(tt-t));

if (i=10)or(i=30)or(i=50)or(i=100) then writeln(i,ca,t,tt);

end;

xa:=(ca0-ca)/ca0;

writeln(‘vt=',vt,'xa=',xa);

end.

А8 Программа № 8

program lab_5;

var y,yl,al,bl,cp,ca,cb,ca0,cb0,cr0,kt,tau,dtau,ro:real;

var t,t0,tt,tt0,ttk,xa,k,k0,ft,e,r,H,V,x,vt,cpt,cpa,cpr:real;

var i,j,m:integer;

label 1,10; begin

t0:=301; tau:=6912; ca0:=1.8; cb0:=0; cr0:=10.8;

cpa:=62; q>r:=53;ro:=1000;

k0:=1.84E+5; e:=4.49E+4; h:=-448E+4; tt0:=284;

ttk:=293;kt:=0.320;

tau:=360; V:=0.283; FT:=14.16; cpt:=4.190;

cp:=ca0*cpa+cr0*cpr;

t:=t0; ca:=ca0; cb:=cb0; dtau:=0.01*tau;

for i:=l to 100 do begin

k:=exp(ln(k0)~E/(8.31*t));

r:=k*ca;

ca:=ca-dtau*r;

cb:=cb+dtau*r;

t:=t+dtau*(H*r)/(q)*ro);

if (i=10)or(i=30)or(i=50)or(i=100) then writeln(i,ca,t,cp,r); end;

xa:=(ca0-ca)/ca0;

writeln('xa=',xa); end.

 

А9 Программа № 9

program lab_6;

const n=20;const m=4;

var kl,k2,dt,sl,s2,zm,tsr,edt,za,pa,e,z,p,f:real;

var i:integer;

var c,t:array[l..n] of real;

var al, tmod, fmod: array[l..m] of real;

var 16:text;

begin

assign(16,'c:\tp\oxtlab\16_2.dat');

al[l]:=0; al[2]:=0,03; al[3]:==0.05; al[4]:=0.2;

kl:=0.01; k2:=0.007;

dt:=2;

sl:=0; s2:=0;

reset (16);

for i:=l to n do begin

read(16,t[i],c[i]);

si:=sl+c[i];s2:=s2+c[i]*t[i];end;

zm:=sl*dt;

tsr:=s2/sl; edt:=O; za:=0;pa:=0;

for i:=l to n do begin

e:=c[i]/zm;

edt:=edt+e*dt;

z:=e*(k2/(k2-kl)*exp(-kl*t[i]));

p:=e*(kl/(k2-kl)*exp(-k2*t[i]));

za:=za+dt*z;pa:=pa+dt*p;

{ writeln(i,t[i],c[i]);}

end;

f:=edt-za+pa;

writeln ('tsr(experim)=',tsr,' fs=',f);

writeln ('alfa (model) tsr fs');

for i:=l to m do begin

tmod[i]:=tsr/(l-al[i]);

fmod[i]:=kl*k2*sqr(tmod[i])/((l-al[i])*(l+kl*tmod[i])*(l+k2*tmod[i]));

writeln(al[i],tmod[i],fmod[i]);

end;

close(16); end.

 

 

Багров Геннадий Венидиктович

Севодина Галина Ивановна

Кравцова ОКсана Юрьевна

 

 

Поделиться:





Воспользуйтесь поиском по сайту:



©2015 - 2024 megalektsii.ru Все авторские права принадлежат авторам лекционных материалов. Обратная связь с нами...