Control of the battery storage
(for firmware versions < 1.25.2)

The documentation for controlling the battery storage for firmware versions from 1.25.2 can be found here.

Most battery storage systems installed in connection with solar power systems have a built-in charge control according to which they attempt to charge up before power is fed in and attempt to discharge before power is drawn from the grid. Industrial storage systems can be controlled according to other criteria, e.g. to limit peak loads or to limit energy purchases in high-load windows according to the grid operator's specifications. Small battery storage units would go through deep charging cycles due to the charging of the electric car and thus have high wear and tear. Therefore, in many cases it makes sense to control the storage unit through the cFos Charging Manager. For this, you need a model that can be controlled or at least a switching option via a relay.

Storage units can be controlled as part of SunSpec Battery Model 124 (e.g. Fronius) or have their own Modbus registers that allow control. Hybrid devices serve as inverters for solar panels and storage. Inverters, meters and battery storage are created as meter tiles in the cFos Charging Manager. In all meters there is therefore the option to activate battery control. For SunSpec devices with model 124, the cFos Charging Manager attempts to control the associated storage. You may have to enable this in the unit first. For user-defined meters (Victron, etc.), the cFos Charging Manager tries to find a user-defined variable called "soc" (in percent). This is then displayed in the meter tile, if applicable.

Under battery storage control, you can first specify the maximum charging and discharging power. -1 means that the Charging Manager should not control the charging or discharging power. You can then define several charging rules that are processed one after the other every few seconds and limit the charging or discharging current. The charging or discharging current to be set is the minimum of all charging rules. For each charging rule, you can determine the days of the week on which it is to apply and whether it is a charging or discharging rule. The following types are possible:
Minimise grid draw/grid feed-in. Here, as described above, the grid draw and the feed-in are minimised, as many storage facilities do by default. Since the measured storage power or the mains supply/speed-in deviate slightly from the actual power, it must be readjusted again and again. The adjustable control factor, which is typically close to 1.0, is used for this purpose.
Time Limit charging current depending on a time range.
Car charging. Limit charging current when at least one car is charging.
SoC. These charging rules allow to limit the charging and discharging power depending on the current level of the storage.
Price / Price Level. As with charging rules for the car, here you can charge or discharge the storage depending on the electricity price. To do this, you must be a customer of an energy provider with variable tariffs (e.g. Tibber or Awattar), or have selected "Charging Manager" as your energy provider.
Formula. Here you can freely determine the limit of the charging power using a formula.

After all charging rules have been processed, there is a current limit (which can also be 0) for the charging or discharging current. The cFos Charging Manager stores these values in the user-defined variables named "charge_power_w", "charge_power_prc" (specified as a percentage), "discharg_power_w" and "discharge_power_prc". There is also a user-defined variable called "bat_mode". Here it is recorded whether there is a charge limit or discharge limit (0=no limits, 1=charge limit, 2=discharge limit, 3=charge and discharge limit). With SunSpec units, the limits are converted and written to the registers provided for this purpose. With user-defined counters, you can create user-defined outputs that write the values of the above variables to the unit. You will find examples of this in the supplied meter definitions for Victron or Kostal Plenticore. If the charge or discharge limit is not controlled, the respective variables do not exist, so they are not written to the memory. With the "Mode" setting of the battery storage control, you determine what should happen if there are positive values for both charging and discharging current. "Neutral" means that the cFos Charging Manager passes both values to the storage unit and, if necessary, the storage unit decides for itself what to do in a range. "Prioritise charge" means that the discharge current is set to 0 if the charge current is positive, "Prioritise discharge" means that the charge current is set to 0 if the discharge current is positive. This is useful if the storage unit only has one value for charging and discharging current. If you activate "Give up control" it means that the variables are deleted, i.e. no control is exercised if no charging rule has been used. Then the storage unit can use its default rule.

Hand over control: This option allows you to hand over control to the built-in controller in the storage tank. If the cFos Charging Manager does not control the storage, the built-in control can take over again. If this option is ticked, the user-defined variables "charge_power_w", "charge_power_prc", "discharge_power_w", "discharge_power_prc" are discharged if the power calculated by charging rules is < 0. This is the case when the maximum storage power has been set to -1. If the option "Give up control" is active, the charging or discharging power is also set to -1 if no charging rule was applied. In addition, you can use "Formula" to set the power to -1 if you want to give "Control" back to the storage unit.
If this option is not active, the power value is not changed if power < 0, i.e. the value determined during a previous run is retained.

Switching output: Unfortunately, some memories cannot be controlled directly with the above rules. However, in order to at least be able to deactivate the storage unit with the above rules (for example, when a car is charging), you can try to use a switch contact if the storage unit has a control input. If practicable, you could also disconnect the storage tank electrically from the mains using a contactor (to avoid destroying the storage tank, you must first ask the manufacturer or electrician whether the device is suitable for this). You can enter the name of a variable in the "Switching output" field, which is set to 1 if the charging or discharging power is positive after evaluating the charging rules and to 0 if not. The cFos Charging Manager provides a counter definition for a Shelly switch box or switch socket. When you set this up, the counter receives a device ID, e.g. M5. You can then specify the Shelly switch box under "Switching output" in the battery storage controller using: M5.output1.