When I insert the function pv() it returns an errorr message "You've entered too many arguments for this function." But I haven't called out too many arguments. Even worse is that I can call out functions pm(), pq() or pd() which are all similar but work! Here is the code for these functions:
Option Explicit
Public support As String, length As Double, gamma As Double, x As Double, P As Double, phi As Double, xg As Double, xf As Double, fg As Double, gf As Double, Cp_0 As Double, Cp_1 As Double, Cp_2 As Double, Cp_3 As Double, Cp_4 As Double
Function pv(support, length, gamma, P, phi, x)
'Step Function Variables
xg = 0: xf = 0: gf = 0: fg = 0
If x > gamma Then
xg = 1
End If
If x > phi Then
xf = 1
End If
If gamma > phi Then
gf = gamma - phi
End If
If phi > gamma Then
fg = phi - gamma
End If
'Set Constants Of Integration
Cp_0 = 0: Cp_1 = 0: Cp_2 = 0
If support = "Pin-Pin-Free" Then
Cp_0 = (gf - fg - gamma) / gamma
Cp_1 = -1 - Cp_0
End If
'Calculate Shear
pv = -P * (xf + Cp_0 * xg + Cp_1)
End Function
Function pm(support, length, gamma, P, phi, x)
'Step Function Variables
xg = 0: xf = 0: gf = 0: fg = 0
If x > gamma Then
xg = x - gamma
End If
If x > phi Then
xf = x - phi
End If
If gamma > phi Then
gf = gamma - phi
End If
If phi > gamma Then
fg = phi - gamma
End If
'Set Constants Of Integration
Cp_0 = 0: Cp_1 = 0: Cp_2 = 0
If support = "Pin-Pin-Free" Then
Cp_0 = (gf - fg - gamma) / gamma
Cp_1 = -1 - Cp_0
End If
'Calculate Moment
pm = -P * (xf + Cp_0 * xg + Cp_1 * x + Cp_2)
End Function
Function pq(E, I, support, length, gamma, P, phi, x)
'Step Function Variables
xg = 0: xf = 0: gf = 0: fg = 0
If x > gamma Then
xg = x - gamma
End If
If x > phi Then
xf = x - phi
End If
If gamma > phi Then
gf = gamma - phi
End If
If phi > gamma Then
fg = phi - gamma
End If
'Set Constants Of Integration
Cp_0 = 0: Cp_1 = 0: Cp_2 = 0: Cp_3 = 0
If support = "Pin-Pin-Free" Then
Cp_0 = (gf - fg - gamma) / gamma
Cp_1 = -1 - Cp_0
Cp_3 = -(gf ^ 3 + Cp_1 * gamma ^ 3) / 6 / gamma
End If
'Calculate Slope
pq = -P / E / I * ((xf ^ 2 + Cp_0 * xg ^ 2 + Cp_1 * x ^ 2) / 2 + Cp_2 * x + Cp_3)
End Function
Function pd(E, I, support, length, gamma, P, phi, x)
'Step Function Variables
xg = 0: xf = 0: gf = 0: fg = 0
If x > gamma Then
xg = x - gamma
End If
If x > phi Then
xf = x - phi
End If
If gamma > phi Then
gf = gamma - phi
End If
If phi > gamma Then
fg = phi - gamma
End If
'Set Constants Of Integration
Cp_0 = 0: Cp_1 = 0: Cp_2 = 0: Cp_3 = 0: Cp_4 = 0
If support = "Pin-Pin-Free" Then
Cp_0 = (gf - fg - gamma) / gamma
Cp_1 = -1 - Cp_0
Cp_3 = -(gf ^ 3 + Cp_1 * gamma ^ 3) / 6 / gamma
End If
'Calculate Deflection
pd = -P / E / I * ((xf ^ 3 + Cp_0 * xg ^ 3 + Cp_1 * x ^ 3) / 6 + Cp_2 * x ^ 2 / 2 + Cp_3 * x + Cp_4)
End Function
Any ideas?
Thanks in advance.
Option Explicit
Public support As String, length As Double, gamma As Double, x As Double, P As Double, phi As Double, xg As Double, xf As Double, fg As Double, gf As Double, Cp_0 As Double, Cp_1 As Double, Cp_2 As Double, Cp_3 As Double, Cp_4 As Double
Function pv(support, length, gamma, P, phi, x)
'Step Function Variables
xg = 0: xf = 0: gf = 0: fg = 0
If x > gamma Then
xg = 1
End If
If x > phi Then
xf = 1
End If
If gamma > phi Then
gf = gamma - phi
End If
If phi > gamma Then
fg = phi - gamma
End If
'Set Constants Of Integration
Cp_0 = 0: Cp_1 = 0: Cp_2 = 0
If support = "Pin-Pin-Free" Then
Cp_0 = (gf - fg - gamma) / gamma
Cp_1 = -1 - Cp_0
End If
'Calculate Shear
pv = -P * (xf + Cp_0 * xg + Cp_1)
End Function
Function pm(support, length, gamma, P, phi, x)
'Step Function Variables
xg = 0: xf = 0: gf = 0: fg = 0
If x > gamma Then
xg = x - gamma
End If
If x > phi Then
xf = x - phi
End If
If gamma > phi Then
gf = gamma - phi
End If
If phi > gamma Then
fg = phi - gamma
End If
'Set Constants Of Integration
Cp_0 = 0: Cp_1 = 0: Cp_2 = 0
If support = "Pin-Pin-Free" Then
Cp_0 = (gf - fg - gamma) / gamma
Cp_1 = -1 - Cp_0
End If
'Calculate Moment
pm = -P * (xf + Cp_0 * xg + Cp_1 * x + Cp_2)
End Function
Function pq(E, I, support, length, gamma, P, phi, x)
'Step Function Variables
xg = 0: xf = 0: gf = 0: fg = 0
If x > gamma Then
xg = x - gamma
End If
If x > phi Then
xf = x - phi
End If
If gamma > phi Then
gf = gamma - phi
End If
If phi > gamma Then
fg = phi - gamma
End If
'Set Constants Of Integration
Cp_0 = 0: Cp_1 = 0: Cp_2 = 0: Cp_3 = 0
If support = "Pin-Pin-Free" Then
Cp_0 = (gf - fg - gamma) / gamma
Cp_1 = -1 - Cp_0
Cp_3 = -(gf ^ 3 + Cp_1 * gamma ^ 3) / 6 / gamma
End If
'Calculate Slope
pq = -P / E / I * ((xf ^ 2 + Cp_0 * xg ^ 2 + Cp_1 * x ^ 2) / 2 + Cp_2 * x + Cp_3)
End Function
Function pd(E, I, support, length, gamma, P, phi, x)
'Step Function Variables
xg = 0: xf = 0: gf = 0: fg = 0
If x > gamma Then
xg = x - gamma
End If
If x > phi Then
xf = x - phi
End If
If gamma > phi Then
gf = gamma - phi
End If
If phi > gamma Then
fg = phi - gamma
End If
'Set Constants Of Integration
Cp_0 = 0: Cp_1 = 0: Cp_2 = 0: Cp_3 = 0: Cp_4 = 0
If support = "Pin-Pin-Free" Then
Cp_0 = (gf - fg - gamma) / gamma
Cp_1 = -1 - Cp_0
Cp_3 = -(gf ^ 3 + Cp_1 * gamma ^ 3) / 6 / gamma
End If
'Calculate Deflection
pd = -P / E / I * ((xf ^ 3 + Cp_0 * xg ^ 3 + Cp_1 * x ^ 3) / 6 + Cp_2 * x ^ 2 / 2 + Cp_3 * x + Cp_4)
End Function
Any ideas?
Thanks in advance.