-
Notifications
You must be signed in to change notification settings - Fork 66
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
DPL Voltage Features #679
DPL Voltage Features #679
Conversation
unfortunately, the battery SoC values reported by battery BMSs are unreliable, at least for some users, or at least without regular (manual) full charge cycles to calibrate the BMS. it offers great advantages to connect OpenDTU-OnBattery to a BMS (MQTT publishing of values, Home Assistent integration, etc.), but previously the users were then forced to configure the DPL by SoC values. this change allows to configure the DPL such that SoC values are ignored. instead, the voltage limits are used to make DPL decisions, as if no SoC was available in the first place. the SoC related setting are hidden from the DPL settings view if SoC values are configured to be ignored. closes hoylabs#654.
the BatteryStats base class shall be able to tell the total battery pack voltage. for that reason, and to avoid code duplication, the voltage is now handled in the base class and treated as a datum that is common to all battery providers.
this extends the MqttBattery implementation by an additional topic which allows to subscribe to receive battery voltage readings through the MQTT broker. similar to the battery SoC topic, this allows to import a critical battery data point for the DPL, in case the user chooses to use voltage thresholds rather than SoC thresholds to control the DPL. if an otherwise incompatible BMS is available which publishes the battery pack voltage through MQTT, this can now be used to feed accurate voltage readings to the DPL.
in the respective context, the DPL only needs to be sure that the SoC value is not outdated. it should not even care about other values reported by the battery interface. hence, the isValid() method shall be concerned with the SoC value timestamp only. the method is renamed for clarity.
the Victron SmartShunt communicates the SoC value in permille. this should be displayed in the web UI accordingly. this is a good excuse to fully move ownership of the SoC value to the BatteryStats base class and add a precision indicator variable. this is required to be set each time a derived class (a battery provider) wants to update the SoC value. the precision is then used when populating the JSON data for the web UI (live view). related to hoylabs#573.
the DPL is interested in the battery's voltage to make decisions about draining the battery or letting it charge (if the user opts to use voltage thresholds rather than SoC thresholds). using the DC input voltage reported by the inverter under control has disadvantages: * the data might be quite old due to the communication protocol implementation. more inverters being polled means even more lag. the connection being wireless makes this even worse, due to the need to retry the occasional lost packet, etc. * the data is not very accurate, since the DC input of the inverter is actually some cabling and a couple of junctions away from the actual battery. this voltage drop can mostly only be estimated and is worse with higher load. the load correction factor is there to mitigate this, but it has its own problems and is cumbersome to calibrate. instead, this change aims to use more accurate battery voltage readings, if possible. the DPL now prefers the voltage as reported by the BMS, since it is for sure the closest to the battery of all measuring points and measures its voltage accurately regardless of the load (the voltage reading will still drop with higher loads, but this will be only due to the battery's internal resistance, not that of cabling or junctions). if no BMS voltage reading is available, the DPL will instead use the charge controller's voltage reading, as it is available with much higher frequency and is assumed to be more accurate as it offers a resolution of 10mV. only if none of these two sources can be used, the inverter DC input voltage is assumed as the battery voltage. closes hoylabs#655.
@helgeerbe Please do NOT squash the commits. I hope you find them sufficiently clean, and it would be nice to preserve the commit titles so they create a respective entry in the changelog. Thanks in advance! @hoschiking Magst du das testen? Unten im Abschnitt "Artifacts" gibt es passende Dateien. Regarding the feature to use BMS voltage over MPPT voltage over inverter voltage, here are respective logs to show the behavior: BMS available:
BMS not available:
Neither BMS nor MPPT available:
|
hello @schlimmchen i really like the progress and idea, of having the ability to use different "voltage sources" how will this automatic decission and fallback to the next lower device handle the load correction factor? wouldn't it be good, to either only define one specific "voltage source", that should be used, because right now we only can define one load correction factor? or else define multiple factors? what i mean: for the mppt and inverter, the resistance strongly depends on your setup and the loads. in this scenario, if we dont charge the battery, the red connection is without load. so if the mppt is the voltage source, we don't need a factor. if we use one, we mustn't compensate the inverter load, but the mppt charge current. if the inverter itself measures the voltage, we need the load correction, as it is implemented now. if we use a busbar, it gets more complex and complicated. here, we have several possibilities:
inverter measures:
i think you get what i mean. imo the best and easiest solution is the BMS or a shunt, as they are as close as possible to the battery and have a well-defineable resistance. but one single factor, as we have it now, won't fit all use cases, that can occur with this automatic fallback, will it? |
@schlimmchen Bei 25,4V soll das Einspeisen beendet werden. Dies ergibt eine durchschnittliche Zellenspannung von 3,175V Aus dem Text entnehme ich, dass die Berücksichtung der Spannung des BMS bereits implementiert ist? |
Thanks!
@spcqike The voltage will be determined based on the priority I implemented, and the load correction factor will be applied afterwards. You are right that a load correction factor (LCF) for each voltage source is technically necessary, however, the voltage data source is known given your particular setup. Tune the LCF for that voltage source. Be happy. If you tuned your LCF for the BMS, and the DPL has to make due with the charge controller voltage, the LCF will not be ideal, yes. In that case, something is wrong with your BMS communication and you will be fixing it anyways once you notice. Once you fixed it, your voltage source will be the BMS again and your LCF is tuned.
Ja. Wenn du die verlinkten Artefakte nutzt, bzw. das vorhin veröffentlichte 2024.02.19, und dein JK BMS Interface funktioniert, dann wird die von ihm gemeldete Spannung im DPL als Berechnungsgrundlage verwendet. |
@schlimmchen Well done 👍 |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new discussion or issue for related concerns. |
Features added
DPL: use best available voltage value
the DPL is interested in the battery's voltage to make decisions about draining the battery or letting it charge (if the user opts to use voltage thresholds rather than SoC thresholds). using the DC input voltage reported by the inverter under control has disadvantages:
instead, this change aims to use more accurate battery voltage readings, if possible. the DPL now prefers the voltage as reported by the BMS, since it is for sure the closest to the battery of all measuring points and measures its voltage accurately regardless of the load (the voltage reading will still drop with higher loads, but this will be only due to the battery's internal resistance, not that of cabling or junctions). if no BMS voltage reading is available, the DPL will instead use the charge controller's voltage reading, as it is available with much higher frequency and is assumed to be more accurate as it offers a resolution of 10mV. only if none of these two sources can be used, the inverter DC input voltage is assumed as the battery voltage.
closes #655.
know and use SoC precision
the ictron SmartShunt communicates the SoC value in permille. this should be displayed in the web UI accordingly. this is a good excuse to fully move ownership of the SoC value to the BatteryStats base class and add a precision indicator variable. this is required to be set each time a derived class (a battery provider) wants to update the SoC value. the precision is then used when populating the JSON data for the web UI (live view).
related to #573.
implement subscription to battery voltage MQTT topic
this extends the MqttBattery implementation by an additional topic which allows to subscribe to receive battery voltage readings through the MQTT broker. similar to the battery SoC topic, this allows to import a critical battery data point for the DPL, in case the user chooses to use voltage thresholds rather than SoC thresholds to control the DPL. if an otherwise incompatible BMS is available which publishes the battery pack voltage through MQTT, this can now be used to feed accurate voltage readings to the DPL.
DPL: add switch allowing to ignore SoC
unfortunately, the battery SoC values reported by battery BMSs are unreliable, at least for some users, or at least without regular (manual) full charge cycles to calibrate the BMS. it offers great advantages to connect OpenDTU-OnBattery to a BMS (MQTT publishing of values, Home Assistent integration, etc.), but previously the users were then forced to configure the DPL by SoC values.
this change allows to configure the DPL such that SoC values are ignored. instead, the voltage limits are used to make DPL decisions, as if no SoC was available in the first place.
the SoC related setting are hidden from the DPL settings view if SoC values are configured to be ignored.
closes #654. supersedes #668. this is actually the same changeset as in #668, but since the other changes need this, it was included here and hence supersedes the previous PR.
Supporting Changes
replace BatteryStats::isValid() method
in the respective context, the DPL only needs to be sure that the SoC value is not outdated. it should not even care about other values reported by the battery interface. hence, the isValid() method shall be concerned with the SoC value timestamp only. the method is renamed for clarity.
BatteryStats: manage battery pack voltage in base class
the BatteryStats base class shall be able to tell the total battery pack voltage. for that reason, and to avoid code duplication, the voltage is now handled in the base class and treated as a datum that is common to all battery providers.