Restore Float or EOC when charging is allowed again after Wait (#343)
When charging was not allowed, the status went to Wait, also from Float or EOC. When charging was allowed again, the Init / Wait -> Bulk rule came first in the rebulk chain, so a full battery got the Bulk voltage again after any short block, without any rebulk rule being checked. The status is now kept in var_charge_status_before_wait on entering Wait. When charging is allowed again, Float or EOC is restored before the Force Bulk and rebulk rules, which then decide whether a new Bulk is needed. Any other status goes to Bulk as before. A dedicated variable is used rather than var_eoc: Auto SoC Limit sets Float without a full charge and leaves var_eoc false on purpose, and that Float must be restored too. Charging_logic documents when the status goes to Wait and what happens when charging is allowed again. Fixes #343
This commit is contained in:
1 parent
fcbe5023af
commit
249541420e
2 files changed
+40
-1
No files matched your search
@@ -28,6 +28,20 @@ While no BMS is combined (boot, reboot, OTA update, RS485 or BLE dropout), the c
|
||||
|
||||
When a BMS is combined again, the logic resumes from the kept status, and the usual rebulk rules apply: if the battery was discharged during the dropout, `Rebulk voltage`, `Rebulk SoC` or `Rebulk days` start a new `Bulk`.
|
||||
|
||||
## Charging blocked (Wait)
|
||||
|
||||
While at least one BMS is combined, the `Charging Status` goes to `Wait` when charging is not allowed:
|
||||
|
||||
- without `bms_options_charging_logic.yaml`: when the `Charging` switch is off, or when no combined BMS allows charging (protection, charge switch off);
|
||||
- with `bms_options_charging_logic.yaml`: only when the `Charging` switch is off. In that mode YamBMS turns the BMS charge switch off itself at Cut-Off, and that block must not change the status.
|
||||
|
||||
In `Wait` the `Charging Instruction` is `Stop`.
|
||||
|
||||
When charging is allowed again:
|
||||
|
||||
- a battery that was in `Float` or `EOC` goes back there, unless a rebulk rule applies (`Rebulk voltage`, `Rebulk SoC`, `Rebulk days`, `Force Bulk` or `Request Force Charge`), in which case a new `Bulk` starts;
|
||||
- any other status (`Init`, `Bulk`, `Cut-Off`, `Balancing`) goes to `Bulk`.
|
||||
|
||||
## Cut-Off Charging Logic Equation
|
||||
|
||||
Source: [Charging Marine Lithium Battery Banks](https://nordkyndesign.com/charging-marine-lithium-battery-banks)
|
||||
|
||||
@@ -243,6 +243,11 @@ globals:
|
||||
type: std::string
|
||||
restore_value: no
|
||||
initial_value: '"Init"'
|
||||
# Charge status before Wait, restored if it was Float or EOC
|
||||
- id: yambms${yambms_id}_var_charge_status_before_wait
|
||||
type: std::string
|
||||
restore_value: no
|
||||
initial_value: '"Init"'
|
||||
# Inverter links: one slot per declared CAN/RS485 link, filled by the link
|
||||
# package itself. The n-th element of the four vectors describes the same
|
||||
# link, so an unresolved link writes "None" and never an empty string.
|
||||
@@ -926,6 +931,17 @@ interval:
|
||||
}
|
||||
}
|
||||
|
||||
// +-----------------------------------------------+
|
||||
// | Charging allowed again after Wait |
|
||||
// +-----------------------------------------------+
|
||||
// A battery that was in Float or EOC goes back there, and the rebulk rules
|
||||
// below decide whether a new Bulk is needed. Any other status (Init, Bulk,
|
||||
// Cut-Off, Balancing) goes to Bulk through the Init / Wait rule.
|
||||
if ((id(yambms${yambms_id}_var_charge_status) == "Wait") &&
|
||||
((id(yambms${yambms_id}_var_charge_status_before_wait) == "Float") ||
|
||||
(id(yambms${yambms_id}_var_charge_status_before_wait) == "EOC")))
|
||||
id(yambms${yambms_id}_var_charge_status) = id(yambms${yambms_id}_var_charge_status_before_wait);
|
||||
|
||||
// +-----------------------------------------------+
|
||||
// | Force Bulk Logic |
|
||||
// +-----------------------------------------------+
|
||||
@@ -1100,14 +1116,23 @@ interval:
|
||||
}
|
||||
}
|
||||
// Charging not allowed (BMS or YamBMS)
|
||||
// The status before Wait is kept, to go back to Float or EOC when charging
|
||||
// is allowed again (see "Charging allowed again after Wait").
|
||||
else if (id(yambms${yambms_id}_var_bms_charging_logic) == true)
|
||||
{
|
||||
ESP_LOGD("yambms_debug", "Charging not allowed !");
|
||||
if (!id(yambms${yambms_id}_switch_charging).state) id(yambms${yambms_id}_var_charge_status) = "Wait";
|
||||
if (!id(yambms${yambms_id}_switch_charging).state)
|
||||
{
|
||||
if (id(yambms${yambms_id}_var_charge_status) != "Wait")
|
||||
id(yambms${yambms_id}_var_charge_status_before_wait) = id(yambms${yambms_id}_var_charge_status);
|
||||
id(yambms${yambms_id}_var_charge_status) = "Wait";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ESP_LOGD("yambms_debug", "Charging not allowed !");
|
||||
if (id(yambms${yambms_id}_var_charge_status) != "Wait")
|
||||
id(yambms${yambms_id}_var_charge_status_before_wait) = id(yambms${yambms_id}_var_charge_status);
|
||||
id(yambms${yambms_id}_var_charge_status) = "Wait";
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user