Прошу перевести в VBA

Узнай цену своей работы

Формулировка задачи:

Очень нужна помощь, буду благодарен!

Решение задачи: «Прошу перевести в VBA»

textual
Листинг программы
Sub Насадки()
    Dim m As Single, lm As Single, l As Single, Xc As Single, Ypc As Single, ys As Single, ysp As Single, _
        xs As Single, de As Single, rog As Single, arg As Single, reg As Single, vg As Single, qv As Single, _
        dk As Single, h1 As Single, h As Single, dys As Single, Dy As Single, Yc As Single, S As Single, _
        N As Single, Xk As Single, G As Single, Ga As Single, _
        Gk As Single, Xkp As Single, ae As Single, mg As Single, gn As Single, p As Single, Yn1 As Single, _
        Xn1 As Single, Yk1 As Single, Ma As Single, Ml As Single, E1 As Single, S1 As Single, Rol As Single, _
        Vig As Single, Vil As Single, T As Single, Yn As Single, Yk As Single, Xn As Single, lam As Single, _
        uol As Single, pc As Single, V0 As Single, dp As Single, LB As Single, Fi As Single
 
    ' "ishodnie i spravochnie dannie"
 
    V0 = Val(Replace(InputBox("Rashod gaza Vc: ", "", 233), ",", ".")) '{m3/chas}
    p = Val(Replace(InputBox("Davlenie p: ", "", 3), ",", ".")) ' {MPa}
    Yn1 = Val(Replace(InputBox("Yn: ", "", 0.2), ",", ".")) ' {abs.molnie}
    Yk1 = Val(Replace(InputBox("Yk: ", "", 0.4), ",", ".")) ' {abs.molnie}
    Xn1 = Val(Replace(InputBox("Xn: ", "", 0.3), ",", ".")) ' {abs.molnie}
    Ma = Val(Replace(InputBox("Molek. massa abs-go componenta Ma: ", "", 45), ",", ".")) '(Ma)
    Ml = 18
    mg = 29
    ae = Val(Replace(InputBox("Konstanta Genri E: ", "", 0.39), ",", ".")) ' {MPa}
    E1 = Val(Replace(InputBox("Poroznost` nasadki e1: ", "", 22), ",", ".")) '{m3/m3}
    S1 = Val(Replace(InputBox("Udel`nay poverhnost` nasadki s1: ", "", 5), ",", ".")) ' {m2/m3}
    Rol = 1000
    Vig = Val(Replace(InputBox("Vyzkost` vozduha Vig: ", "", 55), ",", "."))
    Vil = Val(Replace(InputBox("Vyzkost` vodi Vil: ", "", 43), ",", "."))
    T = Val(Replace(InputBox("Temperatura absorbcii T: ", "", 37), ",", ".")) ' {^C}
    Fi = Val(Replace(InputBox("Koefficient izbitka oroweniy Fi: ", "", 0.3), ",", ".")) '(Fi)
 
    de = 4 * E1 / S1
    Yn = Ma * Yn1 / (mg * (1 - Yn1)) ' {Otnos. massovie}
    Yk = Ma * Yk1 / (mg * (1 - Yk1)) ' {%}
    Xn = Ma * Xn1 / (Ml * (1 - Xn1))
    gn = V0 * 1.293 * (1 - Yn1) + V0 * 1.98 * Yn1
    G = V0 * 1.293 * (1 - Yn1)
    Ga = G * (Yn - Yk) '{kg/hr}
    Gk = gn - Ga
    m = ae / p
    Xkp = Ma * mg * Yn / (Ml * m * Ma + m * mg * Ml * Yn - Yn * mg * Ml)
    lm = G * (Yn - Yk) / (Xkp - Xn)
    l = Fi * lm
    Xk = Xn + G * (Yn - Yk) / l
    Debug.Print
    Debug.Print " Raschetnie parametri "
    Debug.Print
    Debug.Print " yn= " & Yn, " yk= " & Yk, " xn= " & Xn, " xk= " & Xk
    Debug.Print " g= " & G, " ga= " & Ga, " lm= " & lm
    Debug.Print " l= " & l, " xkp= " & Xkp, " m= " & m
    Debug.Print
    N = 50
    Dy = (Yn - Yk) / N
    Yc = Yk + (Dy / 2)
    S = 0
    Do
         Xc = Xn + G * (Yc - Yk) / l
         Ypc = m * Ml * Ma * Xc / (mg * (Ml * Xc + Ma - m * Ml * Xc))
         S = S + Dy / (Yc - Ypc)
         Yc = Yc + Dy
    Loop Until Yc > Yn
    dys = (Yn - Yk) / S
    ys = (Yn + Yk) / 2
    ysp = ys - dys
    xs = Ma * mg * ysp / (Ml * (m * Ma + mg * (m - 1) * ysp))
    rog = 1.293 * p * 273 / (0.1033 * (273# + T))
    vg = Sqr((9.81 * Rol * E1 * E1 * E1 / (S1 * rog)) * Exp(-0.16 * Log(Vil) + 0.0507 - 4.03 * Exp(0.25 * Log(l / G) + 0.125 * Log(rog / Rol))))
    vg = vg * 0.8
    qv = V0 * (273# + T) * 0.1033 / (3600# * 273# * p) '{m^3/s}
    dk = Sqr(4 * qv / (3.14 * vg))
    h1 = 44.3 * E1 * (Log(l / (m * G)) / Log(10)) * Exp(0.2 * Log(vg * rog) + 0.342 * Log(G / l) + 0.19 * Log(Rol / rog) + _
         0.038 * Log(Vig / Vil)) / (Exp(0.2 * Log(Vig) + 1.2 * Log(S1)) * (1 - m * G / l))
    h = h1 * S
    reg = vg * de * rog / (E1 * Vig)
    If reg > 40 Then lam = 16 / Exp(0.2 * Log(reg)) Else lam = 140# / reg
    uol = l / (Rol * 0.785 * dk * dk * 3600#)
    pc = lam * h * vg * vg * rog / (de * 2 * E1 * E1)
    dp = pc * Exp(169# * uol) / Log(10)
    Debug.Print " s = " & S
    Debug.Print " dys = " & dys
    Debug.Print " ys = " & ys
    Debug.Print " ysp = " & ysp
    Debug.Print " xs = " & xs
    Debug.Print " vg = " & vg
    Debug.Print " dk = " & dk
    Debug.Print " h1 = " & h1
    Debug.Print " h = " & h
    Debug.Print " pc = " & pc
    Debug.Print " uol = " & uol
    Debug.Print " dp = " & dp
End Sub

ИИ поможет Вам:


  • решить любую задачу по программированию
  • объяснить код
  • расставить комментарии в коде
  • и т.д
Попробуйте бесплатно

Оцени полезность:

14   голосов , оценка 4.357 из 5