I got a file that was handed down to me. It does a calculation and i think thats it.
In AR8, i have this equation
=DeltaOhms(S8,T8,U8,1)
In S8,T8,U8 i have 3 numbers that i go out and measure. They go A-B, B-C, C-A the 1 is the phase.
i have this function in the vba script. Can anyone dumb this down for me to a simple equation?? I tried to just do the phase 1 equation but it isnt just plug in numbers and get an answer, something else i think it going on. Any help would be great.
thanks
Also, if it helps inputs in
S,T,U are
The output in AR8 is
Function DeltaOhms(AtoB As Double, BtoC As Double, CtoA As Double, Phase As Double) As Variant 'add on function to convert terminal resistance to element resistance in a delta circuit
Dim A As Variant
Dim y As Variant
Dim x As Variant
ReDim y(1 To 3, 1 To 1) 'fill "y" array
y(1, 1) = AtoB
y(2, 1) = BtoC
y(3, 1) = CtoA
ReDim A(1 To 3, 1 To 3) 'fill "A" array
A(1, 1) = 1
A(2, 1) = 0
A(3, 1) = 1
A(1, 2) = 0
A(2, 2) = 1
A(3, 2) = 1
A(1, 3) = 1
A(2, 3) = 1
A(3, 3) = 0
x = WorksheetFunction.MMult(WorksheetFunction.MInverse(A), y) 'calculate intersections
'define outputs
A = x(1, 1)
B = x(2, 1)
C = x(3, 1)
'calculate result for selected element and divide by 2
If Phase = 1 Then DeltaOhms = ((A * B + A * C + B * C) / C) / 2
If Phase = 2 Then DeltaOhms = ((A * B + A * C + B * C) / A) / 2
If Phase = 3 Then DeltaOhms = ((A * B + A * C + B * C) / B) / 2
End Function
In AR8, i have this equation
=DeltaOhms(S8,T8,U8,1)
In S8,T8,U8 i have 3 numbers that i go out and measure. They go A-B, B-C, C-A the 1 is the phase.
i have this function in the vba script. Can anyone dumb this down for me to a simple equation?? I tried to just do the phase 1 equation but it isnt just plug in numbers and get an answer, something else i think it going on. Any help would be great.
thanks
Also, if it helps inputs in
S,T,U are
40.8mΩ | 41.7mΩ | 42.1mΩ |
32.0mΩ |
Function DeltaOhms(AtoB As Double, BtoC As Double, CtoA As Double, Phase As Double) As Variant 'add on function to convert terminal resistance to element resistance in a delta circuit
Dim A As Variant
Dim y As Variant
Dim x As Variant
ReDim y(1 To 3, 1 To 1) 'fill "y" array
y(1, 1) = AtoB
y(2, 1) = BtoC
y(3, 1) = CtoA
ReDim A(1 To 3, 1 To 3) 'fill "A" array
A(1, 1) = 1
A(2, 1) = 0
A(3, 1) = 1
A(1, 2) = 0
A(2, 2) = 1
A(3, 2) = 1
A(1, 3) = 1
A(2, 3) = 1
A(3, 3) = 0
x = WorksheetFunction.MMult(WorksheetFunction.MInverse(A), y) 'calculate intersections
'define outputs
A = x(1, 1)
B = x(2, 1)
C = x(3, 1)
'calculate result for selected element and divide by 2
If Phase = 1 Then DeltaOhms = ((A * B + A * C + B * C) / C) / 2
If Phase = 2 Then DeltaOhms = ((A * B + A * C + B * C) / A) / 2
If Phase = 3 Then DeltaOhms = ((A * B + A * C + B * C) / B) / 2
End Function