# Macros: Reference Uncertainty By Range in COMPASS for Pressure

This macro enables you to ignore the uncertainty values that you have entered for your references (support devices and/or piston gauges) in COMPASS for Pressure. This macro allows you to specify your reference uncertainty (in % Reading and/or % Span) according to ranges of pressures. This correlates to having different standards for different ranges of pressures.

See the below Word document for formatted text to copy -> paste into a macro.

Here is the non-formatted text.

'Alternate Reference Uncertainty Calculation/Determination - by Pressure Range
'converting RefP to kPa for range check

RefP_kPa = cCOMPASS.UnitConversion(CDbl(RefP), 3, CInt(dUnit), 0)
cDebug.LogStatus "RefP_kPa = " & RefP_kPa

'range specific coefs for calculation of reference uncertainty
Delta = 0
If RefP_kPa >= 7000 Then 'kPa, A20Ms
PctRdg = 0.01/100
ElseIf RefP_kPa >= 3500 Then 'A7Ms
PctRdg = 0.01/100
ElseIf RefP_kPa >= 700 Then 'A3.5Ms
PctRdg = 0.01/100
ElseIf RefP_kPa >= 200 Then 'A700K
PctRdg = 0.01/100
ElseIf RefP_kPa >=60 Then 'A200K
PctRdg = 0.01/100
Else
PctRdg = 0.0 'A200K
Delta = 21 'Threshold Unc.
End If
cDebug.LogStatus "PctRdg = " & PctRdg
cDebug.LogStatus "Delta = " & Delta & " " & "kPa"

'converting Delta to test unit
Delta = cCOMPASS.UnitConversion(CDbl(Delta), CInt(dUnit),1, 0)
cDebug.LogStatus "Delta = " & Delta & " " & dUnit
URef = (RefP*PctRdg) + Delta
cDebug.LogStatus "Reference Tolerance (alt) = " & Uref