Ralpha--
I've been looking at your VB code and some of the other viscosity calculators out there. This morning I started writing my own version in R.
I have a couple of questions about the code you posted:
1) There's a comment in your code about calculating viscosity differently for cs values <2. It looks like it's not just a different constant, but a significantly different formula ... care to comment?
Code:
dVis = dVis - Exp((-0.7487 - 3.295 * dVis) + 0.6119 * dPt7Sq - 0.3193 * dPt7Cube)
2) I notice in a few places you use the EXP function, which calculates
e raised to a power. This strikes me as odd because all of the logs are base 10. Is this an error or is this what you actually intended? Here are a couple of examples:
Code:
If dVis < 2# Then
dCval = Exp(-1.14883 - 2.65868 * dVis)
End If
If dVis < 1.65 Then
dDval = Exp(-0.0038138 - 12.5645 * dVis)
End If
...
dZval = dVis + 0.7 + dCval - dDval + dEval - dFval + dGval - dHval
astm_d341_vm = Log10(Log10(dZval))