Documentation

Charging rules
(for firmware versions from 1.25.2)

The documentation of the charging rules for firmware versions < 1.25.2 can be found here.


                        Screenshot dialogue loading rules

General mode of operation

The charging rules of the cFos Charging Manager work like small programmes. When the cFos Charging Manager processes charging rules, it takes a start value as the "rule value" and then runs through all the charging rules from top to bottom. It checks the condition for each rule and, if it is fulfilled, executes the relevant action. This continues until either the end of the loading rules is reached or the "Finish" option is set for the action if the condition is fulfilled. The rule value determined up to that point is then returned. For wallboxes, the charging rules determine the charging current per phase in mA in this way and for battery storage systems the charging or discharging power in W.

For charging rules for wallboxes, the start value is 0, i.e. if no rule is fulfilled, charging is paused. For battery storage systems, the start value is the maximum charging or discharging power, i.e. if no charging rule is fulfilled, the maximum charging or discharging power is the one set in the battery control options of the cFos Charging Manager.

Combination of PV surplus and normal charging rules: Charging rules for wallboxes have a "PV surplus" option. In each cycle, the cFos Charging Manager first checks whether charging rules with the "PV surplus" option are set for wallboxes. All wallboxes whose charging rule(s) with this option provide a value >= 0 are considered first and their charging current is marked as surplus. Then all wallboxes with charging rules without the "PV surplus" option are considered. This means that wallboxes that want to charge PV surplus are prioritised. Note: If the charging rules with the "PV surplus" option return -1 for a wallbox, this wallbox does not participate in the PV surplus. The Charging Manager then applies charging rules for normal charging.

This means that if, for example, you want to create a charging rule with PV surplus and alternatively, if there is not enough surplus all the time, a normal charging rule, proceed as follows:
1. Rule: PV surplus condition and "Deliver surplus" action ("PV surplus" ticked and "End" ticked)
2nd rule: "Always" condition, action: "Deliver value", -1 ("PV surplus" ticked and "End" ticked)
3rd rule: e.g. a time or price-controlled rule ("PV surplus" NOT ticked).

From version 2.3.x: To make combined PV surplus and normal charging rules easier, you can now combine them. After PV surplus charging rules have been processed, the cFos Charging Manager now also evaluates normal charging rules (i.e. without "PV surplus" ticked). These overwrite the current value determined by the PV surplus rules. The variables lb_cur_l1, lb_cur_l2, lb_cur_l3 and lb_cur (determined values of the currently considered phase) are available so that normal charging rules can access the previously determined current value. If, for example, you always want to charge with a certain minimum current regardless of the current PV surplus (and draw this from the grid if necessary), you can specify max(10000, lb_cur) as the return value for a normal charging rule. Charging then always takes place with at least 10 A.

Note on automatic phase switching: If the wallbox is categorised as surplus charging based on charging rules, the automatic phase switching checks whether there is sufficient surplus for the phases. Otherwise, the phase switching checks whether there is sufficient power available on the respective phases (normal load management). So if you want to try PV surplus first and, if not available, normal charging rules, you must use an extra charging rule that returns -1 to tell the Charging Manager that this wallbox should not (yet) be considered as surplus charging.

Calculation of the surplus: If the "PV surplus" option is activated, the condition "PV surplus >= expression" considers whether the surplus divided by the predicted charging phases is large enough for the condition to be fulfilled. If the "PV surplus" option is not active, the system checks whether the surplus on the respective phase is >= expression. The same applies to the conditions "Grid supply", "Grid feed-in" and "Solar power". Here, if the "PV surplus" option is active, the sum of the currents divided by the predicted number of charging phases is checked against the expression, while if the option is not active, the current of the respective phase is checked. For the actions, if the "PV surplus" option is active, the sum of the currents of all phases divided by the predicted charging phases is delivered as the value for "Deliver surplus", "Deliver solar power", "Deliver grid supply" and "Deliver feed-in", while if the option is not active, the current of the respective phase is delivered. In short: For the usual case of PV surplus charging, we recommend activating the option. If the option is not active, the focus is on load management, i.e. the cFos Charging Manager considers all three phases separately.

Each charge controller has the following general setting options

ID: A freely selectable number. See below for more details.

Rule active: Rules that are not active are ignored.

Weekdays: This allows you to set the days on which the rule should be observed and the days on which it should be ignored

PV surplus: With charging rules for wallboxes, the Charging Manager always checks first whether charging rules for PV surplus are active. These then determine the charging current per phase. All charging rules whose "PV surplus" option is not set are then processed from top to bottom.

Charging or discharging: For charging rules for battery storage systems, the Charging Manager processes all charging rules with the "Charging" option and all charging rules with the "Discharging" option independently of each other and thus determines the current charging or discharging capacity.

