AC Diversion Load: Data Cleanup

1 year ago
20

Following on from adding the "Watchdog Timer" feature to the AC diversion load program, I found more data quality issues that were causing problems in the code. The video is long, but all these issues all are related.

Timeline:
0:05 Introduction
2:45 Damping feature in action
4:34 PLEG Trigger
5:09 PLEG Interval Timers
6:51 PLEG Device Properties
8:13 PLEG Condition Logic Cleanup
9:20 Energy Meter Quality and Sanity checks
10:08 Reconstructing missing data
11:57 Self Re-Trigger Timers
14:20 Adding data protection to the code

This took some time to identify and correct these issues. Reason being you find an issue and make a preliminary code change, maybe just adding a conditional expression to compute an intermediate result. Then you need to let that run for some time until the issue repeats and see what the result of the code change was. Then make some changes and incorporate that into the code and let it run again for some days or weeks. Each cycle lets you gain more insight into the cause of the issue. Also, in some cases, I had code added from the initial development last year, where I had attempted to work around some of the issues I saw but didn't fully understand at the time. So that code had to back backed out before moving forward with the new changes.

The basic idea is to detect when the reported power data is older than the designed reporting interval. This is done by taking advantage of the Program Logic Event Generator (PLEG) time stamp information in the device property that records the power data.

The logic is that if either of the 2 diversion load interval times (Clamp1Check or Clamp2Check) have run and expired, then check the "age" of the power data and if it's older than the reporting interval, request new data from the power meter.

I extended the above data "age" checks to the Line1 and Line2 power readings as well. I've seen all 8 possible combinations of the 3 pieces of data being present or missing.

Initially, I just requested new power data from the energy meter. However, sometimes that didn't result in fresh data, so then I had the code stop updating the diversion load when only partial data was present. This was needed because the code assumes that if a change in the light dimmer setting is made, the next power reading will reflect the result of that change.

The problem arises if the power data isn't updated. Let's say the code determined that the light dimmer/load needed to increase by 100 watts. That change is made, then 15 secs. later, it will make the same calculation and determine the load needs to increase by 100 watts. Rinse and repeat and all of a sudden, the light dimmer is maxed out.

But then I found that it was possible to reconstruct missing data in 3 out of 8 cases, so that code was added and then I only stopped updates from happening unless there was insufficient data available. This helped a great deal by allowing the diversion load algorithm to keep running as much as possible. In cases where there's insufficient data, the code just keeps the current settings and waits for fresh data to arrive.

Using the Self Re-Trigger timers allowed me to finally have the code execution and ZWave network activity spread out in time. Initially, I used Self Trigger timers but since they essentially are started at the same time, they stay in sync all day long. The Self-Re-Trigger timers can be interrupted while running. While I normally run them with a fixed 15 second interval, for startup, I instead feed in a 3 or 6 second interval for the 2 timers to get them out of sync. Then the 15 second interval is resumed and they stay separated in time all day long.

Not sure what's causing the missing data, I'll often see it both on my Gen1 as well as Gen5 power meter, so I don't think it's a particular device. The VeraPlus seems to be responsive when the data is missing and I don't think the ZWave network is being saturated.

More to come...
Subscribe for more content like this
Comment, like, share & click the bell icon
And as always, thanks for watching

Intro/Outro:
Louisiana Fairytale by Austin Rogers
https://web.archive.org/web/20170402222425/http://drfiddle.com/show_tune.php?id=94

Loading comments...