You are currently reviewing an older revision of this page.
What is the tolerance used for evaluating Queries and Alerts? For example when using a query or an alert on pipes with calculated flow = 0, if the calculated flow is slightly different than zero (for example 0.000005 gpm), will the query or alert find this pipe?
There is a difference between the tolerance used with Alerts and Queries. Both incorporate a mechanism to account for slight "fuzziness" in the results (so there doesn't need to be an exact match), but the implementation is different.
Alerts currently use a fixed tolerance of 0.001, applied to the respective storage unit (gpm for flow, psi for pressure, ft for level and HGL - these are regardless of the "display" unit you have set) Meaning, if the difference between the Alert value and the model value are less than 0.001, the Alert will still trigger.
For example if a pipe has a flow of 0.000000000000001 gpm, an Alert on Flow = 0 will retrieve the pipe. If the flow is 0.0005 gpm, the Alert on Flow = 0 will still trigger. However if the flow is 0.005 gpm, the Alert will not trigger, since the difference between 0 and 0.005 is greater than the tolerance of 0.001 gpm.
Note: this tolerance with Alerts is always evaluated on the flow in units of gallons per minute (gpm). So, if you’re using units such as L/s, this is internally converted to gpm first before checking the 0.001 tolerance.
Queries incorporate a 0.000001 constant to create the "buffer" zone around the query value. Like with the "tolerance" of 0.001 with Alerts, this allows queries to retrieve elements that are very slightly different from the query value.
For example, say you have the following query: Flow = 0.000510267000001 gpm
The built-in "floating point fuzz" that's added means that the query will actually retrieve any pipe that is between these two values:
0.000510267000001 * (1 - 0.000001) = 0.000510266489733999999 gpm
And...
0.000510267000001 * (1 + 0.000001)= 0.000510267510268000001 gpm
So for example a pipe with flow of 0.000510267156642 gpm will be retrieved by this query.
Given the above, it is recommended that you use less than or greater than instead of equals for queries. For example if you’re looking to find pipes with zero flow, your query might be something like Flow < 0.01 gpm