trnsys模拟中的fortran的问题,函数调用精度错误?
trnsys是热力模拟仿真软件,在使用一个部件的时候出现了程序问题,具体哪个部件是 将水与蒸汽混合 其中需要查表来得知一下汽水参数。运行时出现了以下错误,希望有热力学背景的大神赐教,不惜一切代价
子程序代码如下:
SUBROUTINE TYPE304 (TIME,XIN,OUT,T,DTDT,PAR,INFO,ICNTRL,*)
USE TrnsysFunctions
USE TrnsysConstants
IMPLICIT NONE
DOUBLE PRECISION XIN,OUT,TIME,PAR,T,DTDT,STORED
INTEGER*4 INFO(15),NI,NP,NO,ND,NS,IUNIT,ITYPE,ICNTRL
CHARACTER*3 OCHECK,YCHECK
PARAMETER (NP=0,NI=7,NO=6,ND=0,NS=0)
DIMENSION XIN(NI),OUT(NO),PAR(NP),YCHECK(NI),OCHECK(NO),
& STORED(NS)
DOUBLE PRECISION FL_Steam,
& T_Steam,
& X_Steam,
& FL_fw,
& T_fw,
& P_out,
& Tset,
& P_in,
& PROP(7),
& H_steam,
& Hset,
& H_fw,
& FL_mix,
& Fl_d_fw,
& Fl_d_s,
& Hmix,
& Tmix,
& X_mix,
& IERR,
& TIME0,
& DELT,
& Relax
PARAMETER ( Relax = 0.05)
DATA YCHECK/'MF1','TE1','DM1','MF1','TE1','PR1','TE1'/
DATA OCHECK/'MF1','MF1','MF1','TE1','DM1','PR1'/
TIME0 = getSimulationStartTime()
DELT= getSimulationTimeStep()
IF(INFO(7).EQ.-2) THEN
INFO(12)=16
RETURN 1
ENDIF
IF (INFO(8).EQ.-1) THEN
RETURN 1
ENDIF
IF(INFO(13).GT.0) THEN
RETURN 1
ENDIF
IF (INFO(7).EQ.-1) THEN
IUNIT=INFO(1)
ITYPE=INFO(2)
INFO(6)= NO
INFO(9)= 1
INFO(10) = 0
CALL setStorageSize(NS,INFO)
CALL TYPECK(1,INFO,NI,NP,ND)
CALL RCHECK(INFO,YCHECK,OCHECK)
RETURN 1
ENDIF
IF (TIME.LT.(TIME0+DELT/2.d0)) THEN
IUNIT=INFO(1)
ITYPE=INFO(2)
OUT(1)= 0.d0
OUT(2)= XIN(1)
OUT(3)= XIN(2)
RETURN 1
ENDIF
100 CONTINUE
FL_Steam = XIN(1)
T_Steam= XIN(2)
X_steam= XIN(3)
FL_fw = XIN(4)
T_fw = XIN(5)
P_out = XIN(6)
Tset = XIN(7)
P_in = P_out
IF (x_steam.ge.1 .or. x_steam.le.0) THEN
PROP(1) = T_Steam
PROP(2) = 0.1*P_in
CALL steam3('SI',PROP,12,ierr,*108)
CALL LINKCK('TYPE 304','Steam',1,99)
108 H_steam = PROP(3)
ELSE
PROP(2) = 0.1*P_in
PROP(5) = x_Steam
CALL steam3('SI',PROP,25,ierr,*109)
CALL LINKCK('TYPE 304','Steam',1,99)
109 H_steam= PROP(3)
ENDIF
PROP(1) = Tset
PROP(2) = 0.1*P_out
CALL steam3('SI',PROP,12,ierr,*110)
CALL LINKCK('TYPE 304','Steam',1,99)
110 Hset = PROP(3)
PROP(1) = T_fw
PROP(5) = 0.d0
CALL steam3('SI',PROP,15,ierr,*112)
CALL LINKCK('TYPE 304','Steam',1,99)
112 H_fw = PROP(3)
FL_mix= FL_steam+Fl_fw
IF ( (Hset-H_fw.LE.0.0).OR.(H_steam-Hset.eq.0.0) ) THEN
Fl_d_fw = 0.d0
Fl_d_s= 0.d0
ELSE
Fl_d_fw=
#DMIN1(DMAX1(0.,FL_steam * (H_steam-Hset)/(Hset-H_fw)),FL_steam)
Fl_d_s=DMIN1(DMAX1(0.,Fl_fw * (Hset - H_fw) /
# (H_steam-Hset)),Fl_fw)
ENDIF
IF (Fl_mix.le.1e-6) THEN
Hmix= H_fw
ELSE
Hmix= (Fl_steam*H_steam + fl_fw*H_fw)/Fl_mix
ENDIF
PROP(3) = Hmix
PROP(2) = 0.1*P_out
CALL steam_C('SI',PROP,23,ierr,*111)
CALL LINKCK('TYPE 304','Steam',1,99)
111 Tmix = PROP(1)
x_mix = DMIN1(2.0,Prop(5))
200 CONTINUE
IF (info(7).le.20) THEN
OUT(1) = FL_d_FW
OUT(2) = FL_d_S
OUT(3) = FL_mix
OUT(4) = Tmix
OUT(5) = X_mix
OUT(6) = P_in
ELSE
OUT(1) = OUT(1) + relax*(FL_d_FW-out(1))
OUT(2) = OUT(2) + relax*(FL_d_S-out(2))
OUT(3) = OUT(3) + relax * (FL_mix -out(3))
OUT(4) = OUT(4) + relax * (Tmix - out(4))
OUT(5) = OUT(5) + relax*(X_mix -out(5))
OUT(6) = P_in
ENDIF
RETURN 1
END
其实就是喷水减温的一个部件 有赐教的大神可以联系我qq342158634,已经困扰我几个月的问题了,解决必有重谢 1、如果你有所有的源代码,检查第一张图上列出的错误行。source为源代码文件名, line 为行号。
2、根据第二张图的提示,应该是混用了单精度和双精度,导致参数传递不对。可能出问题的不是你给出的代码。 li913 发表于 2018-3-21 10:19
1、如果你有所有的源代码,检查第一张图上列出的错误行。source为源代码文件名, line 为行号。
2、根据第 ...
非常感谢。
页:
[1]