DOC

# VB

By Ralph Butler,2014-09-23 13:45
8 views 0
VB

Option Explicit

Dim n As Integer, i As Integer, j As Integer

Private Sub Command1_Click()

'第一步

Dim x0 As Single, xn As Single, T0 As Single, Tk As Single, F0 As Single, tt As Single, c0 As Single

n = Text1.Text

x0 = Text3.Text

xn = Text4.Text

T0 = Text5.Text

Tk = Text6.Text

F0 = Text7.Text / 3600

tt = Text8.Text

c0 = 3613

'第二步

ReDim α(1 To n) As Single, β(1 To n) As Single, r(1 To n) As Double, ω(1 To n) As Single

For i = 1 To n

α(i) = 0.99

r(i) = 2250000

Next i

For i = 1 To n

β(i) = InputBox("输入βi)", , "")

Next i

For i = 1 To n - 1

ω(i) = 1.5 * 10 ^ -5

Next i

'第三步

Dim Ws As Single

Ws = F0 * (1 - (x0 / xn))

'第四步

Dim c As Single

c = T0 - Tk 3

Do

'第六步 输入ηi)

ReDim η(1 To n) As Single

For i = 1 To n

η(i) = 0.98

Next i

'第七步 矩阵

ReDim M(1 To 2 * n, 1 To 2 * n + 1) As Single

M(1, 1) = α(1) * η(1)

M(n + 1, 2 * n + 1) = Ws

'定义 A1

For i = 1 To n '输出-1

M(i, i + 1) = -1

Next i

For i = 2 To n '输出对角线 M(i, i) = α(i) * η(i) - 4187 * β(i) * η(i)

Next i

For i = 3 To n '输出-4187*βi)*ηi)

For j = 2 To i - 1

M(i, j) = -4187 * β(i) * η(i)

Next j

Next i

For j = 2 To n + 1 '输出 1

M(n + 1, j) = 1

Next j

'定义 A3

For i = 2 To n '对角线

M(i, i + n) = α(i) * η(i)

Next i

'定义 C1

For i = 1 To n

M(i, 2 * n + 1) = -F0 * c0 * β(i) * η(i)

Next i

'定义 A2

For i = 1 To n - 1

For j = 1 To n - 1

If i >= j Then M(i + n + 1, j) = 4187 * ω(i)

Next j

Next i

'定义 A4

For i = 1 To n - 1

M(i + n + 1, i + n + 1) = -1

Next i

'第八步 高斯约旦

Dim p As Integer, q As Integer

For i = 1 To 2 * n

For j = 2 * n + 1 To 1 Step -1

If M(i, j) <> 0 Then M(i, j) = M(i, j) / M(i, i)

Next j

For p = i + 1 To 2 * n

For q = 2 * n + 1 To i Step -1

M(p, q) = M(p, q) - M(p, i) * M(i, q)

Next q

Next p

Next i

For i = 2 * n To 1 Step -1

For p = i - 1 To 1 Step -1

For q = 2 * n + 1 To 1 Step -1

M(p, q) = M(p, q) - M(p, i) * M(i, q)

Next q

Next p

Next i

'输出D1 Wi) Gi)

ReDim D(1 To n) As Single, W(1 To n) As Single, G(1 To n) As Single, x(1 To n) As Single

D(1) = M(1, 2 * n + 1)

For i = 1 To n

W(i) = M(i + 1, 2 * n + 1)

Next i

For i = 1 To n - 1

G(i) = M(i + n + 1, 2 * n + 1)

Next i

'第九步 输出 Di

For i = 2 To n

D(i) = W(i - 1) + G(i - 1)

Next i

'第十步 输出 xi)

ReDim x(1 To n) As Single

Dim yy As Single

yy = 0

For i = 1 To n - 1

yy = yy + W(i)

x(i) = F0 * x0 / (F0 - yy)

Next i

x(n) = xn

'第十一步 输出 Δti(i)

ReDim Δti(1 To n) As Single, k(1 To n) As Single

k(1) = "736"

k(2) = "633"

k(3) = "550"

Dim ΣDrK As Single

ΣDrK = 0

For i = 1 To n

ΣDrK = ΣDrK + D(i) * r(i) / k(i)

Next i

For i = 1 To n

Δti(i) = (D(i) * r(i) / k(i)) * c / ΣDrK

Next i

'第十二步 输出 Δ1i(i) Δ2i(i) Δ3i(i) ReDim Δ1i(1 To n) As Single, Δ2i(1 To n) As Single, Δ3i(1 To n) As Single

For i = 1 To n

Δ1i(i) = 1.78 * x(i) + 6.22 * x(i) ^ 2

Δ1i(n) = 1.78 * xn + 6.22 * xn ^ 2

Δ2i(i) = 0

Δ3i(i) = 1

Next i

'第十三步 t溶；第i效溶液的沸点？ T饱；i) ；第i效二次蒸汽的饱和温度？

ReDim T(1 To n) As Single, t(1 To n) As Single

T(n) = Tk + 1

For i = n To 2 Step -1

t(i) = T(i) + Δ1i(i) + Δ2i(i)

T(i - 1) = t(i) + Δti(i) + Δ3i(i - 1)

Next i

t(1) = T(1) + Δ1i(1) + Δ2i(1)

'第十四步 输出 Hi)

ReDim H(0 To n) As Double

H(0) = 2474771 + 2410.2 * T0 - 3.83 * T0 ^ 2

For i = 1 To n

H(i) = 2474771 + 2410.2 * T(i) - 3.83 * T(i) ^ 2

Next i

α(1) = (H(0) - 4187 * T0) / (H(1) - 4187 * t(1))

