请求高手帮忙fortran与C的转换
有哪位大哥大姐帮小弟一下啊?小弟只学过一点点C语言,对Fortran语言更是一窍不通,但是有一个电机题要我用C语言编程。资料上只有Fortran源程序,谁能把下面的Fortran改编成C的啊?下面式资料上的原样,我也不知那些有用,那些没用就全弄这儿了。如果在运行时输入10000 380 2 1.33 2.43 1.12 4.4 7 90 100 100 0.04这12个数据,运行后大约显示P2=10000W I1=11.465A COSphi=0.87099 s=0.03199 Eta=0.87847 Nn=1452.01r/min T2=65.77N.M就算大功告成了。如果有高手肯帮忙的话不管成功与否请麻烦发到小弟邮箱里好吗:wangyao2006031313@
小弟不胜感激!
[bo]PROGRAM MAIN[/bo]
COMMON/BLOCK1/Pn,U1n,p,R1,X1,R2,X2,Rm,Xm,Pomega,Pdelta,s
CALL INPUT
CALL COMPUTATION
END
[bo]SUBROUTINE INPUT[/bo]
INTEGER p
COMMON/BLOCK1/Pn,U1n,p,R1,X1,R2,X2,Rm,Xm,Pomega,Pdelta,s
5 WRITE(*,*)'Please input the following data:'
WRITE(*,*)'Pn,U1n,p,R1,X1,R2,X2,Rm,Xm,Pomega,Pdelta,s=?'
READ(*,*)Pn,U1n,p,R1,X1,R2,X2,Rm,Xm,Pomega,Pdelta,s
WRITE(*,2)Pn,U1n,p,R1,X1,R2,X2,Rm,Xm,Pomega,Pdelta,s
2 FORMAT(1X,2F11.2,I4,2X,6F8.4/1X,2F8.2,F10.5)
WRITE(*,*)'Please check the input data'
10 WRITE(*,*)'Are the data correct? (Yes-input"1",
# No-input"2")'
READ(*,*)INFOR
IF(INFOR.NE.1.AND.INFOR.NE.2)THEN
GO TO 10
ELSE
IF(INFOR.EQ.1)THEN
RETURN
ELSE
WRITE(*,*)'Input data error,input again'
GO TO 5
END IF
END IF
END
[bo]SUBROUTINE COMPUTATION[/bo]
INTEGER p
REAL Nn,I1C
COMPLEX I1,I2,Im,Z1,Z2,Zm
COMMON/BLOCK1/Pn,U1n,p,R1,X1,R2,X2,Rm,Xm,Pomega,Pdelta,s
K=1
EPS=1.e-6
Z1=CMPLX(R1,X1)
100 Z2=CMPLX(R2/s,X2)
Zm=CMPLX(Rm,Xm)
I1=U1n/(Z1+(Zm*Z2)/(Zm+Z2))
I1C=CABS(I1)
phi=ATAN2(AIMAG(I1),REAL(I1))
COSphi=COS(phi)
P1=3*U1n*I1C*COSphi
I2=I1*(Zm/(Zm+Z2))
Im=I1*(Z2/(Zm+Z2))
Pcu1=3*CABS(I1)**2*R1
Pcu2=3*CABS(I2)**2*R2
Pfe=3*CABS(Im)**2*Rm
SP=Pcu1+Pcu2+Pfe+Pomega+Pdelta
P2=P1-SP
WRITE(*,*)'K=',K,'P2=',P2
WRITE(*,*)
IF(ABS(P2-Pn)/Pn.LE.EPS)THEN
Eta=P2/P1
Nn=3000./p*(1-s)
T2=P2/(2*3.1415926*Nn/60)
WRITE(*,20)P2,I1C,COSphi,s,Eta,Nn,T2
20 FORMAT(1X,'P2=',F11.2,'W I1=',F11.3,'A COSphi=',
# F9.5//1X,'s=',F9.5,'Eta=',F9.5,'Nn=',F9.2,
# 'r/min','T2=',F9.2,'N.m')
RETURN
ELSE
K=K+1
s=s*(Pn/P2)
IF(K.GT.15)THEN
WRITE(*.*)'K=',K
WRITE(*.*)'Please check your input data'
STOP
ELSE
GO TO 100
END IF
END IF
END