You are on page 1of 3

Option Explicit

Option Base 1
Function TAW_px(ByVal p As Single, ByVal x As Single) As Double
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' Set up Variables...
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Dim i As Integer
Dim m() As Single
' Dim n() As Single
Dim a() As Double
m(1) = 0
m(2) = 0
m(3) = 0
m(4) = 0
m(5) = 0
m(6) = 1
m(7) = 1
m(8) = 1
m(9) = 2
m(10) = 4
m(11) = 5
m(12) = 5
m(13) = 6
m(14) = 13
' m = Array(0, 0, 0, 0, 0, 1, 1, 1, 2, 4, 5, 5, 6, 13)
' n = Array(0, 1, 2, 3, 4, 0, 1, 2, 3, 0, 0, 1, 0, 1)
= Array(3.22302, -0.384206, 0.0460965, -0.00378945, 0.00013561, 0.487755, 0.120108, 0.0106154, -0.000533589, 7.85041, -11.5941, -0.0523589, 48.9596,
0.0421059)

n(1) = 0
n(2) = 1
n(3) = 2
n(4) = 3
n(5) = 4

n(6) = 0
n(7) = 1
n(8) = 2
n(9) = 3
n(10) = 0
n(11) = 0
n(12) = 1
n(13) = 0
n(14) = 1
a(1) = 3.22302
a(2) = -0.384206
a(3) = 0.0460965
a(4) = -0.00378945
a(5) = 0.00013561
a(6) = 0.487755
a(7) = -0.120108
a(8) = 0.0106154
a(9) = -0.000533589
a(10) = 7.85041
a(11) = -11.5941
a(12) = -0.0523589
a(13) = 4.89596
a(14) = 0.0421059
' p = p * 0.006894757293
' T0 = 100#
' p0 = 2#
TAW_px = 0#
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' Calculation...
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
For i = 1 To 14
TAW_px = TAW_px + a(i) * ((1 - x) ^ m(i))
'

* (Application.WorksheetFunction.Ln(p0 / p) ^ A(i))
Next i

' TAW_px = T0 * TAW_px


' TAW_px = (TAW_px - 273.1) * 1.8 + 32#

End Function
Function MultiplyEm(a, B)
MultiplyEm = a * B
End Function

Function T_px(p, x)
Dim m() As Single
m = Array(0, 0, 0, 0, 0, 1, 1, 1, 2, 4, 5, 5, 6, 13)
T_px = 0#
For i = 1 To 14
T_px = T_px + ((1 - x) ^ m(i))
Next i
End Function

You might also like