主题:求助!在线等
各位大侠您们好,小弟现在刚刚接触delphi,还是菜鸟,想请你们帮我把这段pascal语言写的程序改一下,能在delphi中运行。谢谢!
Program ThemStress1(input,output);
Const
MaxEquations=90;
PlusMax=91;
Type
Matrix = array [0..MaxEquations, 1..PlusMax] of real;
Vector = array [0..MaxEquations] of real;
VAR
m: matrix;
T,y,x,xx,zz,Phi,phi0,k,d0,c,d,crit: vector;
nn,i,j,n,g,jj,f: integer;
Sinhs,Coshs,SinAs,CosAs,I0,P,fai,delta,Ps,omega,hs,As,Aw,gamma,Idn,Idh,Idv,Ish,Isv,Irv,Iz:real;
b,h,ti,delth1,delth2,delth3,delth4,delth5,delth6,lam4,lam5,lam6,C4,R4,rr4,B4,C5,R5,rr5,B5,C6,R6,rr6,B6:real;
Tin,Tout,lam1,lam2,lam3,alphain,alphaout,C1,R1,rr1,B1,C2,R2,rr2,B2,C3,R3,rr3,B3,Q,deltt,Tmax1,Tmin1,Tmax2,Tmin2:real;
dat1,dat3,dat4,dat5,outfile:text;
Label 10,100,1000;
Procedure Readvec1(n:integer;var z: vector);
var
num:real;
begin
for i:=1 to n+1 do begin
read(dat1,num);
z[i]:=num*(1/1);
end;
end;
{Procedure Readvec2(g:integer;var a: moto);
var
num:real;
begin
for i:=1 to g do begin
read(dat2,num);
a[i]:=num*(1/1);
end;
end;}
Procedure Readvec3(f:integer;var d: vector);
var
num:real;
begin
for i:=1 to f do begin
read(dat3,num);
d[i]:=num*(1/1);
end;
end;
Procedure Readvec4(f:integer;var c: vector);
var
num:real;
begin
for i:=1 to f do begin
read(dat4,num);
c[i]:=num*(1/1);
end;
end;
function pow(a,b:real):real;
begin
pow:=exp(b*ln(a))
end;
Begin
assign(outfile,'G:\12g3xj-w.dat');
rewrite(outfile);
writeln(outfile,'Iz,alfa,T1,T5,T10,T20,T30,T45,T49,T53,T57,T61,T71,T77,Tout,t(h) ');
deltt:=0.50; {sec}
ti:=deltt; {sec}
b:=0;
delth1:=0.0005;{m}
delth2:=0.005;{m}
delth3:=0.0005;{m}
delth4:=0.005;{m}
delth5:=0.0005;{m}
delth6:=0.0005;{m}
Tin:=25;
{ Tout:=-10;}
alphain:=8.7; {W/m2K}
alphaout:=19; {W/m2K}
Tmax1:=39.0;
Tmin1:=23.0;
Tmax2:=39.0;
Tmin2:=23.0;
lam1:=0.6; {W/mK}
C1:=1050; {J/kgK}
R1:=1300; {kg/m3}
lam2:=1.74; {W/mK}
C2:=920; {J/kgK}
R2:=2300; {kg/m3}
lam3:=0.76; {W/mK}
C3:=1050; {J/kgK}
R3:=1500; {kg/m3}
lam4:=0.05; {W/mK}
C4:=1070; {J/kgK}
R4:=200; {kg/m3}
lam5:=0.81; {W/mK}
C5:=1050; {J/kgK}
R5:=1600; {kg/m3}
lam6:=0.5; {W/mK}
C6:=1050; {J/kgK}
R6:=1100; {kg/m3}
{1W=1J/s}
{ deltt:=delth*delth/D;}
n:=76;
for i:=1 to n+1 do begin
T[i]:=23;
end;
jj:=0;
Repeat
jj:=jj+1;
I0:=1316;{w/m2}
P:=0.6;{tou ming du}
fai:=40*3.14/180;{di li wei du}
delta:=23.45*3.14/180;{dongzhi}
Ps:=0.2;{di mian fan she lv}
omega:=15*(ti/3600-12)*3.14/180;{tai yang shi jiao}
{writeln('omega=',omega*180/3.14);}
Sinhs:=sin(fai)*sin(delta)+cos(fai)*cos(delta)*cos(omega);{sin(hs)}
Coshs:=pow((1-Sinhs*Sinhs),0.5);
hs:=arctan(Sinhs/Coshs);
{writeln('hs=',hs*180/3.14);}
if (hs*180/3.14<=1) then begin
Idv:=0;
Isv:=0;
Irv:=0;
Iz:=0;
end
else begin
SinAs:=cos(delta)*sin(omega)/cos(hs);
CosAs:=pow((1-SinAs*SinAs),0.5);
if (SinAs>1) then begin
CosAs:=(sin(hs)*sin(fai)-sin(delta))/(cos(hs)*cos(fai));
SinAs:=pow((1-CosAs*CosAs),0.5);
end;
nn:=10;
For j:=1 to nn do begin
if (ti/3600/24>=j-1) and (ti/3600/24<j) then begin
if ti/3600-(j-1)*24<=8.083333 then begin
As:=-3.14-arctan(SinAs/CosAs);
end;
if (ti/3600-(j-1)*24>8.083333) and (ti/3600-(j-1)*24<=15.916667) then begin
As:=arctan(SinAs/CosAs);
end;
if (ti/3600-(j-1)*24>15.916667) then begin
As:=3.14-arctan(SinAs/CosAs);
end;
end;
end;
Aw:=90*3.14/180;{deg, bei qiang}
if As<=0 then begin
gamma:=Aw-As;
end;
if As>0 then begin
gamma:=Aw-As;
end;
{tai yang zhi fu she}
Idn:=I0*pow(P,1/sin(hs));
Idh:=Idn*sin(hs);
Idv:=Idn*cos(hs)*cos(gamma);
if Idv<0 then begin
Idv:=0;
end;
{tai yang san she fu she}
Ish:=0.5*I0*(1-pow(P,1/sin(hs)))/(1-1.4*ln(P))*sin(hs);
Isv:=0.5*Ish;
Irv:=0.5*Ps*(Idh+Ish);
Iz:=Idv+Isv+Irv;
end;
if (Iz<=0) then begin
Iz:=0;
end;
{writeln('Iz=',Iz);}
nn:=10;
For j:=1 to nn do begin
if (ti/3600/24>=j-1) and (ti/3600/24<j) then begin
Tout:=(Tmax2+Tmin2)/2-sin(2*3.14*(ti/3600-(j-1)*24+2)/24)*(Tmax2-Tmin2)/2;
end;
end;
{ if (ti/3600<=24) then begin
Tout:=(Tmax1+Tmin1)/2-sin(2*3.14*(ti/3600+2)/24)*(Tmax1-Tmin1)/2;
end;
if (Ti/3600>24) and (ti/3600<=48) then begin
Tout:=(Tmax2+Tmin2)/2-sin(2*3.14*(ti/3600-24+2)/24)*(Tmax2-Tmin2)/2;
end;}
rr1:=lam1*deltt/(C1*R1*delth1*delth1);
B1:=alphain*delth1/lam1;
rr2:=lam2*deltt/(C2*R2*delth2*delth2);
{ B2:=alphain*delth2/lam2;}
rr3:=lam3*deltt/(C3*R3*delth3*delth3);
{ B3:=alphaout*delth3/lam3;}
rr4:=lam4*deltt/(C4*R4*delth4*delth4);
{ B4:=alphain*delth4/lam4;}
rr5:=lam5*deltt/(C5*R5*delth5*delth5);
{ B5:=alphain*delth5/lam5;}
rr6:=lam6*deltt/(C6*R6*delth6*delth6);
B6:=alphaout*delth6/lam6;
T[1]:=(1-2*rr1-2*rr1*B1)*T[1]+2*rr1*(T[2]+B1*Tin);
{writeln(T[1]);}
T[n+1]:=(1-2*rr6-2*rr6*B6)*T[n+1]+2*rr6*(T[n]+B6*Tout)+2*0.65*Iz*deltt/(R6*C6*delth6);
for i:=2 to n do begin
if (i>=2) and (i<=5) then begin
T[i]:=(1-2*rr1)*T[i]+rr1*(T[i+1]+T[i-1]);
{writeln(T[i]);}
end;
if (i>=6) and (i<=45) then begin
T[i]:=(1-2*rr2)*T[i]+rr2*(T[i+1]+T[i-1]);
{writeln(T[i]);}
end;
if (i>=46) and (i<=49) then begin
T[i]:=(1-2*rr3)*T[i]+rr3*(T[i+1]+T[i-1]);
{writeln(T[i]);}
end;
if (i>=50) and (i<=61) then begin
T[i]:=(1-2*rr4)*T[i]+rr4*(T[i+1]+T[i-1]);
end;
if (i>=62) and (i<=71) then begin
T[i]:=(1-2*rr5)*T[i]+rr5*(T[i+1]+T[i-1]);
end;
if (i>=72) and (i<=76) then begin
T[i]:=(1-2*rr6)*T[i]+rr6*(T[i+1]+T[i-1]);
end;
T[5]:=(lam1/delth1*(4*T[4]-T[3])+lam2/delth2*(4*T[6]-T[7]))/(3*lam1/delth1+3*lam2/delth2);
T[45]:=(lam2/delth2*(4*T[44]-T[43])+lam3/delth3*(4*T[46]-T[47]))/(3*lam2/delth2+3*lam3/delth3);
T[49]:=(lam3/delth3*(4*T[48]-T[47])+lam4/delth4*(4*T[50]-T[51]))/(3*lam3/delth3+3*lam4/delth4);
T[61]:=(lam4/delth4*(4*T[60]-T[59])+lam5/delth5*(4*T[62]-T[63]))/(3*lam4/delth4+3*lam5/delth5);
T[71]:=(lam5/delth5*(4*T[70]-T[69])+lam6/delth6*(4*T[72]-T[73]))/(3*lam5/delth5+3*lam6/delth6);
end;
if (ti-b>=100) then begin
writeln(outfile);
write(outfile,Iz:20:20);
write(outfile,' ');
write(outfile,As*180/3.14:20:10);
write(outfile,' ');
write(outfile,T[1]:20:20);
write(outfile,' ');
write(outfile,T[5]:20:20);
write(outfile,' ');
write(outfile,T[10]:20:20);
write(outfile,' ');
write(outfile,T[20]:20:20);
write(outfile,' ');
write(outfile,T[30]:20:20);
write(outfile,' ');
write(outfile,T[45]:20:20);
write(outfile,' ');
write(outfile,T[49]:20:20);
write(outfile,' ');
write(outfile,T[53]:20:20);
write(outfile,' ');
write(outfile,T[57]:20:20);
write(outfile,' ');
write(outfile,T[61]:20:20);
write(outfile,' ');
write(outfile,T[71]:20:20);
write(outfile,' ');
write(outfile,T[77]:20:20);
write(outfile,' ');
write(outfile,Tout:20:20);
write(outfile,' ');
write(outfile,ti/3600:10:10);
b:=ti;
end;
ti:=ti+deltt;
writeln('ti=',ti/3600);
until ti/3600=120; { give the time we need to output }
close(outfile);
end.
Program ThemStress1(input,output);
Const
MaxEquations=90;
PlusMax=91;
Type
Matrix = array [0..MaxEquations, 1..PlusMax] of real;
Vector = array [0..MaxEquations] of real;
VAR
m: matrix;
T,y,x,xx,zz,Phi,phi0,k,d0,c,d,crit: vector;
nn,i,j,n,g,jj,f: integer;
Sinhs,Coshs,SinAs,CosAs,I0,P,fai,delta,Ps,omega,hs,As,Aw,gamma,Idn,Idh,Idv,Ish,Isv,Irv,Iz:real;
b,h,ti,delth1,delth2,delth3,delth4,delth5,delth6,lam4,lam5,lam6,C4,R4,rr4,B4,C5,R5,rr5,B5,C6,R6,rr6,B6:real;
Tin,Tout,lam1,lam2,lam3,alphain,alphaout,C1,R1,rr1,B1,C2,R2,rr2,B2,C3,R3,rr3,B3,Q,deltt,Tmax1,Tmin1,Tmax2,Tmin2:real;
dat1,dat3,dat4,dat5,outfile:text;
Label 10,100,1000;
Procedure Readvec1(n:integer;var z: vector);
var
num:real;
begin
for i:=1 to n+1 do begin
read(dat1,num);
z[i]:=num*(1/1);
end;
end;
{Procedure Readvec2(g:integer;var a: moto);
var
num:real;
begin
for i:=1 to g do begin
read(dat2,num);
a[i]:=num*(1/1);
end;
end;}
Procedure Readvec3(f:integer;var d: vector);
var
num:real;
begin
for i:=1 to f do begin
read(dat3,num);
d[i]:=num*(1/1);
end;
end;
Procedure Readvec4(f:integer;var c: vector);
var
num:real;
begin
for i:=1 to f do begin
read(dat4,num);
c[i]:=num*(1/1);
end;
end;
function pow(a,b:real):real;
begin
pow:=exp(b*ln(a))
end;
Begin
assign(outfile,'G:\12g3xj-w.dat');
rewrite(outfile);
writeln(outfile,'Iz,alfa,T1,T5,T10,T20,T30,T45,T49,T53,T57,T61,T71,T77,Tout,t(h) ');
deltt:=0.50; {sec}
ti:=deltt; {sec}
b:=0;
delth1:=0.0005;{m}
delth2:=0.005;{m}
delth3:=0.0005;{m}
delth4:=0.005;{m}
delth5:=0.0005;{m}
delth6:=0.0005;{m}
Tin:=25;
{ Tout:=-10;}
alphain:=8.7; {W/m2K}
alphaout:=19; {W/m2K}
Tmax1:=39.0;
Tmin1:=23.0;
Tmax2:=39.0;
Tmin2:=23.0;
lam1:=0.6; {W/mK}
C1:=1050; {J/kgK}
R1:=1300; {kg/m3}
lam2:=1.74; {W/mK}
C2:=920; {J/kgK}
R2:=2300; {kg/m3}
lam3:=0.76; {W/mK}
C3:=1050; {J/kgK}
R3:=1500; {kg/m3}
lam4:=0.05; {W/mK}
C4:=1070; {J/kgK}
R4:=200; {kg/m3}
lam5:=0.81; {W/mK}
C5:=1050; {J/kgK}
R5:=1600; {kg/m3}
lam6:=0.5; {W/mK}
C6:=1050; {J/kgK}
R6:=1100; {kg/m3}
{1W=1J/s}
{ deltt:=delth*delth/D;}
n:=76;
for i:=1 to n+1 do begin
T[i]:=23;
end;
jj:=0;
Repeat
jj:=jj+1;
I0:=1316;{w/m2}
P:=0.6;{tou ming du}
fai:=40*3.14/180;{di li wei du}
delta:=23.45*3.14/180;{dongzhi}
Ps:=0.2;{di mian fan she lv}
omega:=15*(ti/3600-12)*3.14/180;{tai yang shi jiao}
{writeln('omega=',omega*180/3.14);}
Sinhs:=sin(fai)*sin(delta)+cos(fai)*cos(delta)*cos(omega);{sin(hs)}
Coshs:=pow((1-Sinhs*Sinhs),0.5);
hs:=arctan(Sinhs/Coshs);
{writeln('hs=',hs*180/3.14);}
if (hs*180/3.14<=1) then begin
Idv:=0;
Isv:=0;
Irv:=0;
Iz:=0;
end
else begin
SinAs:=cos(delta)*sin(omega)/cos(hs);
CosAs:=pow((1-SinAs*SinAs),0.5);
if (SinAs>1) then begin
CosAs:=(sin(hs)*sin(fai)-sin(delta))/(cos(hs)*cos(fai));
SinAs:=pow((1-CosAs*CosAs),0.5);
end;
nn:=10;
For j:=1 to nn do begin
if (ti/3600/24>=j-1) and (ti/3600/24<j) then begin
if ti/3600-(j-1)*24<=8.083333 then begin
As:=-3.14-arctan(SinAs/CosAs);
end;
if (ti/3600-(j-1)*24>8.083333) and (ti/3600-(j-1)*24<=15.916667) then begin
As:=arctan(SinAs/CosAs);
end;
if (ti/3600-(j-1)*24>15.916667) then begin
As:=3.14-arctan(SinAs/CosAs);
end;
end;
end;
Aw:=90*3.14/180;{deg, bei qiang}
if As<=0 then begin
gamma:=Aw-As;
end;
if As>0 then begin
gamma:=Aw-As;
end;
{tai yang zhi fu she}
Idn:=I0*pow(P,1/sin(hs));
Idh:=Idn*sin(hs);
Idv:=Idn*cos(hs)*cos(gamma);
if Idv<0 then begin
Idv:=0;
end;
{tai yang san she fu she}
Ish:=0.5*I0*(1-pow(P,1/sin(hs)))/(1-1.4*ln(P))*sin(hs);
Isv:=0.5*Ish;
Irv:=0.5*Ps*(Idh+Ish);
Iz:=Idv+Isv+Irv;
end;
if (Iz<=0) then begin
Iz:=0;
end;
{writeln('Iz=',Iz);}
nn:=10;
For j:=1 to nn do begin
if (ti/3600/24>=j-1) and (ti/3600/24<j) then begin
Tout:=(Tmax2+Tmin2)/2-sin(2*3.14*(ti/3600-(j-1)*24+2)/24)*(Tmax2-Tmin2)/2;
end;
end;
{ if (ti/3600<=24) then begin
Tout:=(Tmax1+Tmin1)/2-sin(2*3.14*(ti/3600+2)/24)*(Tmax1-Tmin1)/2;
end;
if (Ti/3600>24) and (ti/3600<=48) then begin
Tout:=(Tmax2+Tmin2)/2-sin(2*3.14*(ti/3600-24+2)/24)*(Tmax2-Tmin2)/2;
end;}
rr1:=lam1*deltt/(C1*R1*delth1*delth1);
B1:=alphain*delth1/lam1;
rr2:=lam2*deltt/(C2*R2*delth2*delth2);
{ B2:=alphain*delth2/lam2;}
rr3:=lam3*deltt/(C3*R3*delth3*delth3);
{ B3:=alphaout*delth3/lam3;}
rr4:=lam4*deltt/(C4*R4*delth4*delth4);
{ B4:=alphain*delth4/lam4;}
rr5:=lam5*deltt/(C5*R5*delth5*delth5);
{ B5:=alphain*delth5/lam5;}
rr6:=lam6*deltt/(C6*R6*delth6*delth6);
B6:=alphaout*delth6/lam6;
T[1]:=(1-2*rr1-2*rr1*B1)*T[1]+2*rr1*(T[2]+B1*Tin);
{writeln(T[1]);}
T[n+1]:=(1-2*rr6-2*rr6*B6)*T[n+1]+2*rr6*(T[n]+B6*Tout)+2*0.65*Iz*deltt/(R6*C6*delth6);
for i:=2 to n do begin
if (i>=2) and (i<=5) then begin
T[i]:=(1-2*rr1)*T[i]+rr1*(T[i+1]+T[i-1]);
{writeln(T[i]);}
end;
if (i>=6) and (i<=45) then begin
T[i]:=(1-2*rr2)*T[i]+rr2*(T[i+1]+T[i-1]);
{writeln(T[i]);}
end;
if (i>=46) and (i<=49) then begin
T[i]:=(1-2*rr3)*T[i]+rr3*(T[i+1]+T[i-1]);
{writeln(T[i]);}
end;
if (i>=50) and (i<=61) then begin
T[i]:=(1-2*rr4)*T[i]+rr4*(T[i+1]+T[i-1]);
end;
if (i>=62) and (i<=71) then begin
T[i]:=(1-2*rr5)*T[i]+rr5*(T[i+1]+T[i-1]);
end;
if (i>=72) and (i<=76) then begin
T[i]:=(1-2*rr6)*T[i]+rr6*(T[i+1]+T[i-1]);
end;
T[5]:=(lam1/delth1*(4*T[4]-T[3])+lam2/delth2*(4*T[6]-T[7]))/(3*lam1/delth1+3*lam2/delth2);
T[45]:=(lam2/delth2*(4*T[44]-T[43])+lam3/delth3*(4*T[46]-T[47]))/(3*lam2/delth2+3*lam3/delth3);
T[49]:=(lam3/delth3*(4*T[48]-T[47])+lam4/delth4*(4*T[50]-T[51]))/(3*lam3/delth3+3*lam4/delth4);
T[61]:=(lam4/delth4*(4*T[60]-T[59])+lam5/delth5*(4*T[62]-T[63]))/(3*lam4/delth4+3*lam5/delth5);
T[71]:=(lam5/delth5*(4*T[70]-T[69])+lam6/delth6*(4*T[72]-T[73]))/(3*lam5/delth5+3*lam6/delth6);
end;
if (ti-b>=100) then begin
writeln(outfile);
write(outfile,Iz:20:20);
write(outfile,' ');
write(outfile,As*180/3.14:20:10);
write(outfile,' ');
write(outfile,T[1]:20:20);
write(outfile,' ');
write(outfile,T[5]:20:20);
write(outfile,' ');
write(outfile,T[10]:20:20);
write(outfile,' ');
write(outfile,T[20]:20:20);
write(outfile,' ');
write(outfile,T[30]:20:20);
write(outfile,' ');
write(outfile,T[45]:20:20);
write(outfile,' ');
write(outfile,T[49]:20:20);
write(outfile,' ');
write(outfile,T[53]:20:20);
write(outfile,' ');
write(outfile,T[57]:20:20);
write(outfile,' ');
write(outfile,T[61]:20:20);
write(outfile,' ');
write(outfile,T[71]:20:20);
write(outfile,' ');
write(outfile,T[77]:20:20);
write(outfile,' ');
write(outfile,Tout:20:20);
write(outfile,' ');
write(outfile,ti/3600:10:10);
b:=ti;
end;
ti:=ti+deltt;
writeln('ti=',ti/3600);
until ti/3600=120; { give the time we need to output }
close(outfile);
end.