KastB / addon-tesla-pv-charging

3 stars 1 forks source link

Calculation when stationary battery is included #1

Open realdadfish opened 2 years ago

realdadfish commented 2 years ago

I'm trying to match your initial implementation on my setup (https://github.com/realdadfish/addon-tesla-pv-charging) and have some problems wrapping my head around the proper calculations.

Basically I have a Tesla Wall Connector, a Tesla Powerwall and a Tesla. The house powers the basic electrical systems, the car and the heating / cooling system. I consume Battery and Car stats via TeslaPy and Connector info (only connected / disconnected) from the TWC. The TWC is not separately metered (could probably since the API gives me the numbers), but adds upon the total power usage.

I assume your calculations are based for a setup without a stationary battery, so you just have to look at the grid power value. If it is positive, you consume energy and therefor lower the amperage of the car as much as possible, when it is negative (feed in), you raise the amperage of the car, so more of the excessive Solar power is fed into the car.

Now since the Powerwall is part of my setup, I can't really do that, because the battery will even out excessive house power usage up until 4,6kW (the max output of the Powerwall), likewise, I can't (and also don't want) to use all of the excessive Solar since the Powerwall first has to be filled, before I see feed-in to the grid.

I'm not an electrical engineer, so I'm a bit lost with this. My rough guess is that I have to somehow subtract the power values of the battery to get the excessive solar (but only if its loading, i.e. when it's negative, as I don't want to have the car unload it), and then have to subtract the total power usage (minus the current load power of the car, because this is what we want to change). If the resulting value is positive there is excessive solar left (which should ideally match the grid feed-in), if the resulting value is negative, then the car loads too much or the house in total has a too high consumption (the latter only happens in small bursts so I probably cannot react on that; also its more likely to happen in the Winter time where there is almost no excessive solar available at all and the battery is normally not even half full).

If you have any hints then this would be greatly appreciated :)

KastB commented 2 years ago

Hi, you are right, my system has no battery involved. I think setting the low_soc and mid_soc to the same (relatively low e.g. 40) value should provide your desired result: There should always be some excessive solar generation which is consumed by your battery until it is full/power limited. From that point on the car should start charging if all power can be provided by the PV system => you would not charge from the battery, but charging would only start when there is enough excessive power to provide the configured minimal charging speed. Cheers