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.

2 comments:

Anonymous said...

Time-Based control uses an energy forecast to determine

1. Solar production
2. Energy usage for each time period (off-peak, shoulder, peak)

Depending on these values the dispatch of energy can be different so you will not always see the same behaviour.

This means it does not target a SOC% but rather targets a dynamic 'make room for solar' amount of kWh and offset peak usage. The accuracy of these forecasts improve over time as more data becomes available - that is why the SOC% is not static, because your energy needs are not static.

These 2 forecasts are updated every 15min depending on available data. So it may decide to do a small grid charge, but then when the sun comes up (or your usage changes), there is more excess solar than expected. In that case it will discharge into off-peak or shoulder to 'make room' for the updated solar forecast.


Example 1
Large amount of solar forecast, low amount of peak usage forecast.

Here you don't want to grid charge (as you get $0/kWh for export) so off-peak Powerwall will let you buy energy for the home, and wait to charge from gross solar, with the aim to discharge to peak, and if enough solar, shoulder.


The difference between cost-savings and balanced;

Grid-charging ->
In AU cost savings will allow grid charging (not currently available in US)

Discharge to off Peak ->
If the energy forecasts predicts there is enough energy to cover peak, shoulder AND off-peak, 'balanced' will do this to preserve your self-powered % (while avoiding export). Cost savings will not attempt to cover off-peak as there is no economic benefit, but keep that energy for peak or shoulder


Rusdy said...

Thanks for the AU vs US difference in off-peak grid charging, I didn't know that.

What I suspect, PW2 doesn't have the 'correct' algorithm for my personal case to decide what is the lowest cost. For example, in my own case, looks like PW2 doesn't know that my grid provider doesn't give me any incentive to export PV. Or else, why PW2 would allow export during shoulder period (the battery is not full at this stage, i.e. bubble number 3)?

The algorithm would need to know input variables, at least export cost (per kWh) in order to decide what is the lowest cost. For my personal case, 'use it or lose it' principle is the ultimate priority for lowest cost. From my observation to date, PW2 fails this.

Fortunately, there is a quick fix for me regarding this issue. Simply by extending peak period to also cover shoulder. But, I need to leave a wee bit shoulder period to activate off-peak charging, which is a quirky feature.