Each loading rule has a condition and an action. The action is only executed if the condition is fulfilled. An action can also have the "End" option activated. In this case, processing of the charging rules is ended after the action has been executed and the current rule value is returned. If "Finish" is not set, the Charging Manager continues with the next charging rule. If it reaches the end of the list, it also returns the current rule value.

Conditions

All conditions contain the "Not" option. If this is set, the action is executed if the condition is not fulfilled. Otherwise, the action is executed if the condition is fulfilled.

Some conditions have the option "Continue executing rule without fulfilled condition". You can specify a time in seconds here. If the condition is fulfilled, it may not be fulfilled for x seconds afterwards and the action is still executed. If, for example, the minimum PV surplus is reached, it may then be exceeded for x seconds and the action will still be executed.

Time: The condition is fulfilled within the specified time, but not outside. This allows you to charge at certain times.

PV surplus: The condition is fulfilled if the PV surplus per phase (for charging rules for cars) or the PV surplus across all phases in watts (for battery storage systems) is greater than (or equal to) the specified value or the formula.

Price: The condition is fulfilled if the current purchase price in cent per kWh is less than (or equal to) the specified value or the formula.

Price level: The condition is met if the current price level is less than (or equal to) the specified value or formula.

See also: Cost-conscious charging

SoC: The condition is fulfilled if the state of charge of the car (if the cFos Charging Manager knows this value) or the battery storage is greater than (or equal to) the specified value or the formula.

Number of loading cars: The condition is fulfilled if the number of loading cars is greater than (or equal to) the specified value or the formula.

Grid reference: The condition is fulfilled if the grid reference (for charging rules for cars per phase, for charging rules for battery storage in watts across all phases) is greater than (or equal to) the specified value or the formula.

Grid feed-in: The condition is fulfilled if the grid feed-in (for charging rules for cars per phase, for charging rules for battery storage in watts across all phases) is greater than (or equal to) the specified value or the formula.

Solar power: The condition is fulfilled if the generated current per phase (for charging rules for cars) or the generated power across all phases (for battery storage) is greater than (or equal to) the specified value or the formula.

Input active: The condition is fulfilled if the input with the specified number of the device with the specified device ID (E1, E2, ... for wallboxes, M1, M2, ... for meters) is active. Numbers count from 0. In this way, you can use charging rules in conjunction with switching inputs. The cFos Power Brain Wallbox, for example, has 2 S0 inputs. To use these, you can set up a cFos Power Brain S0 meter as a device with the "Display" role in the cFos Charging Manager. Assuming this meter has the device ID M1, you can address the S0-1 input using device ID M1 and input number 1. You can find information on wiring the S0 inputs on the cFos Power Brain on our page about S0 inputs / S0 counters and Modbus counters. If, for example, you want to control the charging current using an external switch or use a ripple control receiver that switches a relay in accordance with the energy supplier's specifications, you can use charging rules with input. In this way, you can also activate a charging controller for PV surplus via input.

Environmentally friendly: Here you can specify the maximum desired delay of the charging process and the expected charging time. The condition is considered fulfilled (and remains fulfilled) as soon as the cFos Charging Manager has calculated a start time that is as environmentally friendly and grid-friendly as possible and this has been reached. See Environmentally friendly charging.

Formula: The condition is fulfilled if the value of the formula is > 0 (floating point values). See formulas.

Always: The condition is always fulfilled.

Actions

Actions are executed if the condition of the loading rule is fulfilled (or the "Not" option is set and the condition is not fulfilled).

Set to value/formula: The current rule value is set to the specified value or formula.

Supply PV surplus / Supply solar power / Supply grid supply / Supply feed-in: The current control value is set to the corresponding value. For charging rules for storage systems, the power in watts across all phases. For charging rules for wallboxes, this is the current per phase in normal charging, for surplus charging ("PV surplus" option is set) the sum of the currents across all phases, divided by the number of phases (predicted or actual) used for charging. The value can also be multiplied by a factor, which is 1 by default. This can be used, for example, to control a battery storage system to avoid grid consumption or feed-in. The charging level of the battery storage system would charge the storage system with the grid supply. However, as there are measurement inaccuracies when determining the grid reference, the grid reference multiplied by a factor close to 1 is used as the charging rule for the storage system.

Set variable: The specified variable is set to a value or formula. You can specify Charging Manager variables or user-defined device variables as names. Charging Manager variables start with "CM.", device variables have a device ID and the name of the variable (e.g. E1.x).

The following variables are also available:

Trigger / re-trigger variable: The specified variable is set to 1. Naming works as with 'Set variable'. You can specify a formula or a fixed value in seconds as the duration. Trigger means that the variable is reset to 0 after the duration has expired (and can then be retriggered if necessary). Re-trigger means that the duration always starts again when the condition is met. If the condition for the duration is not fulfilled, the variable is set to 0 again.

