how do you guys do error checking on your rfxmeter readings ?
I have the following checks.
If the previuos reading was taken less than 10 seconds ago ignore reading
If the current reading is less than the previous reading AND the difference between the readings is more than 16000000 the meter has skipped over ( usage = 16777215-previous reading+current reading)
If the current reading is less than previous reading but not more than 16000000, error ignore
However these checks it seems are not enough, as 1 has cropped up twice the the last 2 days.
60000
60000
60000
.....80000
.....60002
..........60004
..........60004
Its the 80000 that confused the heck out of it, how would you catch this as an error ? ( the indents signify the different time 'batches' sent ) using the conditionals above my system would record the ones in bold.
Would one example be to not have the first conditional ( the time one ) capture all the readings in an array and choose the one that is closer and positive to the last recored reading ?
Or hows about the next one
60000
60000
60000
.....80000
..........60004
..........60004
This is the worst problem, I cannot even begin to understand how you'd catch this one.
So hows everyone else do this, or do you just keep an eye on it and manually alter any such mistakes.
Thanks
Error checking rfxmeter
Moderator: b_weijenberg
- b_weijenberg
- Forum Moderator
- Posts: 1746
- Joined: Sun May 14, 2006 4:32 pm
- Location: Netherlands
Re: error checking rfxmeter
Process the packets only if 2 identical packets with a correct parity are received.
If the current value is lower than the previous value and the current difference is less then the maximum difference between two reportings you probably have a counter roll over.
If the current value is lower than the previous value and the current difference is less then the maximum difference between two reportings you probably have a counter roll over.
Re: Error checking rfxmeter
sorry, bit dumb here, can you explain correct parity ?
- b_weijenberg
- Forum Moderator
- Posts: 1746
- Joined: Sun May 14, 2006 4:32 pm
- Location: Netherlands
Re: Error checking rfxmeter
Thanks Bert, I created an array of the 5 readings, if two are more of the same I record the reading.
- b_weijenberg
- Forum Moderator
- Posts: 1746
- Joined: Sun May 14, 2006 4:32 pm
- Location: Netherlands
Re: Error checking rfxmeter
Check also the parity. recbits contains the the first byte which is the packet length byte. recbuf(0) to recbuf(5) contains the RFXMeter data.
Code: Select all
Dim rfxmeter As Boolean = False
If recbits = 48 Then 'check if RFXMeter or RFXPower
parity = Not ((recbuf(0) >> 4) + (recbuf(0) And &HF) _
+ (recbuf(1) >> 4) + (recbuf(1) And &HF) _
+ (recbuf(2) >> 4) + (recbuf(2) And &HF) _
+ (recbuf(3) >> 4) + (recbuf(3) And &HF) _
+ (recbuf(4) >> 4) + (recbuf(4) And &HF) _
+ (recbuf(5) >> 4)) And &HF
If (parity = (recbuf(5) And &HF)) And (recbuf(0) + (recbuf(1) Xor &HF) = &HFF) Then
rfxmeter = True
End If
End If