windsome 发表于 2007-5-14 18:38:07

关于闭环控制命令流的求助

我现在要做一个类似于闭环控制的分析。问题原形就是ansys help system里面Coupled-Field Analysis Guide\Sequential Coupled-Field Analysis \Example Induction-heating Analysis 的这个感应的例子。
这个是电热的分析,一定的感应激励电流导致一定的温度场,而我现在需要确认一个点的温度,使温度符合一定的加热曲线。若有偏差,则调整电流密度;若偏差在容差范围内,则进行下一时间步的计算。
每一步的时间步长为120秒。总共18847秒。
现在计算到240多秒的时候,也就是第二步及以后,会重新回到0秒计算,从而进入一个死循环。不知道哪里出了问题,把命令流发上来,希望大家能帮我找找问题。

我自己写的那段主要是循环控制,思路为初始化,计算标准温度,取观察点温度,若两者差在容差范围(10度)内,则时间增加,并计算;若两者在容差范围外,则以比例调整电流密度,时间不增加,计算。

tempc=25
time=time+tinc
/input,'cylin1dsin','txt','','',0      !initial
*do,i,1,ftime/tinc
*if,time,gt,5455,then
*if,time,gt,13392,then
tempc=760-0.1347*(time-13392)
*else
tempc=760
*endif
*else
tempc=25+0.1347*time
*endif                                  !calculate the standard temperature
*get,temp,node,2,temp
*if,abs(tempc-temp),gt,10,then
/solu
k=(tempc+273)/(temp+273)
curr=curr*k
esel,s,mat,,3
bfe,all,js,,,,curr      
esel,all
physics,write,emag
i=i-1
finish                              !reset the current and restart the computation
*else
time=time+tinc                         !next time step
*endif
/input,'cylin1dsin','txt','','',0
*enddo

[ 本帖最后由 windsome 于 2007-5-14 18:41 编辑 ]
页: [1]
查看完整版本: 关于闭环控制命令流的求助