_rule_valThe current rule value. You can also query this in formulas.
_rule_idThe current rule ID (read and write). If the condition is fulfilled and the rule ID is not 0, this variable is automatically set or overwritten. However, you can also set this variable explicitly per rule using "_rule_id", e.g. to visualise which particularly important rule has been processed. The last rule ID set is displayed in the tile of the device.
_rule_minThis value is normally set for switching from single-phase/three-phase charging, for example if you specify conditions with a current limit. Here you can set this value yourself. The system switches from single-phase charging to three-phase charging if the current limit has been greater than (or equal to) the "_rule_min" for a period of time.
_undercutSet undershoot to active if value is greater than zero (see below for explanation).

And: Link the rule to the next rule. The condition of the next rule is not considered to be fulfilled if the condition of the current rule is not fulfilled (regardless of whether the condition of the next rule is actually fulfilled).

Or: Link the rule to the next rule. The condition of the next rule is considered to be fulfilled if the condition of the current rule is fulfilled (regardless of whether the condition of the next rule is actually fulfilled).

Go to: The cFos Charging Manager searches (from top to bottom) for the first charging rule whose ID is the same as the specified ID and continues processing the charging rules with this one. If it does not find one, it continues processing with the next charging rule. Caution: Avoid endless loops! Although the Charging Manager cancels the processing of the charging rules after a while, it may waste unnecessary (calculation) time. In combination with the conditions of the charging rules, you can use this action to create small rule programmes.

Undercutting

For some conditions, you can set a time in seconds for which the rule should continue to be executed even if the condition is not met. For example, you can define a rule that is executed when a switching input is set. If you then set a time, this rule will continue to be executed for N seconds even though the input is no longer set. In the case of PV surplus charging, you can use this time to prevent charging from being interrupted by brief clouds.

The Charging Manager remembers in a flag called "_undercut" whether this "undercut" is active for at least one rule. If the charging rules for wallboxes result in a value below the minimum charging current set in the wallbox and the "_undercut" flag is set, the cFos Charging Manager returns the minimum charging current as the rule value so that the car continues to be charged. However, you can also set or delete the "_undercut" flag yourself using the charging rule (see above).

Charging control sets (from firmware 2.3.x)

From version 2.3.x, loading rules are summarised in rule sets. Previous loading rules can be found under "Own loading rule set". This loading rule set can be exported as a file. When exporting, you should assign a unique ID to the rule set, as the Charging Manager manages rule sets by ID and overwrites existing ones with the same ID when importing. You can share such files with customised charging rules with other users. You can load such customised rule sets into your cFos Charging Manager and then switch between your own rules and these rule sets. You can manage such charging rule files under Configuration -> Files. You can also copy a rule set to your "Own rule set" in order to change it. From version 2.3.x, the cFos Charging Manager is supplied with a small range of charging rules that cover a few common requests from our users. In order to be able to use these rule sets as universally as possible, the following additional functions are available for the charging rules:

Additional functions for charging control sets

Parameter: You can define a parameter as an additional action. This is addressed via its rule ID and set to a formula or fixed value. There is also a name or help text for the meaning of the parameter. You can freely configure this parameter in the "Own loading rule set". If you want to access this parameter in another loading rule (further down in the rule set) in a formula, you receive the current value via "param(id)", where id is the loading rule ID of the parameter. This allows you to create parameterisable loading rules, i.e. you can change the parameter without having to change the loading rules further down.

Only such parameters are displayed in user-defined loading rule sets so that you do not inadvertently change the actual loading rules. You can change a parameter and save the change. This allows you to customise loading rules to suit your needs.

Time range with formulas: As an additional condition, you can define a time range whose start and end minute of the day is determined by a formula. This is a more flexible variant of the previous time conditions with fixed start and end times. In particular, you can also access parameters in the formulas with the new condition for time range. Example:

Rule ID 12, parameter value 600
Rule ID 13, parameter value 720
Time range with formulas, start time: param(12), end time: param(13)

The condition is fulfilled between 10:00 and 12:00. If you use such a combination of parameters and time range with formulas in a customised loading rule set, other users can easily adjust the time range in their parameters.

Switch control set: As a further action, you can switch to a different rule set using the loading rule.

Logging

To make it easier to create loading rules, you can set the log level to Information under "Configuration" -> "Logging" -> Loading rules. The following then appears in the log for each evaluated loading rule:

CR id/idx b/r: A v

id is the rule ID entered.
idx specifies which rule this is (counted from 0).
b is true if the condition of the rule is fulfilled.
r is true if the condition including AND and OR linking with other rules is fulfilled.
A specifies the action that is to be executed. Depending on the action, the line may contain further information. Here are the values:

0Return value / formula
1AND
2OR
3Set variable, log: Variable name and value
5Go to, log: Target ID and idx
7Trigger variable, log: Variable name triggered or reset
8Re-trigger variable, log: Variable name re-triggered or reset
10PV surplus * supply factor
11Deliver solar power * factor
12Grid supply * supply factor
13Feed-in * supply factor
v is the current value determined when evaluating the rules.