Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

Control mode optimization?

This site may earn commission on affiliate links.
I'm part of an SGIP program with SCE in Southern California. We have a small (3kW) PV system and a single Powerwall 2. We don't have an EV or AC. On sunny days the system meets about 75% of our power needs in winter, and 100% in summer. We live near the coast, so are subject to foggy mornings from about April through August.
My question has to do with optimizing the switch between Time-Based and Self-Powered control. Is there a way to do that programmatically?
On sunny days, it makes sense to keep our system in Self-Powered mode. We generate enough power to both charge the battery and run the house. When peak rate time arrives, the battery is at 100% and we haven't used any utility power. If it's cloudy and the PV system is under performing, then TOU mode is the right setting. That assures the battery stores as much power as possible ahead of peak rate time.
I'm wondering if there's a way to write a control system that does this sort of switching automatically. That would just be a fun exercise at this point, but could be quite important if the PUC proposal goes through. As i understand that proposal it: a) cuts our compensation for power fed back to the grid to wholesale rate (~$0.05 / kWh), and b) increases peak rate for customers with PV systems to $0.48 / kWh). If this goes through, it won't make much "cents" to sell power to SCE, and will be even more important to not use peak rate electricity. Hence the interest in a way to optimize the mode switching that would accomplish this.
Also wondering if maybe Tesla is working on something along these lines. They already incorporate weather with Storm Watch.
 
People have documented the API if you want try to change settings yourself.

GitHub - vloschiavo/powerwall2: Tesla Powerwall 2 - Local Gateway API documentation

tesla-powerwall · PyPI

In theory, TOU mode should do you want if the parameters are set correctly. I would first spend effort in getting the correct costs in the configuration. Odds are it will do the right not the majority of the time.

This problem is easy in hindsight but the control system has to decide before it knows the future if there is going to be enough solar whether to prioritize charging the battery versus being self-powered. Tesla has made changes to their algorithms but based on the behavior I've seen in the past in cost optimized and balanced TOU (when were was separate option) they will try prioritize charging the battery if the predicted production won't generate enough surplus to have the battery just be charged by surplus production before peak hours start. The current settings give it more information (specifically the time of use rates and the price of imports and exports). So in theory it should be able to make decisions better. The main unknown remains what the actual production will be. Is your weather forecast better than what Tesla is using (if they're using one at all)?
 
  • Helpful
Reactions: pilotSteve
Thanks for the reply. I'll check into the API documentation, but won't be changing settings myself quite yet.
The weather and TOU rate optimization is an interesting problem. I can envision an algorithm that learns your PV system's output capacity under sunny conditions. With that info it could determine current local sky conditions, and from that predict the system's forward charge rate (assuming sky conditions remain the same). Combine that with peak rate time windows, current time of day, and PW's current charge level to determine which mode to be in (time based or self-powered). The predicted charge rate would have to be low pass filtered to avoid high frequency mode switching on days that are constantly changing from sunny to cloudy. But for places like ours where we have foggy mornings that clear to sunny afternoons, this sort of optimization could work.