热处理论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

北京中仪天信科技有限公司 江苏东方航天校准检测有限公司 热处理论坛合作伙伴广告位
搜索
查看: 3870|回复: 1

[求助] 谁能看懂这个计算铁素体的体积分数的VB程序

[复制链接]

该用户从未签到

发表于 2008-6-6 17:03:15 | 显示全部楼层 |阅读模式
北京中仪天信科技有限公司
Option Explicit

Dim ca(1000), cacm(1000), wf(1000), xfc(1000), xpc(1000), temp(1000), tempp(1000), delt As Double
Dim xf(1000), xaf(1000), xff(1000), tf(1000), bf(1000), nf As Double
Dim xp(1000), xpp(1000), tp(1000), bp(1000), np As Double
Dim c, mn, pf, pp As Double
Dim i, j As Integer
Dim wf1(1000), wf2(1000) As Double
Dim wp1(1000), wp2(1000) As Double
Dim xfc1(1000), xfc2(1000), tf1(1000) As Double
Dim xpc1(1000), xpc2(1000), tp1(1000) As Double
Dim cool, coolp As Double
Dim k, l As Integer
Dim deltxf(1000), sumf(1000)  As Double
Dim deltxp(1000), sump(1000)  As Double
Dim pf1, pf2(1000), pf3, pf4, dr0, dr, ae3, strain As Double
Dim pp1, pp2(1000), pp3, pp4, ae1 As Double
Dim pwf(1000) As Double
Dim pwp(1000) As Double
Dim cau(1000) As Double
Dim tpe As Double
Dim temperature As Double
Dim tem As Double
Dim delt1 As Double
'


Private Sub cmdSave_Click()
Dim lp As Integer
    Open "F:\毕业设计\Phase Fraction Program\result.txt" For Output Access Write As #100
   
    Print #100, "Step" & vbTab & vbTab & "Xf" & vbTab & vbTab & "Temp" & vbCrLf
    For lp = 1 To i - 1
        Print #100, lp & vbTab & vbTab & xf(lp) & vbTab & vbTab & temp(lp) & vbCrLf
    '    Write #100, vbCrLf
    Next lp
    Print #100, vbCrLf
    Print #100, vbCrLf
    Print #100, "Step" & vbTab & vbTab & "Xp" & vbTab & vbTab & "Tempp" & vbCrLf
    For lp = 1 To k - 1
        Print #100, lp & vbTab & vbTab & xp(lp) & vbTab & vbTab & tempp(lp) & vbCrLf
    Next lp
    Close #100
End Sub
Private Sub Command1_Click()
c = 0.12  '0.07   0.36
mn = 0.5 ''0-1.3
pf = 7.86
pp = 7.81
nf = 0.89
np = 0.99
delt = 1
tf(0) = 0
tp(0) = 0
cool = 15 ''''''(884 - 600) / 25 ''''11.36 ''''1-17.9
sumf(0) = 0
sump(0) = 0
strain = 0.06 ''0
dr0 = 15 '''''3.5-23
pf3 = 67
pf4 = 1.9
dr = dr0 / (1 + 0.5 * strain)
pf1 = 2 / (dr * (c + (mn / 6)))
pp1 = 13 / dr
pp3 = 47
pp4 = 2.2
pf2(0) = 0
pp2(0) = 0
delt1 = 10 ^ (-3)
ae1 = 727
coolp = 5
ae3 = 904.7899 - 374.25945 * c + 195.43806 * c * c
tpe = 682.71 - 156.07 * c - 6.6809 * mn - 9 * (cool ^ 0.12) '''

'''Calculation of ferrite fraction
For i = 1 To 100
   
   '''' pf2(i) = ae3 - 215 + (28.15 / (dr ^ 0.02)) - 0.0007 * c
   
     pf2(i) = ae3 - 215 + (28.15 / (dr ^ 0.02)) - 0.0007 * c
     
    temperature = 874.087 + 407.67788 * c - 3724.46472 * c * c + 8293.05941 * c * c * c - 6277.1172 * c * c * c * c - 22.56 * (cool ^ 0.27)
    temp(i) = temperature - (i - 1) * cool * delt
    tem = temp(i - 1)
    j = i
   
   ''''' pwf(i) = Abs((temp(i) - pf2(i - 1)) / pf3) ^ pf4   '''''''''''
   
    pwf(i) = ((temp(i) - pf2(i - 1)) / pf3) ^ pf4
    bf(i) = pf1 * Exp(-pwf(i))
    xf(i) = 1 - Exp((-bf(i)) * ((delt + tf(i - 1)) ^ nf))
   
    cacm(i) = -0.29729 + (4.57757 / 10000) * temp(i) + (1.37432 / 1000000) * temp(i) * temp(i)
    cau(i) = (c - xf(i) * ca(i)) / (1 - xf(i))
   
    If cacm(i) < cau(i) Then
       Exit For
    End If
   
   
    ca(i) = 0.04628 + (1.27515 / 100000) * temp(i) - (1.695367 / 100000000) * temp(i) * temp(i)
    wf1(i) = cacm(i) - c
    wf2(i) = cacm(i) - ca(i)
    wf(i) = wf1(i) / wf2(i)
    xfc1(i) = wf(i) / pf
    xfc2(i) = (1 - wf(i)) / pp
    xfc(i) = xfc1(i) / (xfc1(i) + xfc2(i))
   '''''''''''''''
    temp(i + 1) = temperature - ((i + 1) - 1) * cool * delt
   
    '''pwf(i + 1) = Abs((temp(i + 1) - pf2(i)) / pf3) ^ pf4  ''''''''
     pwf(i + 1) = ((temp(i + 1) - pf2(i)) / pf3) ^ pf4
    bf(i + 1) = pf1 * Exp(-pwf(i + 1))
    ca(i + 1) = 0.04628 + (1.27515 / 100000) * temp(i + 1) - (1.695367 / 100000000) * temp(i + 1) * temp(i + 1)
    cacm(i + 1) = -0.29729 + (4.57757 / 10000) * temp(i + 1) + (1.37432 / 1000000) * temp(i + 1) * temp(i + 1)
     
    wf1(i + 1) = cacm(i + 1) - c
    wf2(i + 1) = cacm(i + 1) - ca(i + 1)
    wf(i + 1) = wf1(i + 1) / wf2(i + 1)
    xfc1(i + 1) = wf(i + 1) / pf
    xfc2(i + 1) = (1 - wf(i + 1)) / pp
   
    xfc(i + 1) = xfc1(i + 1) / (xfc1(i + 1) + xfc2(i + 1))
    xff(i) = (xfc(i) / xfc(i + 1)) * xf(i)
    tf1(i) = Log(1 / (1 - xff(i)))
    tf(i) = ((tf1(i)) / bf(i + 1)) ^ (1 / nf)
   
    deltxf(i) = xf(i) - xf(i - 1)
    sumf(i) = deltxf(i) + sumf(i - 1)
