Wednesday 6 June 2018

Powerwall 2 Time Base Control Algorithm

Since PW2 (Tesla Powerwall 2) introduced the new TBC (Time Base Control) algorithm, I had a great difficulty in trying to understand the actual algorithm, especially during shoulder period. Consulting forum (such as here and here) only confuses me further, especially when the forum started to discuss incentives and local regulations (US centric). This, however, makes me appreciate the herculean task for PW2 engineers. You simply can't make everyone happy.

The ever evolving nature of PW2 algorithm (typical Tesla my guess), makes any 'User Manual' writing attempt a futile exercise. Reverse engineering the algorithm also requires different permutation, such as state of charge, how much PV production during the day, etc that can affect the PW2 behaviour.

Still, little documentation is better than nothing. Since I don't have the stamina to try all permutations, I deliberately write down as much details below (trying to be as neutral as possible, i.e. no incentive and regulation jargon):

Off-Peak Cost Saving Mode:
In this mode, PW2 does try to aim a certain State of Charge prior entering shoulder and peak period (by charging from the grid if necessary). Based on the limited 2 days experiment (see screenshot below), this State of Charge (SoC) is not a fixed value. How does PW2 decides this SoC level? Me no idea.



Also, some charge from PW2 is used during off-peak period (see bubble number 1 in the screenshot). I don't know how PW2 decides when to use the battery. One thing for sure: it mostly uses the grid to conserve the SoC for peak period.

I haven't tested what happens when you have solar production during off-peak period.

Shoulder Cost Saving Mode:
Now this gets interesting. In day 1 of the test (see bubble number 2), my PW2 behaved as I wanted it, that is: no grid activity (i.e. to behave exactly like peak). Too bad I didn't record the SoC, but I remembered it was roughly 40-ish percent at this stage.

In day 2 (see bubble number 3), my PW2 started to be less agressive (despite higher SoC compared to the previous day), i.e. grid activity is allowed by importing and exporting. Uh oh, for me, who has a power provider that value exported PV close to zero (yup, zilch, nada), this is bad news. Also, why PW2 allows a significant grid import when the battery SoC is relatively high (roughly 60-ish percent at bubble number 3). Is this because PW2 hasn't learnt that I don't usually use lots during peak period? My guess at this stage, this is due to the PW2 algorithm is based on US-centric market, where they have incentive to export PV to the grid (such as net metering). Pure guess though.

At this stage, my panic mode was on, and I switched it back to 'Self-powered' mode (as commented by the red line), which explains why the screenshot is no longer showing peak/off-peak on the 14-th May, and also 100-ish watt grid consumption during solar production after the switch (see my previous post).

After 14th of May, I changed PW2 to 'TBC Balanced' mode and extended the peak period to also cover shoulder (i.e. only peak and off-peak, no shoulder). This has worked perfectly for me, but...

In the last 2 days, I haven't had enough PV production to cover my shoulder and peak. This has caused me grief since now I need to import from the grid during peak period (see bubble number 4). So, I changed it to TBC 'Cost Saving' mode, thinking that PW2 would've charged from the grid during off-peak to cover my PV production shortfalls. To my surprise, it didn't (although the SoC was just a tad below under reserve).

So, here I am, finding another quirk in PW2 algorithm. If you don't set the shoulder period,  PW2 will not charge from the grid (despite the PW2 SoC at the reserve level). What the??

In the screenshot below (see bubble number 5), you can see that as soon as I bring back the shoulder period, PW2 behaves as I expected again by start charging from off-peak grid (I've found this by coincidence).

In short, for those who want exporting to the grid at the very lowest priority, I recommend to use 'TBC Cost Saving' mode with a wee bit of shoulder period (just enough to activate 'charge from off-peak grid mode').



PS: Peak period behaviour is consistent as expected, i.e. no import from the grid.