-
-
Notifications
You must be signed in to change notification settings - Fork 92
Feature: Victron solarcharger: set battery charge-current-limit #1658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Changes from all commits
ce7af2a
079ac7e
78c9a30
acae089
b211fc1
6958ffc
37e12bb
0a009fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,6 +135,12 @@ void ConfigurationClass::serializeBatteryConfig(BatteryConfig const& source, Jso | |
target["discharge_current_limit_below_soc"] = config.Battery.DischargeCurrentLimitBelowSoc; | ||
target["discharge_current_limit_below_voltage"] = config.Battery.DischargeCurrentLimitBelowVoltage; | ||
target["use_battery_reported_discharge_current_limit"] = config.Battery.UseBatteryReportedDischargeCurrentLimit; | ||
target["enable_charge_current_limit"] = config.Battery.EnableChargeCurrentLimit; | ||
target["max_charge_current_limit"] = config.Battery.MaxChargeCurrentLimit; | ||
target["min_charge_current_limit"] = config.Battery.MinChargeCurrentLimit; | ||
Comment on lines
+139
to
+140
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand why you added min and max but the min value is a victron or solarcharger specific setting because you don't want to set current limit to 0. But if we focus on the battery alone, do i want to charge my battery with 3 A even if the BMS reports 0 A? Another thing to keep in mind is that ideally a grid charger (only Huawei R48xx right now) also works based on the charge current limit and would keep charging with the minimum current limit. If you agree that this is a victron/solarcharger only setting and not actually related to charging the battery but how much power the victrons should provide no matter what the BMS tells us, we need to either agree on a good hardcoded default value or create a settings item in the victron config. what do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here my thoughts: My battery BMS tuns "Max Charge Current" to 0A if e. g. a cell over voltage warning flag occures. I would like to be able to set the victron to exaxt this value then. When the warning flag disappears, the "Max Charge Current" goes back to 94,5A. This is much more than the Victron could deliver. I don't know what a victron that could deliver 20A would do with an value above that. So I would think that such a configuration is an victron only configuration that should be activatable and disactivatable and Victron specific max / min values should be configuratable. (I would adjust it in my case to 20A / 0A). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Victron max current does not need to be configurable within OpenDTU. If the battery allows 90 A but the victron can only do max 30 A, we will set it to 30 A. If you want to lower the max value of the victron you should do so in the victron mppt itself using the victron app. Talking about this, i wonder why we need the min setting at all? If a inverter connected to the DTU produces power the current drawn by the inverter is part of the current limit send to the victrons and this means that even if the BMS reports 0 A we would still allow the victrons to provide the required power to feed the inverter without taking power from the batteries. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, now I start to understand the philosophy: Then you are right and we pobably do not need the min setting. The max setting would apply if there is no desired Battery charging current delivered by the battery. (Does the Max setting in the Victron App limit the Value transmitted by DTU on Battery or will it just be overwitten?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exactly. The max current set in the victron app will be respected by the DTU, we will never request more current then what was set by the victron app. Actually these are two different fields in the victron mppt, and only because of that we are able to always respect that setting. By default this setting is the hardware defined max charge current e.g. 35A for the MPPT 150/35. |
||
target["charge_current_limit_below_soc"] = config.Battery.ChargeCurrentLimitBelowSoc; | ||
target["charge_current_limit_below_voltage"] = config.Battery.ChargeCurrentLimitBelowVoltage; | ||
Comment on lines
+141
to
+142
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that we should change this to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I introduced those settings: None of these settings is special for Victron, but for special use-cases. |
||
target["use_battery_reported_charge_current_limit"] = config.Battery.UseBatteryReportedChargeCurrentLimit; | ||
} | ||
|
||
void ConfigurationClass::serializeBatteryZendureConfig(BatteryZendureConfig const& source, JsonObject& target) | ||
|
@@ -559,6 +565,12 @@ void ConfigurationClass::deserializeBatteryConfig(JsonObject const& source, Batt | |
target.DischargeCurrentLimitBelowSoc = source["discharge_current_limit_below_soc"] | BATTERY_DISCHARGE_CURRENT_LIMIT_BELOW_SOC; | ||
target.DischargeCurrentLimitBelowVoltage = source["discharge_current_limit_below_voltage"] | BATTERY_DISCHARGE_CURRENT_LIMIT_BELOW_VOLTAGE; | ||
target.UseBatteryReportedDischargeCurrentLimit = source["use_battery_reported_discharge_current_limit"] | BATTERY_USE_BATTERY_REPORTED_DISCHARGE_CURRENT_LIMIT; | ||
target.EnableChargeCurrentLimit = source["enable_charge_current_limit"] | BATTERY_ENABLE_CHARGE_CURRENT_LIMIT; | ||
target.MaxChargeCurrentLimit = source["max_charge_current_limit"] | BATTERY_CHARGE_CURRENT_LIMIT_MAX; | ||
target.MinChargeCurrentLimit = source["min_charge_current_limit"] | BATTERY_CHARGE_CURRENT_LIMIT_MIN; | ||
target.ChargeCurrentLimitBelowSoc = source["charge_current_limit_below_soc"] | BATTERY_CHARGE_CURRENT_LIMIT_BELOW_SOC; | ||
target.ChargeCurrentLimitBelowVoltage = source["charge_current_limit_below_voltage"] | BATTERY_CHARGE_CURRENT_LIMIT_BELOW_VOLTAGE; | ||
target.UseBatteryReportedChargeCurrentLimit = source["use_battery_reported_charge_current_limit"] | BATTERY_USE_BATTERY_REPORTED_CHARGE_CURRENT_LIMIT; | ||
} | ||
|
||
void ConfigurationClass::deserializeBatteryZendureConfig(JsonObject const& source, BatteryZendureConfig& target) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Avoid defining macros inside class headers; consider replacing
HIGH_PRIO_COMMAND
with astatic constexpr uint8_t
member or anenum
.Copilot uses AI. Check for mistakes.