I'm trying to configure my Fortrezz Water Flow Meter and I'm seeing an odd behavior that I'm struggling to understand.
First I tried to use the community driver mentioned here, very kindly provided by @tsuthar
And I found that it was not reporting the correct GPM. The driver was reporting a GPM of 6.6gpm while the actual flow rate was 11.25GPM. (I calculated the 11.25 by taking a video of the dials with my phone and using the video to calculate the exact number of seconds it took to deliver a specific number of gallons and did the math)
I also know that my well pump, based on it's performance curves, has an expected GPM rate at it's specific depth and my water pressure (400 ft deep and 50 PSI) of 11.4 GPM.
So I'm quite sure the 6.6gpm being reported by the driver here is wrong. It's off by a factor of almost (But not quite) 2 (or roughly half).
So I switched to using the official Fortrezz Driver and just ported it myself. Now the "official" driver gives me a result of 1.1 GPM. .. Why would the community driver report 6.6, and the official driver report 1.1? The community driver is exactly 6x higher than the official driver. Let's look at the code:
The official driver uses this calculation to determine GPM:
def delta = cmd.scaledMeterValue - cmd.scaledPreviousMeterValue
while the community driver does this:
def delta = Math.round((((cmd.scaledMeterValue - cmd.scaledPreviousMeterValue) / (reportThreshhold*10)) * 60)*100)/100 //rounds to 2 decimal positions
So the community driver has this added variable (reportThreshhold
) involved which comes from an input parameter on the driver configuration:
//Nothing changes this value on the device yet. Set to 1
input "reportThreshhold", "decimal", title: "Reporting Rate Threshhold", description: "The time interval between meter reports while water is flowing. 6 = 60 seconds, 1 = 10 seconds. Options are 1, 2, 3, 4, 5, or 6.", defaultValue: 1, required: false, displayDuringSetup: true
A couple things I thought were strange here: The comment above the input line suggests that changing this value doesn't change anything on the device. If that's the case I'm not sure why this parameter is here? Do some Flow Meters report on different intervals by default?
The comment also suggests that you should leave this set to "1". But I also noticed that my flow meter actually issues reports every 60 seconds. So it seems like the "correct" value for my flow meter would be "6".
When I set it to 6 I now get the same 1.1 GPM that the official driver gives me. So at least now both drivers agree (Even though both are still wrong.)
However: Now both drivers are wrong by a factor of almost exactly 10. They are reporting 1.1 GPM when the actual flow is 11 GPM. And now it's starting to make sense: Fortrezz offers flow meters in different sizes. This particular flow meter is the 1.5 inch version. (Most people are proably using the 3/4 or 1 inch versions). I'm using the 1.5 inch version because this is attached directly to my well head and the piping from my water well is 1.5 inches to support the flow rates needed to run irrigation, my house, a barn, etc. (I live on 5 acres)
The smaller Flow Meters send a pulse for every 0.1gal, but the larger flow meter only sends a pulse for every full 1gal. So somehow the scaling needs to be set correctly for the larger meter.
So I added this debug logging where it does the calculation:
log.debug(cmd)
def delta = cmd.scaledMeterValue - cmd.scaledPreviousMeterValue
log.debug "delta(${delta}) = cmd.scaledMeterValue(${cmd.scaledMeterValue}) - cmd.scaledPreviousMeterValue(${cmd.scaledPreviousMeterValue})"
Which results in log output that looks like:
delta(1.1) = cmd.scaledMeterValue(48.3) - cmd.scaledPreviousMeterValue(47.2)
MeterReport(scale: 2, rateType: 1, scale2: 0, deltaTime: 60, previousMeterValue: [0, 0, 1, 216], meterType: 3, precision: 1, size: 4, meterValue: [0, 0, 1, 227])
So here it gets more interesting:
Remember the code is doing it's calculation like so:
def delta = cmd.scaledMeterValue - cmd.scaledPreviousMeterValue
Notice it uses cmd.scaledMeterValue
and cmd.scaledPreviousMeterValue
But in the log output: There is no cmd.scaledMeterValue
or cmd.scaledPreviousMeterValue
. There is only: previousMeterValue
and meterValue
: IE: Without scaled
being prepended.
I notice that if you use the non-scaled values: previousMeterValue
is 216, and meterValue
is 227. The difference between those is 11, which is the correct GPM. So somehow the scaled
values are 1/10th.
So all of this was basically provided to give context around these questions:
- So where does this
scaled
value come from? - How do I change the scale?
- Why don't the scaled values show up when I do
log.debug(cmd)
?
I realize I could just modify the driver code to multiply delta by 10, but I wanted to understand the why/how of this before making changes to the driver.
Thanks in advance.
-Jeremy