Next i
  
   Text1.Text = Str(j)
   Text2.Text = Str(sumf(i - 1))
   Text3.Text = Str(tem)

  '''Calculation of pearlite fraction

  For k = 1 To 100
   
    pp2(k) = ae1 - 175 + (27.8 / (dr ^ 0.02)) - 22 * c
    If Abs(cool - coolp) < 4.5 Then
       cool = coolp - (cool - coolp) / 4.5
    End If
   
    tempp(k) = tem - (k - 1) * cool * delt
    l = k
    pwp(k) = ((tempp(k) - pp2(k - 1)) / pp3) ^ pp4 ''''''''''''
    bp(k) = pp1 * Exp(-pwp(k))
    xp(k) = 1 - Exp((-bp(k)) * ((delt + tp(k - 1)) ^ np))
   
   
    If tempp(k) < tpe Then
    Exit For
    End If
   
    ca(k) = 0.04628 + (1.27515 / 100000) * temp(k) - (1.695367 / 100000000) * temp(k) * temp(k)
    cacm(k) = -0.29729 + (4.57757 / 10000) * temp(k) + (1.37432 / 1000000) * temp(k) * temp(k)
    wp1(k) = cacm(k) - c
    wp2(k) = cacm(k) - ca(k)
    pwp(k) = wp1(k) / wp2(k)
    xpc1(k) = pwp(k) / pf
    xpc2(k) = (1 - pwp(k)) / pp
    xpc(k) = xpc1(k) / (xpc1(k) + xpc2(k))
   
   '''''''''''''''
    tempp(k + 1) = tem - ((k + 1) - 1) * cool * delt
    pwp(k + 1) = ((tempp(k + 1) - pp2(k)) / pp3) ^ pp4 '''''''''''''''
    bp(k + 1) = pp1 * Exp(-pwp(k + 1))
    ca(k + 1) = 0.04628 + (1.27515 / 100000) * temp(k + 1) - (1.695367 / 100000000) * temp(k + 1) * temp(k + 1)
    cacm(i + 1) = -0.29729 + (4.57757 / 10000) * temp(i + 1) + (1.37432 / 1000000) * temp(i + 1) * temp(i + 1)
    wp1(k + 1) = cacm(k + 1) - c
    wp2(k + 1) = cacm(k + 1) - ca(k + 1)
    pwp(k + 1) = wp1(k + 1) / wp2(k + 1)
    xpc1(k + 1) = pwp(k + 1) / pf
    xpc2(k + 1) = (1 - pwp(k + 1)) / pp
    xpc(k + 1) = xpc1(k + 1) / (xpc1(k + 1) + xpc2(k + 1))
    xpp(k) = ((1 - xpc(k)) / (1 - xpc(k + 1))) * xp(k)
    tp1(k) = Log(1 / (1 - (xpp(k))))
    tp(k) = ((tp1(k)) / bp(k + 1)) ^ (1 / np)
    deltxp(k) = xp(k) - xp(k - 1)
    sump(k) = deltxp(k) + sump(k - 1)

  Next k
    Text4.Text = Str(l)
    Text5.Text = Str(sump(k - 1))
    Text6.Text = Str(tempp(l))
    Text7.Text = Str(1 - sumf(j - 1) - sump(l - 1))
  
End Sub
Private Sub Command2_Click()
End
End Sub
---------------------------------------------------------------------------------------
以上就是程序
急切盼望哪位高手能看出程序中用的所有公式!!!!
若有高手请联系QQ:258145361

评分

参与人数 1热处理币 +5 收起 理由
wangqinghua196 + 5 感谢上传!

查看全部评分

签到天数: 1 天

[LV.1]初来乍到

发表于 2008-6-12 11:38:39 | 显示全部楼层

123

这个你到vb的论坛中去发一下,那里懂的人多一点。
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

QQ|Archiver|手机版|小黑屋|热处理论坛 ( 苏ICP备2021037530号|苏公网安备32059002001695号 )
Copyright © 2005-2024, rclbbs.com 苏州热协网络技术有限公司 版权所有

GMT+8, 2024-12-23 21:42 , Processed in 0.043048 second(s), 23 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表