β(1) = (tt - t(1)) / (H(1) - 4187 * t(1))

r(1) = 2466904.92 - 1584.27 * T0 - 4.93 * T0 ^ 2

For i = 2 To n

α(i) = (H(i - 1) - 4187 * T(i - 1)) / (H(i) - 4187 * t(i))

β(i) = (t(i - 1) - t(i)) / (H(i) - 4187 * t(i))

r(i) = 2466904.92 - 1584.27 * T(i - 1) - 4.93 * T(i - 1) ^ 2

Next i

ω(1) = (T0 - T(1)) / (H(1) - 4187 * T(1))

For i = 2 To n - 1

ω(i) = (T(i - 1) - T(i)) / (H(i) - 4187 * T(i))

Next i

'输出 c ；多效蒸发系统总的有效传热温差？

Dim zz As Single

zz = 0

For i = 1 To n

zz = zz + (Δ1i(i) + Δ2i(i) + Δ3i(i))

Next i

For i = 1 To n

c = T0 - Tk - zz

Next i

'输出 Ai) ；第i效蒸发器的传热面积？

ReDim Ai(1 To n) As Single

For i = 1 To n

Ai(i) = (D(i) * r(i)) / (k(i) * Δti(i))

Next i

Dim Amax As Single, Amin As Single

Amax = Ai(1)

Amin = Ai(1)

For i = 1 To n

If Ai(i) > Amax Then Amax = Ai(i)

If Ai(i) < Amin Then Amin = Ai(i)

Next i

Loop Until (Amax - Amin) <= 10 ^ -5

'输出 J1 ；系统的年生蒸汽费用？

Dim J1 As Single, θ As Single

θ = 7200

J1 = 3600 * θ * D(1) * (0.018 + 1.46 * 10 ^ (-4) * T0)

'输出J2 ；蒸发器年折旧及维修费用？

Dim J2 As Single, aa As Single, hi As Single

For i = 1 To n

If Ai(i) <= 100 Then hi = 1

ElseIf Ai(i) <= 200 Then hi = 1.2

ElseIf Ai(i) <= 400 Then hi = 1.5

End If

Next i

aa = 0

For i = 1 To n

aa = aa + ((4400 + (40000 - 620)) * 1.2 * (0.667 + 0.0287 * Ai(i)) * hi)

Next i

J2 = 0.15 * aa

'输出Vi) ；第i效冷凝水闪蒸汽体积？ J3 ；冷凝水闪蒸汽年折旧及维修费用？ ReDim V(1 To n - 1) As Single

Dim dk As Single, gk As Single, J3 As Single

J3 = 0

For i = 1 To n - 1

dk = 0

gk = 0

For j = 1 To i

dk = dk + D(j)

Next j

For j = 1 To i - 1

gk = gk + G(j)

Next j

V(i) = 2 * (dk - gk) * 300 / 1000

J3 = J3 + (0.15 * 645 * (V(i) ^ 0.54) * 1 * 1.3)

Next i

'输出Vw ；水量m3/s

Dim Vw As Double, rk As Single

rk = 2466904.92 - 1584.27 * Tk - 4.93 * Tk ^ 2

Vw = (W(n) * (rk + 4187 * 5) / (4187 * (Tk - 5 - 25))) / 1000

'输出J4 ；真空系统费用？

Dim J4 As Single

J4 = 1.1 * 0.5 * 7200 * (21 + 1450 * Vw ^ 2) * Vw * 1000 / (102 * 0.6)

'输出 J ；系统的年总费用？

Dim J As Single

J = J1 + J2 + J3 + J4

Picture1.Print ""

Picture1.Print "生蒸汽流量；?/s？？D1="; Format(D(1), "0.#######")

Picture1.Print ""

Picture1.Print "蒸发器面积；?？？"

For i = 1 To n

Picture1.Print Format(Ai(i), "0.#######")

Next i

Picture1.Print ""

Picture1.Print "溶液沸点；?？？"

For i = 1 To n

Picture1.Print Format(t(i), "0.#######")

Next i

Picture1.Print ""

Picture1.Print "二次蒸汽的饱和温度；?？？"

For i = 1 To n

Picture1.Print Format(T(i), "0.#######")

Next i

Picture1.Print ""

Picture1.Print "完成液浓度；?/?)"

For i = 1 To n - 1

Picture1.Print Format(x(i), "0.#######")

Next i

Picture1.Print Format(x(n), "0.#######")

Picture1.Print ""

Picture1.Print "蒸发量；?/s):"

For i = 1 To n

Picture1.Print Format(W(i), "0.#######")

Next i

Picture1.Print ""

Picture1.Print "闪蒸汽蒸发量；?/s):"

For i = 1 To n - 1

Picture1.Print Format(G(i), "0.#######")

Next

Picture1.Print ""

Picture1.Print "生蒸汽费用；元/):J1="; Format(J1, "0.#######")

Picture1.Print ""

Picture1.Print "蒸发器折旧维修费用 (/):J2="; Format(J2, "0.#######")

Picture1.Print ""

Picture1.Print "闪蒸罐折旧维修费用；元/):J3="; Format(J3, "0.#######")

Picture1.Print ""

Picture1.Print "真空系统费用；元/):J4="; Format(J4, "0.#######")

Picture1.Print ""

Picture1.Print "年总费用；元/):J="; Format(J, "0.#######")

End Sub

Private Sub Command2_Click()

Text1.Text = ""

Text3.Text = ""

Text4.Text = ""

Text5.Text = ""

Text6.Text = ""

Text7.Text = ""

Text8.Text = ""

Text1.SetFocus

Picture1.Cls

End Sub

Report this document

For any questions or suggestions please email
cust-service@docsford.com