Configuring Charge Needed - TonyM1958/FoxESS-Cloud GitHub Wiki

It's useful to understand how the parameters are used in charge_needed() when predicting charging / discharging.

The model used for estimating the charge needed and the allowances made for losses is described here

Here are explanations of some of the configuration parameters that can be used to tailor the model:

Timed Mode

The biggest determinant of how the model operates is timed_mode. This has values 0, 1 or 2:

  • 0: simple charging model using charge times only
  • 1: a simple charging model where you want to allow for changes in work mode. These changes are incorporated as 'strategy' via set_tariff(). Typically, the changes in work mode are implemented using Home Assistant automations. charge_needed() only configures the charge times and does not try to change the inverter work mode
  • 2: schedule mode. In this mode, the system does a full model of the changes made using Mode Scheduler, based on the 'strategy' setup via set_tariff(). charge_needed() will configure and download the base strategy plus any plunge price periods (for Agile) and add any required Force Charge times

Force Charge

This sets the way that the battery charge is held and has values of 0, 1 or 2:

  • 0: there is no 'force_charge' period and charging happens for the shortest time possible within the tariff charge windows
  • 1: the battery is held for the whole of the tariff charge window, with charging happening for the required time within this. Use this mode if you have an EV that needs to be charged at your cheapest tariff
  • 2: the battery is charged to 100% for the entire charge time window

Where there are multiple charge time windows for a tariff, typically, force_charge only affects the first (off_peak1) time window (using the 'hold' setting in the charge window parameters).

Contingency

Contingency allows you to vary how conservative the battery charging is. Contingency allows for a variation in your consumption compared to the predicted value and provides a level of extra charge to allow for variations.

The setting for charge_needed is 'contingency' and the default value is [15,10,5,10], which means 15% in Winter (Dec, Jan, Feb), 10% in Spring (Mar, Apr, May), 5% in Summer (Jun, Jul, Aug) and 10% in Autumn (Sep, Oct, Nov).

There are days when consumption might vary more than normal, so charge_needed() has a facility for 'special_days' and 'special_contingency'. Special days are a list of MM-DD values that should use special contingency.

The default values for special days are ['12-25', 12-26', '01-01'] and special contingency is 33 (33%).

Charge Current

The biggest determinant of the time it takes to add a given level of charge to your battery is the Max Charge Current set on the inverter. The setting for this in charge_needed() is 'charge_current'.

The default value for this is the max charge current from the data sheet for your inverter model: 26A for AIO, 35A for H1, 40A for H1-G2 and 50A for KH.

If you reduce the Max Charge Current setting on the inverter, use 'charge_current' to tell charge_needed() what you have set so it can work out the correct time to allow for charging.

The inverter charge current setting can be over-ridden by the BMS, especially if the batteries are too hot or too cold. This can vary dynamically and an estimate of the Max Charge current is shown under the battery information.

Battery Voltage / Battery Count

The overall battery voltage is the sum of voltage of each battery (connected in series). Charge_needed uses the settings 'bat_volt' as the nominal voltage of a battery. The default value is 53. This number is used to work out how many batteries there are, by dividing the overall battery voltage by the nominal voltage and rounding the result to a whole number.

AC-DC Loss

When charging, the inverter takes in AC power and produces DC power for battery charging. The AC power input is called Grid Consumption Power (RPower in HA) and the DC power output to the battery is Charge Power (Battery Discharge Power in HA). You can check the values for these when the battery is charging from the grid. They vary slightly as the battery charges so I generally choose the mid point:

In this case, RPower is -5.33kW and Battery Discharge Power is -5.16kW. The AC-DC loss is the ratio Battery Discharge Power / RPower = 0.97

The setting for charge_needed() is 'ac_dc_loss' and the default value is around 0.97.

PV Loss

When charging from solar, the inverter takes DC power from the solar panels and converts this to a DC voltage suitable for charging the batteries.

The setting for charge_needed() is 'pv_loss' and the default value is 0.95.

DC-AC Loss

When discharging the batteries, the inverter takes DC power from the batteries and converts this to AC.

The setting for charge_needed() is 'dc_ac_loss' and the default value is 0.97.

Inverter and BMS Power

Both the inverter and BMS consume power for their operation. This is most evident when the inverter is set to 'force-charge' and it is not producing any power, where the operating power is drawn from the battery. BMS power is also consumed from the batteries when charging and discharging.

The settings for charge_needed() are 'inverter_power' and 'bms_power' respectively. The values are in watts (W) and the defaults are 101W and 50W.