Merge pull request #679 from schlimmchen/dpl-voltage-features
DPL Voltage Features
This commit is contained in:
commit
1eb75c322d
@ -17,9 +17,12 @@ class BatteryStats {
|
||||
uint32_t getAgeSeconds() const { return (millis() - _lastUpdate) / 1000; }
|
||||
bool updateAvailable(uint32_t since) const { return _lastUpdate > since; }
|
||||
|
||||
uint8_t getSoC() const { return _SoC; }
|
||||
uint8_t getSoC() const { return _soc; }
|
||||
uint32_t getSoCAgeSeconds() const { return (millis() - _lastUpdateSoC) / 1000; }
|
||||
|
||||
float getVoltage() const { return _voltage; }
|
||||
uint32_t getVoltageAgeSeconds() const { return (millis() - _lastUpdateVoltage) / 1000; }
|
||||
|
||||
// convert stats to JSON for web application live view
|
||||
virtual void getLiveViewData(JsonVariant& root) const;
|
||||
|
||||
@ -29,18 +32,33 @@ class BatteryStats {
|
||||
// if they did not change. used to calculate Home Assistent expiration.
|
||||
virtual uint32_t getMqttFullPublishIntervalMs() const;
|
||||
|
||||
bool isValid() const { return _lastUpdateSoC > 0 && _lastUpdate > 0; }
|
||||
bool isSoCValid() const { return _lastUpdateSoC > 0; }
|
||||
bool isVoltageValid() const { return _lastUpdateVoltage > 0; }
|
||||
|
||||
protected:
|
||||
virtual void mqttPublish() const;
|
||||
|
||||
void setSoC(float soc, uint8_t precision, uint32_t timestamp) {
|
||||
_soc = soc;
|
||||
_socPrecision = precision;
|
||||
_lastUpdateSoC = timestamp;
|
||||
}
|
||||
|
||||
void setVoltage(float voltage, uint32_t timestamp) {
|
||||
_voltage = voltage;
|
||||
_lastUpdateVoltage = timestamp;
|
||||
}
|
||||
|
||||
String _manufacturer = "unknown";
|
||||
uint8_t _SoC = 0;
|
||||
uint32_t _lastUpdateSoC = 0;
|
||||
uint32_t _lastUpdate = 0;
|
||||
|
||||
private:
|
||||
uint32_t _lastMqttPublish = 0;
|
||||
float _soc = 0;
|
||||
uint8_t _socPrecision = 0; // decimal places
|
||||
uint32_t _lastUpdateSoC = 0;
|
||||
float _voltage = 0; // total battery pack voltage
|
||||
uint32_t _lastUpdateVoltage = 0;
|
||||
};
|
||||
|
||||
class PylontechBatteryStats : public BatteryStats {
|
||||
@ -52,14 +70,12 @@ class PylontechBatteryStats : public BatteryStats {
|
||||
|
||||
private:
|
||||
void setManufacturer(String&& m) { _manufacturer = std::move(m); }
|
||||
void setSoC(uint8_t SoC) { _SoC = SoC; _lastUpdateSoC = millis(); }
|
||||
void setLastUpdate(uint32_t ts) { _lastUpdate = ts; }
|
||||
|
||||
float _chargeVoltage;
|
||||
float _chargeCurrentLimitation;
|
||||
float _dischargeCurrentLimitation;
|
||||
uint16_t _stateOfHealth;
|
||||
float _voltage; // total voltage of the battery pack
|
||||
// total current into (positive) or from (negative)
|
||||
// the battery, i.e., the charging current
|
||||
float _current;
|
||||
@ -123,7 +139,6 @@ class VictronSmartShuntStats : public BatteryStats {
|
||||
void updateFrom(VeDirectShuntController::veShuntStruct const& shuntData);
|
||||
|
||||
private:
|
||||
float _voltage;
|
||||
float _current;
|
||||
float _temperature;
|
||||
bool _tempPresent;
|
||||
@ -141,14 +156,14 @@ class VictronSmartShuntStats : public BatteryStats {
|
||||
};
|
||||
|
||||
class MqttBatteryStats : public BatteryStats {
|
||||
friend class MqttBattery;
|
||||
|
||||
public:
|
||||
// since the source of information was MQTT in the first place,
|
||||
// we do NOT publish the same data under a different topic.
|
||||
void mqttPublish() const final { }
|
||||
|
||||
// the SoC is the only interesting value in this case, which is already
|
||||
// displayed at the top of the live view. do not generate a card.
|
||||
// if the voltage is subscribed to at all, it alone does not warrant a
|
||||
// card in the live view, since the SoC is already displayed at the top
|
||||
void getLiveViewData(JsonVariant& root) const final { }
|
||||
|
||||
void setSoC(uint8_t SoC) { _SoC = SoC; _lastUpdateSoC = _lastUpdate = millis(); }
|
||||
};
|
||||
|
||||
@ -213,6 +213,7 @@ struct CONFIG_T {
|
||||
int32_t TargetPowerConsumptionHysteresis;
|
||||
int32_t LowerPowerLimit;
|
||||
int32_t UpperPowerLimit;
|
||||
bool IgnoreSoc;
|
||||
uint32_t BatterySocStartThreshold;
|
||||
uint32_t BatterySocStopThreshold;
|
||||
float VoltageStartThreshold;
|
||||
@ -230,7 +231,8 @@ struct CONFIG_T {
|
||||
uint8_t Provider;
|
||||
uint8_t JkBmsInterface;
|
||||
uint8_t JkBmsPollingInterval;
|
||||
char MqttTopic[MQTT_MAX_TOPIC_STRLEN + 1];
|
||||
char MqttSocTopic[MQTT_MAX_TOPIC_STRLEN + 1];
|
||||
char MqttVoltageTopic[MQTT_MAX_TOPIC_STRLEN + 1];
|
||||
} Battery;
|
||||
|
||||
struct {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include "Battery.h"
|
||||
#include <espMqttClient.h>
|
||||
|
||||
@ -15,8 +16,12 @@ class MqttBattery : public BatteryProvider {
|
||||
private:
|
||||
bool _verboseLogging = false;
|
||||
String _socTopic;
|
||||
String _voltageTopic;
|
||||
std::shared_ptr<MqttBatteryStats> _stats = std::make_shared<MqttBatteryStats>();
|
||||
|
||||
void onMqttMessage(espMqttClientTypes::MessageProperties const& properties,
|
||||
std::optional<float> getFloat(std::string const& src, char const* topic);
|
||||
void onMqttMessageSoC(espMqttClientTypes::MessageProperties const& properties,
|
||||
char const* topic, uint8_t const* payload, size_t len, size_t index, size_t total);
|
||||
void onMqttMessageVoltage(espMqttClientTypes::MessageProperties const& properties,
|
||||
char const* topic, uint8_t const* payload, size_t len, size_t index, size_t total);
|
||||
};
|
||||
|
||||
@ -88,6 +88,7 @@ private:
|
||||
void announceStatus(Status status);
|
||||
bool shutdown(Status status);
|
||||
bool shutdown() { return shutdown(_lastStatus); }
|
||||
float getBatteryVoltage(bool log = false);
|
||||
int32_t inverterPowerDcToAc(std::shared_ptr<InverterAbstract> inverter, int32_t dcPower);
|
||||
void unconditionalSolarPassthrough(std::shared_ptr<InverterAbstract> inverter);
|
||||
bool canUseDirectSolarPower();
|
||||
|
||||
@ -35,6 +35,9 @@ public:
|
||||
// sum of today's yield of all MPPT charge controllers in kWh
|
||||
double getYieldDay() const;
|
||||
|
||||
// minimum of all MPPT charge controllers' output voltages in V
|
||||
double getOutputVoltage() const;
|
||||
|
||||
private:
|
||||
void loop();
|
||||
VictronMpptClass(VictronMpptClass const& other) = delete;
|
||||
|
||||
@ -128,6 +128,7 @@
|
||||
#define POWERLIMITER_TARGET_POWER_CONSUMPTION_HYSTERESIS 0
|
||||
#define POWERLIMITER_LOWER_POWER_LIMIT 10
|
||||
#define POWERLIMITER_UPPER_POWER_LIMIT 800
|
||||
#define POWERLIMITER_IGNORE_SOC false
|
||||
#define POWERLIMITER_BATTERY_SOC_START_THRESHOLD 80
|
||||
#define POWERLIMITER_BATTERY_SOC_STOP_THRESHOLD 20
|
||||
#define POWERLIMITER_VOLTAGE_START_THRESHOLD 50.0
|
||||
|
||||
@ -56,7 +56,8 @@ void BatteryStats::getLiveViewData(JsonVariant& root) const
|
||||
root[F("manufacturer")] = _manufacturer;
|
||||
root[F("data_age")] = getAgeSeconds();
|
||||
|
||||
addLiveViewValue(root, "SoC", _SoC, "%", 0);
|
||||
addLiveViewValue(root, "SoC", _soc, "%", _socPrecision);
|
||||
addLiveViewValue(root, "voltage", _voltage, "V", 2);
|
||||
}
|
||||
|
||||
void PylontechBatteryStats::getLiveViewData(JsonVariant& root) const
|
||||
@ -68,7 +69,6 @@ void PylontechBatteryStats::getLiveViewData(JsonVariant& root) const
|
||||
addLiveViewValue(root, "chargeCurrentLimitation", _chargeCurrentLimitation, "A", 1);
|
||||
addLiveViewValue(root, "dischargeCurrentLimitation", _dischargeCurrentLimitation, "A", 1);
|
||||
addLiveViewValue(root, "stateOfHealth", _stateOfHealth, "%", 0);
|
||||
addLiveViewValue(root, "voltage", _voltage, "V", 2);
|
||||
addLiveViewValue(root, "current", _current, "A", 1);
|
||||
addLiveViewValue(root, "temperature", _temperature, "°C", 1);
|
||||
|
||||
@ -105,18 +105,13 @@ void JkBmsBatteryStats::getJsonData(JsonVariant& root, bool verbose) const
|
||||
|
||||
using Label = JkBms::DataPointLabel;
|
||||
|
||||
auto oVoltage = _dataPoints.get<Label::BatteryVoltageMilliVolt>();
|
||||
if (oVoltage.has_value()) {
|
||||
addLiveViewValue(root, "voltage",
|
||||
static_cast<float>(*oVoltage) / 1000, "V", 2);
|
||||
}
|
||||
|
||||
auto oCurrent = _dataPoints.get<Label::BatteryCurrentMilliAmps>();
|
||||
if (oCurrent.has_value()) {
|
||||
addLiveViewValue(root, "current",
|
||||
static_cast<float>(*oCurrent) / 1000, "A", 2);
|
||||
}
|
||||
|
||||
auto oVoltage = _dataPoints.get<Label::BatteryVoltageMilliVolt>();
|
||||
if (oVoltage.has_value() && oCurrent.has_value()) {
|
||||
auto current = static_cast<float>(*oCurrent) / 1000;
|
||||
auto voltage = static_cast<float>(*oVoltage) / 1000;
|
||||
@ -217,7 +212,8 @@ void BatteryStats::mqttPublish() const
|
||||
{
|
||||
MqttSettings.publish(F("battery/manufacturer"), _manufacturer);
|
||||
MqttSettings.publish(F("battery/dataAge"), String(getAgeSeconds()));
|
||||
MqttSettings.publish(F("battery/stateOfCharge"), String(_SoC));
|
||||
MqttSettings.publish(F("battery/stateOfCharge"), String(_soc));
|
||||
MqttSettings.publish(F("battery/voltage"), String(_voltage));
|
||||
}
|
||||
|
||||
void PylontechBatteryStats::mqttPublish() const
|
||||
@ -228,7 +224,6 @@ void PylontechBatteryStats::mqttPublish() const
|
||||
MqttSettings.publish(F("battery/settings/chargeCurrentLimitation"), String(_chargeCurrentLimitation));
|
||||
MqttSettings.publish(F("battery/settings/dischargeCurrentLimitation"), String(_dischargeCurrentLimitation));
|
||||
MqttSettings.publish(F("battery/stateOfHealth"), String(_stateOfHealth));
|
||||
MqttSettings.publish(F("battery/voltage"), String(_voltage));
|
||||
MqttSettings.publish(F("battery/current"), String(_current));
|
||||
MqttSettings.publish(F("battery/temperature"), String(_temperature));
|
||||
MqttSettings.publish(F("battery/alarm/overCurrentDischarge"), String(_alarmOverCurrentDischarge));
|
||||
@ -260,6 +255,10 @@ void JkBmsBatteryStats::mqttPublish() const
|
||||
Label::CellsMilliVolt, // complex data format
|
||||
Label::ModificationPassword, // sensitive data
|
||||
Label::BatterySoCPercent // already published by base class
|
||||
// NOTE that voltage is also published by the base class, however, we
|
||||
// previously published it only from here using the respective topic.
|
||||
// to avoid a breaking change, we publish the value again using the
|
||||
// "old" topic.
|
||||
};
|
||||
|
||||
// regularly publish all topics regardless of whether or not their value changed
|
||||
@ -335,9 +334,16 @@ void JkBmsBatteryStats::updateFrom(JkBms::DataPointContainer const& dp)
|
||||
|
||||
auto oSoCValue = dp.get<Label::BatterySoCPercent>();
|
||||
if (oSoCValue.has_value()) {
|
||||
_SoC = *oSoCValue;
|
||||
auto oSoCDataPoint = dp.getDataPointFor<Label::BatterySoCPercent>();
|
||||
_lastUpdateSoC = oSoCDataPoint->getTimestamp();
|
||||
BatteryStats::setSoC(*oSoCValue, 0/*precision*/,
|
||||
oSoCDataPoint->getTimestamp());
|
||||
}
|
||||
|
||||
auto oVoltage = dp.get<Label::BatteryVoltageMilliVolt>();
|
||||
if (oVoltage.has_value()) {
|
||||
auto oVoltageDataPoint = dp.getDataPointFor<Label::BatteryVoltageMilliVolt>();
|
||||
BatteryStats::setVoltage(static_cast<float>(*oVoltage) / 1000,
|
||||
oVoltageDataPoint->getTimestamp());
|
||||
}
|
||||
|
||||
_dataPoints.updateFrom(dp);
|
||||
@ -360,8 +366,9 @@ void JkBmsBatteryStats::updateFrom(JkBms::DataPointContainer const& dp)
|
||||
}
|
||||
|
||||
void VictronSmartShuntStats::updateFrom(VeDirectShuntController::veShuntStruct const& shuntData) {
|
||||
_SoC = shuntData.SOC / 10;
|
||||
_voltage = shuntData.V;
|
||||
BatteryStats::setVoltage(shuntData.V, millis());
|
||||
BatteryStats::setSoC(static_cast<float>(shuntData.SOC) / 10, 1/*precision*/, millis());
|
||||
|
||||
_current = shuntData.I;
|
||||
_modelName = shuntData.getPidAsString().data();
|
||||
_chargeCycles = shuntData.H4;
|
||||
@ -380,14 +387,12 @@ void VictronSmartShuntStats::updateFrom(VeDirectShuntController::veShuntStruct c
|
||||
_alarmHighTemperature = shuntData.AR & 64;
|
||||
|
||||
_lastUpdate = VeDirectShunt.getLastUpdate();
|
||||
_lastUpdateSoC = VeDirectShunt.getLastUpdate();
|
||||
}
|
||||
|
||||
void VictronSmartShuntStats::getLiveViewData(JsonVariant& root) const {
|
||||
BatteryStats::getLiveViewData(root);
|
||||
|
||||
// values go into the "Status" card of the web application
|
||||
addLiveViewValue(root, "voltage", _voltage, "V", 2);
|
||||
addLiveViewValue(root, "current", _current, "A", 1);
|
||||
addLiveViewValue(root, "chargeCycles", _chargeCycles, "", 0);
|
||||
addLiveViewValue(root, "chargedEnergy", _chargedEnergy, "KWh", 1);
|
||||
@ -406,7 +411,6 @@ void VictronSmartShuntStats::getLiveViewData(JsonVariant& root) const {
|
||||
void VictronSmartShuntStats::mqttPublish() const {
|
||||
BatteryStats::mqttPublish();
|
||||
|
||||
MqttSettings.publish(F("battery/voltage"), String(_voltage));
|
||||
MqttSettings.publish(F("battery/current"), String(_current));
|
||||
MqttSettings.publish(F("battery/chargeCycles"), String(_chargeCycles));
|
||||
MqttSettings.publish(F("battery/chargedEnergy"), String(_chargedEnergy));
|
||||
|
||||
@ -191,6 +191,7 @@ bool ConfigurationClass::write()
|
||||
powerlimiter["target_power_consumption_hysteresis"] = config.PowerLimiter.TargetPowerConsumptionHysteresis;
|
||||
powerlimiter["lower_power_limit"] = config.PowerLimiter.LowerPowerLimit;
|
||||
powerlimiter["upper_power_limit"] = config.PowerLimiter.UpperPowerLimit;
|
||||
powerlimiter["ignore_soc"] = config.PowerLimiter.IgnoreSoc;
|
||||
powerlimiter["battery_soc_start_threshold"] = config.PowerLimiter.BatterySocStartThreshold;
|
||||
powerlimiter["battery_soc_stop_threshold"] = config.PowerLimiter.BatterySocStopThreshold;
|
||||
powerlimiter["voltage_start_threshold"] = config.PowerLimiter.VoltageStartThreshold;
|
||||
@ -207,7 +208,8 @@ bool ConfigurationClass::write()
|
||||
battery["provider"] = config.Battery.Provider;
|
||||
battery["jkbms_interface"] = config.Battery.JkBmsInterface;
|
||||
battery["jkbms_polling_interval"] = config.Battery.JkBmsPollingInterval;
|
||||
battery["mqtt_topic"] = config.Battery.MqttTopic;
|
||||
battery["mqtt_topic"] = config.Battery.MqttSocTopic;
|
||||
battery["mqtt_voltage_topic"] = config.Battery.MqttVoltageTopic;
|
||||
|
||||
JsonObject huawei = doc.createNestedObject("huawei");
|
||||
huawei["enabled"] = config.Huawei.Enabled;
|
||||
@ -435,6 +437,7 @@ bool ConfigurationClass::read()
|
||||
config.PowerLimiter.TargetPowerConsumptionHysteresis = powerlimiter["target_power_consumption_hysteresis"] | POWERLIMITER_TARGET_POWER_CONSUMPTION_HYSTERESIS;
|
||||
config.PowerLimiter.LowerPowerLimit = powerlimiter["lower_power_limit"] | POWERLIMITER_LOWER_POWER_LIMIT;
|
||||
config.PowerLimiter.UpperPowerLimit = powerlimiter["upper_power_limit"] | POWERLIMITER_UPPER_POWER_LIMIT;
|
||||
config.PowerLimiter.IgnoreSoc = powerlimiter["ignore_soc"] | POWERLIMITER_IGNORE_SOC;
|
||||
config.PowerLimiter.BatterySocStartThreshold = powerlimiter["battery_soc_start_threshold"] | POWERLIMITER_BATTERY_SOC_START_THRESHOLD;
|
||||
config.PowerLimiter.BatterySocStopThreshold = powerlimiter["battery_soc_stop_threshold"] | POWERLIMITER_BATTERY_SOC_STOP_THRESHOLD;
|
||||
config.PowerLimiter.VoltageStartThreshold = powerlimiter["voltage_start_threshold"] | POWERLIMITER_VOLTAGE_START_THRESHOLD;
|
||||
@ -451,7 +454,8 @@ bool ConfigurationClass::read()
|
||||
config.Battery.Provider = battery["provider"] | BATTERY_PROVIDER;
|
||||
config.Battery.JkBmsInterface = battery["jkbms_interface"] | BATTERY_JKBMS_INTERFACE;
|
||||
config.Battery.JkBmsPollingInterval = battery["jkbms_polling_interval"] | BATTERY_JKBMS_POLLING_INTERVAL;
|
||||
strlcpy(config.Battery.MqttTopic, battery["mqtt_topic"] | "", sizeof(config.Battery.MqttTopic));
|
||||
strlcpy(config.Battery.MqttSocTopic, battery["mqtt_topic"] | "", sizeof(config.Battery.MqttSocTopic));
|
||||
strlcpy(config.Battery.MqttVoltageTopic, battery["mqtt_voltage_topic"] | "", sizeof(config.Battery.MqttVoltageTopic));
|
||||
|
||||
JsonObject huawei = doc["huawei"];
|
||||
config.Huawei.Enabled = huawei["enabled"] | HUAWEI_ENABLED;
|
||||
|
||||
@ -10,20 +10,35 @@ bool MqttBattery::init(bool verboseLogging)
|
||||
_verboseLogging = verboseLogging;
|
||||
|
||||
auto const& config = Configuration.get();
|
||||
_socTopic = config.Battery.MqttTopic;
|
||||
|
||||
if (_socTopic.isEmpty()) { return false; }
|
||||
_socTopic = config.Battery.MqttSocTopic;
|
||||
if (!_socTopic.isEmpty()) {
|
||||
MqttSettings.subscribe(_socTopic, 0/*QoS*/,
|
||||
std::bind(&MqttBattery::onMqttMessageSoC,
|
||||
this, std::placeholders::_1, std::placeholders::_2,
|
||||
std::placeholders::_3, std::placeholders::_4,
|
||||
std::placeholders::_5, std::placeholders::_6)
|
||||
);
|
||||
|
||||
MqttSettings.subscribe(_socTopic, 0/*QoS*/,
|
||||
std::bind(&MqttBattery::onMqttMessage,
|
||||
this, std::placeholders::_1, std::placeholders::_2,
|
||||
std::placeholders::_3, std::placeholders::_4,
|
||||
std::placeholders::_5, std::placeholders::_6)
|
||||
);
|
||||
if (_verboseLogging) {
|
||||
MessageOutput.printf("MqttBattery: Subscribed to '%s' for SoC readings\r\n",
|
||||
_socTopic.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
if (_verboseLogging) {
|
||||
MessageOutput.printf("MqttBattery: Subscribed to '%s'\r\n",
|
||||
_socTopic.c_str());
|
||||
_voltageTopic = config.Battery.MqttVoltageTopic;
|
||||
if (!_voltageTopic.isEmpty()) {
|
||||
MqttSettings.subscribe(_voltageTopic, 0/*QoS*/,
|
||||
std::bind(&MqttBattery::onMqttMessageVoltage,
|
||||
this, std::placeholders::_1, std::placeholders::_2,
|
||||
std::placeholders::_3, std::placeholders::_4,
|
||||
std::placeholders::_5, std::placeholders::_6)
|
||||
);
|
||||
|
||||
if (_verboseLogging) {
|
||||
MessageOutput.printf("MqttBattery: Subscribed to '%s' for voltage readings\r\n",
|
||||
_voltageTopic.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -31,35 +46,69 @@ bool MqttBattery::init(bool verboseLogging)
|
||||
|
||||
void MqttBattery::deinit()
|
||||
{
|
||||
if (_socTopic.isEmpty()) { return; }
|
||||
MqttSettings.unsubscribe(_socTopic);
|
||||
if (!_voltageTopic.isEmpty()) {
|
||||
MqttSettings.unsubscribe(_voltageTopic);
|
||||
}
|
||||
|
||||
if (!_socTopic.isEmpty()) {
|
||||
MqttSettings.unsubscribe(_socTopic);
|
||||
}
|
||||
}
|
||||
|
||||
void MqttBattery::onMqttMessage(espMqttClientTypes::MessageProperties const& properties,
|
||||
char const* topic, uint8_t const* payload, size_t len, size_t index, size_t total)
|
||||
{
|
||||
float soc = 0;
|
||||
std::string value(reinterpret_cast<const char*>(payload), len);
|
||||
std::optional<float> MqttBattery::getFloat(std::string const& src, char const* topic) {
|
||||
float res = 0;
|
||||
|
||||
try {
|
||||
soc = std::stof(value);
|
||||
res = std::stof(src);
|
||||
}
|
||||
catch(std::invalid_argument const& e) {
|
||||
MessageOutput.printf("MqttBattery: Cannot parse payload '%s' in topic '%s' as float\r\n",
|
||||
value.c_str(), topic);
|
||||
return;
|
||||
src.c_str(), topic);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (soc < 0 || soc > 100) {
|
||||
return res;
|
||||
}
|
||||
|
||||
void MqttBattery::onMqttMessageSoC(espMqttClientTypes::MessageProperties const& properties,
|
||||
char const* topic, uint8_t const* payload, size_t len, size_t index, size_t total)
|
||||
{
|
||||
auto soc = getFloat(std::string(reinterpret_cast<const char*>(payload), len), topic);
|
||||
if (!soc.has_value()) { return; }
|
||||
|
||||
if (*soc < 0 || *soc > 100) {
|
||||
MessageOutput.printf("MqttBattery: Implausible SoC '%.2f' in topic '%s'\r\n",
|
||||
soc, topic);
|
||||
*soc, topic);
|
||||
return;
|
||||
}
|
||||
|
||||
_stats->setSoC(static_cast<uint8_t>(soc));
|
||||
_stats->setSoC(*soc, 0/*precision*/, millis());
|
||||
|
||||
if (_verboseLogging) {
|
||||
MessageOutput.printf("MqttBattery: Updated SoC to %d from '%s'\r\n",
|
||||
static_cast<uint8_t>(soc), topic);
|
||||
static_cast<uint8_t>(*soc), topic);
|
||||
}
|
||||
}
|
||||
|
||||
void MqttBattery::onMqttMessageVoltage(espMqttClientTypes::MessageProperties const& properties,
|
||||
char const* topic, uint8_t const* payload, size_t len, size_t index, size_t total)
|
||||
{
|
||||
auto voltage = getFloat(std::string(reinterpret_cast<const char*>(payload), len), topic);
|
||||
if (!voltage.has_value()) { return; }
|
||||
|
||||
// since this project is revolving around Hoymiles microinverters, which can
|
||||
// only handle up to 65V of input voltage at best, it is safe to assume that
|
||||
// an even higher voltage is implausible.
|
||||
if (*voltage < 0 || *voltage > 65) {
|
||||
MessageOutput.printf("MqttBattery: Implausible voltage '%.2f' in topic '%s'\r\n",
|
||||
*voltage, topic);
|
||||
return;
|
||||
}
|
||||
|
||||
_stats->setVoltage(*voltage, millis());
|
||||
|
||||
if (_verboseLogging) {
|
||||
MessageOutput.printf("MqttBattery: Updated voltage to %.2f from '%s'\r\n",
|
||||
*voltage, topic);
|
||||
}
|
||||
}
|
||||
|
||||
@ -290,14 +290,15 @@ void PowerLimiterClass::loop()
|
||||
}
|
||||
|
||||
if (_verboseLogging) {
|
||||
MessageOutput.printf("[DPL::loop] battery interface %s, SoC: %d %%, StartTH: %d %%, StopTH: %d %%, SoC age: %d s\r\n",
|
||||
MessageOutput.printf("[DPL::loop] battery interface %s, SoC: %d %%, StartTH: %d %%, StopTH: %d %%, SoC age: %d s, ignore: %s\r\n",
|
||||
(config.Battery.Enabled?"enabled":"disabled"),
|
||||
Battery.getStats()->getSoC(),
|
||||
config.PowerLimiter.BatterySocStartThreshold,
|
||||
config.PowerLimiter.BatterySocStopThreshold,
|
||||
Battery.getStats()->getSoCAgeSeconds());
|
||||
Battery.getStats()->getSoCAgeSeconds(),
|
||||
(config.PowerLimiter.IgnoreSoc?"yes":"no"));
|
||||
|
||||
float dcVoltage = _inverter->Statistics()->getChannelFieldValue(TYPE_DC, (ChannelNum_t)config.PowerLimiter.InverterChannelId, FLD_UDC);
|
||||
auto dcVoltage = getBatteryVoltage(true/*log voltages only once per DPL loop*/);
|
||||
MessageOutput.printf("[DPL::loop] dcVoltage: %.2f V, loadCorrectedVoltage: %.2f V, StartTH: %.2f V, StopTH: %.2f V\r\n",
|
||||
dcVoltage, getLoadCorrectedVoltage(),
|
||||
config.PowerLimiter.VoltageStartThreshold,
|
||||
@ -339,6 +340,46 @@ void PowerLimiterClass::loop()
|
||||
_calculationBackoffMs = _calculationBackoffMsDefault;
|
||||
}
|
||||
|
||||
/**
|
||||
* determines the battery's voltage, trying multiple data providers. the most
|
||||
* accurate data is expected to be delivered by a BMS, if it's available. more
|
||||
* accurate and more recent than the inverter's voltage reading is the volage
|
||||
* at the charge controller's output, if it's available. only as a fallback
|
||||
* the voltage reported by the inverter is used.
|
||||
*/
|
||||
float PowerLimiterClass::getBatteryVoltage(bool log) {
|
||||
if (!_inverter) {
|
||||
// there should be no need to call this method if no target inverter is known
|
||||
MessageOutput.println("DPL getBatteryVoltage: no inverter (programmer error)");
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
auto const& config = Configuration.get();
|
||||
auto channel = static_cast<ChannelNum_t>(config.PowerLimiter.InverterChannelId);
|
||||
float inverterVoltage = _inverter->Statistics()->getChannelFieldValue(TYPE_DC, channel, FLD_UDC);
|
||||
float res = inverterVoltage;
|
||||
|
||||
float chargeControllerVoltage = -1;
|
||||
if (VictronMppt.isDataValid()) {
|
||||
res = chargeControllerVoltage = static_cast<float>(VictronMppt.getOutputVoltage());
|
||||
}
|
||||
|
||||
float bmsVoltage = -1;
|
||||
auto stats = Battery.getStats();
|
||||
if (config.Battery.Enabled
|
||||
&& stats->isVoltageValid()
|
||||
&& stats->getVoltageAgeSeconds() < 60) {
|
||||
res = bmsVoltage = stats->getVoltage();
|
||||
}
|
||||
|
||||
if (log) {
|
||||
MessageOutput.printf("[DPL::getBatteryVoltage] BMS: %.2f V, MPPT: %.2f V, inverter: %.2f V, returning: %.2fV\r\n",
|
||||
bmsVoltage, chargeControllerVoltage, inverterVoltage, res);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* calculate the AC output power (limit) to set, such that the inverter uses
|
||||
* the given power on its DC side, i.e., adjust the power for the inverter's
|
||||
@ -592,9 +633,8 @@ float PowerLimiterClass::getLoadCorrectedVoltage()
|
||||
|
||||
CONFIG_T& config = Configuration.get();
|
||||
|
||||
auto channel = static_cast<ChannelNum_t>(config.PowerLimiter.InverterChannelId);
|
||||
float acPower = _inverter->Statistics()->getChannelFieldValue(TYPE_AC, CH0, FLD_PAC);
|
||||
float dcVoltage = _inverter->Statistics()->getChannelFieldValue(TYPE_DC, channel, FLD_UDC);
|
||||
float dcVoltage = getBatteryVoltage();
|
||||
|
||||
if (dcVoltage <= 0.0) {
|
||||
return 0.0;
|
||||
@ -608,11 +648,14 @@ bool PowerLimiterClass::testThreshold(float socThreshold, float voltThreshold,
|
||||
{
|
||||
CONFIG_T& config = Configuration.get();
|
||||
|
||||
// prefer SoC provided through battery interface
|
||||
if (config.Battery.Enabled && socThreshold > 0.0
|
||||
&& Battery.getStats()->isValid()
|
||||
&& Battery.getStats()->getSoCAgeSeconds() < 60) {
|
||||
return compare(Battery.getStats()->getSoC(), socThreshold);
|
||||
// prefer SoC provided through battery interface, unless disabled by user
|
||||
auto stats = Battery.getStats();
|
||||
if (!config.PowerLimiter.IgnoreSoc
|
||||
&& config.Battery.Enabled
|
||||
&& socThreshold > 0.0
|
||||
&& stats->isSoCValid()
|
||||
&& stats->getSoCAgeSeconds() < 60) {
|
||||
return compare(stats->getSoC(), socThreshold);
|
||||
}
|
||||
|
||||
// use voltage threshold as fallback
|
||||
|
||||
@ -136,7 +136,7 @@ void PylontechCanReceiver::loop()
|
||||
}
|
||||
|
||||
case 0x355: {
|
||||
_stats->setSoC(static_cast<uint8_t>(this->readUnsignedInt16(rx_message.data)));
|
||||
_stats->setSoC(static_cast<uint8_t>(this->readUnsignedInt16(rx_message.data)), 0/*precision*/, millis());
|
||||
_stats->_stateOfHealth = this->readUnsignedInt16(rx_message.data + 2);
|
||||
|
||||
if (_verboseLogging) {
|
||||
@ -147,13 +147,13 @@ void PylontechCanReceiver::loop()
|
||||
}
|
||||
|
||||
case 0x356: {
|
||||
_stats->_voltage = this->scaleValue(this->readSignedInt16(rx_message.data), 0.01);
|
||||
_stats->setVoltage(this->scaleValue(this->readSignedInt16(rx_message.data), 0.01), millis());
|
||||
_stats->_current = this->scaleValue(this->readSignedInt16(rx_message.data + 2), 0.1);
|
||||
_stats->_temperature = this->scaleValue(this->readSignedInt16(rx_message.data + 4), 0.1);
|
||||
|
||||
if (_verboseLogging) {
|
||||
MessageOutput.printf("[Pylontech] voltage: %f current: %f temperature: %f\n",
|
||||
_stats->_voltage, _stats->_current, _stats->_temperature);
|
||||
_stats->getVoltage(), _stats->_current, _stats->_temperature);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -282,12 +282,12 @@ void PylontechCanReceiver::dummyData()
|
||||
};
|
||||
|
||||
_stats->setManufacturer("Pylontech US3000C");
|
||||
_stats->setSoC(42);
|
||||
_stats->setSoC(42, 0/*precision*/, millis());
|
||||
_stats->_chargeVoltage = dummyFloat(50);
|
||||
_stats->_chargeCurrentLimitation = dummyFloat(33);
|
||||
_stats->_dischargeCurrentLimitation = dummyFloat(12);
|
||||
_stats->_stateOfHealth = 99;
|
||||
_stats->_voltage = 48.67;
|
||||
_stats->setVoltage(48.67, millis());
|
||||
_stats->_current = dummyFloat(-1);
|
||||
_stats->_temperature = dummyFloat(20);
|
||||
|
||||
|
||||
@ -137,3 +137,16 @@ double VictronMpptClass::getYieldDay() const
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
double VictronMpptClass::getOutputVoltage() const
|
||||
{
|
||||
double min = -1;
|
||||
|
||||
for (const auto& upController : _controllers) {
|
||||
double volts = upController->getData()->V;
|
||||
if (min == -1) { min = volts; }
|
||||
min = std::min(min, volts);
|
||||
}
|
||||
|
||||
return min;
|
||||
}
|
||||
|
||||
@ -39,7 +39,8 @@ void WebApiBatteryClass::onStatus(AsyncWebServerRequest* request)
|
||||
root["provider"] = config.Battery.Provider;
|
||||
root["jkbms_interface"] = config.Battery.JkBmsInterface;
|
||||
root["jkbms_polling_interval"] = config.Battery.JkBmsPollingInterval;
|
||||
root["mqtt_topic"] = config.Battery.MqttTopic;
|
||||
root["mqtt_soc_topic"] = config.Battery.MqttSocTopic;
|
||||
root["mqtt_voltage_topic"] = config.Battery.MqttVoltageTopic;
|
||||
|
||||
response->setLength();
|
||||
request->send(response);
|
||||
@ -103,8 +104,9 @@ void WebApiBatteryClass::onAdminPost(AsyncWebServerRequest* request)
|
||||
config.Battery.Provider = root["provider"].as<uint8_t>();
|
||||
config.Battery.JkBmsInterface = root["jkbms_interface"].as<uint8_t>();
|
||||
config.Battery.JkBmsPollingInterval = root["jkbms_polling_interval"].as<uint8_t>();
|
||||
strlcpy(config.Battery.MqttTopic, root["mqtt_topic"].as<String>().c_str(), sizeof(config.Battery.MqttTopic));
|
||||
|
||||
strlcpy(config.Battery.MqttSocTopic, root["mqtt_soc_topic"].as<String>().c_str(), sizeof(config.Battery.MqttSocTopic));
|
||||
strlcpy(config.Battery.MqttVoltageTopic, root["mqtt_voltage_topic"].as<String>().c_str(), sizeof(config.Battery.MqttVoltageTopic));
|
||||
|
||||
WebApi.writeConfig(retMsg);
|
||||
|
||||
response->setLength();
|
||||
|
||||
@ -45,6 +45,7 @@ void WebApiPowerLimiterClass::onStatus(AsyncWebServerRequest* request)
|
||||
root["target_power_consumption_hysteresis"] = config.PowerLimiter.TargetPowerConsumptionHysteresis;
|
||||
root["lower_power_limit"] = config.PowerLimiter.LowerPowerLimit;
|
||||
root["upper_power_limit"] = config.PowerLimiter.UpperPowerLimit;
|
||||
root["ignore_soc"] = config.PowerLimiter.IgnoreSoc;
|
||||
root["battery_soc_start_threshold"] = config.PowerLimiter.BatterySocStartThreshold;
|
||||
root["battery_soc_stop_threshold"] = config.PowerLimiter.BatterySocStopThreshold;
|
||||
root["voltage_start_threshold"] = static_cast<int>(config.PowerLimiter.VoltageStartThreshold * 100 +0.5) / 100.0;
|
||||
@ -133,6 +134,7 @@ void WebApiPowerLimiterClass::onAdminPost(AsyncWebServerRequest* request)
|
||||
config.PowerLimiter.TargetPowerConsumptionHysteresis = root["target_power_consumption_hysteresis"].as<int32_t>();
|
||||
config.PowerLimiter.LowerPowerLimit = root["lower_power_limit"].as<int32_t>();
|
||||
config.PowerLimiter.UpperPowerLimit = root["upper_power_limit"].as<int32_t>();
|
||||
config.PowerLimiter.IgnoreSoc = root["ignore_soc"].as<bool>();
|
||||
config.PowerLimiter.BatterySocStartThreshold = root["battery_soc_start_threshold"].as<uint32_t>();
|
||||
config.PowerLimiter.BatterySocStopThreshold = root["battery_soc_stop_threshold"].as<uint32_t>();
|
||||
config.PowerLimiter.VoltageStartThreshold = root["voltage_start_threshold"].as<float>();
|
||||
|
||||
@ -595,17 +595,18 @@
|
||||
"LowerPowerLimit": "Unteres Leistungslimit",
|
||||
"UpperPowerLimit": "Oberes Leistungslimit",
|
||||
"PowerMeters": "Leistungsmesser",
|
||||
"IgnoreSoc": "Batterie SoC ignorieren",
|
||||
"BatterySocStartThreshold": "Akku SoC - Start",
|
||||
"BatterySocStopThreshold": "Akku SoC - Stop",
|
||||
"BatterySocSolarPassthroughStartThreshold": "Akku SoC - Start solar passthrough",
|
||||
"BatterySocSolarPassthroughStartThresholdHint": "Wenn der Batterie SOC über diesem Limit ist wird die Inverter Leistung entsprechend der Victron MPPT Leistung gesetzt (abzüglich Effizienzkorrekturfaktor). Kann verwendet werden um überschüssige Solarleistung an das Netz zu liefern wenn die Batterie voll ist.",
|
||||
"BatterySocSolarPassthroughStartThresholdHint": "Wenn der Batterie SoC über diesem Limit ist wird die Inverter Leistung entsprechend der Victron MPPT Leistung gesetzt (abzüglich Effizienzkorrekturfaktor). Kann verwendet werden um überschüssige Solarleistung an das Netz zu liefern wenn die Batterie voll ist.",
|
||||
"VoltageStartThreshold": "DC Spannung - Start",
|
||||
"VoltageStopThreshold": "DC Spannung - Stop",
|
||||
"VoltageSolarPassthroughStartThreshold": "DC Spannung - Start Solar-Passthrough",
|
||||
"VoltageSolarPassthroughStopThreshold": "DC Spannung - Stop Solar-Passthrough",
|
||||
"VoltageSolarPassthroughStartThresholdHint": "Wenn der Batteriespannung über diesem Limit ist wird die Inverter Leistung entsprechend der Victron MPPT Leistung gesetzt (abzüglich Effizienzkorrekturfaktor). Kann verwendet werden um überschüssige Solarleistung an das Netz zu liefern wenn die Batterie voll ist. Dieser Mode wird aktiv wenn das Start Spannungslimit überschritten wird und inaktiv wenn das Stop Spannungslimit unterschritten wird.",
|
||||
"VoltageLoadCorrectionFactor": "DC Spannung - Lastkorrekturfaktor",
|
||||
"BatterySocInfo": "<b>Hinweis:</b> Die Akku SoC (State of Charge) Werte können nur benutzt werden, wenn die Batterie-Kommunikationsschnittstelle aktiviert ist. Wenn die Batterie innerhalb der letzten Minute keine Werte geschickt hat, werden als Fallback-Option die Spannungseinstellungen verwendet.",
|
||||
"BatterySocInfo": "<b>Hinweis:</b> Die Akku SoC (State of Charge) Werte werden nur benutzt, wenn die Batterie-Kommunikationsschnittstelle innerhalb der letzten Minute gültige Werte geschickt hat. Andernfalls werden als Fallback-Option die Spannungseinstellungen verwendet.",
|
||||
"InverterIsBehindPowerMeter": "Welchselrichter ist hinter Leistungsmesser",
|
||||
"Battery": "DC / Akku",
|
||||
"VoltageLoadCorrectionInfo": "<b>Hinweis:</b> Wenn Leistung von der Batterie abgegeben wird, bricht normalerweise die Spannung etwas ein. Damit nicht vorzeitig der Wechelrichter ausgeschaltet wird sobald der \"Stop\"-Schwellenwert erreicht wird, wird der hier angegebene Korrekturfaktor mit einberechnet. Korrigierte Spannung = DC Spannung + (Aktuelle Leistung (W) * Korrekturfaktor).",
|
||||
@ -621,10 +622,11 @@
|
||||
"Provider": "Datenanbieter",
|
||||
"ProviderPylontechCan": "Pylontech per CAN-Bus",
|
||||
"ProviderJkBmsSerial": "Jikong (JK) BMS per serieller Verbindung",
|
||||
"ProviderMqtt": "State of Charge (SoC) Wert aus MQTT Broker",
|
||||
"ProviderMqtt": "Batteriewerte aus MQTT Broker",
|
||||
"ProviderVictron": "Victron SmartShunt per VE.Direct Schnittstelle",
|
||||
"MqttConfiguration": "MQTT Einstellungen",
|
||||
"MqttTopic": "SoC-Wert Topic",
|
||||
"MqttSocTopic": "Topic für Batterie-SoC",
|
||||
"MqttVoltageTopic": "Topic für Batteriespannung",
|
||||
"JkBmsConfiguration": "JK BMS Einstellungen",
|
||||
"JkBmsInterface": "Schnittstellentyp",
|
||||
"JkBmsInterfaceUart": "TTL-UART an der MCU",
|
||||
|
||||
@ -601,9 +601,7 @@
|
||||
"LowerPowerLimit": "Lower power limit",
|
||||
"UpperPowerLimit": "Upper power limit",
|
||||
"PowerMeters": "Power meter",
|
||||
"MqttTopicPowerMeter1": "MQTT topic - Power meter #1",
|
||||
"MqttTopicPowerMeter2": "MQTT topic - Power meter #2 (optional)",
|
||||
"MqttTopicPowerMeter3": "MQTT topic - Power meter #3 (optional)",
|
||||
"IgnoreSoc": "Ignore Battery SoC",
|
||||
"BatterySocStartThreshold": "Battery SoC - Start threshold",
|
||||
"BatterySocStopThreshold": "Battery SoC - Stop threshold",
|
||||
"BatterySocSolarPassthroughStartThreshold": "Battery SoC - Start threshold for full solar passthrough",
|
||||
@ -614,7 +612,7 @@
|
||||
"VoltageSolarPassthroughStopThreshold": "DC Voltage - Stop threshold for full solar passthrough",
|
||||
"VoltageSolarPassthroughStartThresholdHint": "Inverter power is set according to Victron MPPT power (minus efficiency factors) when full solar passthrough is active. Use this if you like to supply excess power to the grid when battery is full. This is started when battery voltage goes over this limit and stopped if voltage drops below stop limit.",
|
||||
"VoltageLoadCorrectionFactor": "DC Voltage - Load correction factor",
|
||||
"BatterySocInfo": "<b>Hint:</b> The battery SoC (State of Charge) values can only be used if the battery communication interface is enabled. If the battery has not reported any SoC updates in the last minute, the voltage thresholds will be used as fallback.",
|
||||
"BatterySocInfo": "<b>Hint:</b> The battery SoC (State of Charge) values are only used if the battery communication interface reported SoC updates in the last minute. Otherwise the voltage thresholds will be used as fallback.",
|
||||
"InverterIsBehindPowerMeter": "Inverter is behind Power meter",
|
||||
"Battery": "DC / Battery",
|
||||
"VoltageLoadCorrectionInfo": "<b>Hint:</b> When the power output is higher, the voltage is usually decreasing. In order to not stop the inverter too early (Stop treshold), a power factor can be specified here to correct this. Corrected voltage = DC Voltage + (Current power * correction factor).",
|
||||
@ -630,10 +628,11 @@
|
||||
"Provider": "Data Provider",
|
||||
"ProviderPylontechCan": "Pylontech using CAN bus",
|
||||
"ProviderJkBmsSerial": "Jikong (JK) BMS using serial connection",
|
||||
"ProviderMqtt": "State of Charge (SoC) value from MQTT broker",
|
||||
"ProviderMqtt": "Battery data from MQTT broker",
|
||||
"ProviderVictron": "Victron SmartShunt using VE.Direct interface",
|
||||
"MqttConfiguration": "MQTT Settings",
|
||||
"MqttTopic": "SoC value topic",
|
||||
"MqttSocTopic": "SoC value topic",
|
||||
"MqttVoltageTopic": "Voltage value topic",
|
||||
"JkBmsConfiguration": "JK BMS Settings",
|
||||
"JkBmsInterface": "Interface Type",
|
||||
"JkBmsInterfaceUart": "TTL-UART on MCU",
|
||||
|
||||
@ -546,10 +546,11 @@
|
||||
"Provider": "Data Provider",
|
||||
"ProviderPylontechCan": "Pylontech using CAN bus",
|
||||
"ProviderJkBmsSerial": "Jikong (JK) BMS using serial connection",
|
||||
"ProviderMqtt": "State of Charge (SoC) value from MQTT broker",
|
||||
"ProviderMqtt": "Battery data from MQTT broker",
|
||||
"ProviderVictron": "Victron SmartShunt using VE.Direct interface",
|
||||
"MqttConfiguration": "MQTT Settings",
|
||||
"MqttTopic": "SoC value topic",
|
||||
"MqttSocTopic": "SoC value topic",
|
||||
"MqttVoltageTopic": "Voltage value topic",
|
||||
"JkBmsConfiguration": "JK BMS Settings",
|
||||
"JkBmsInterface": "Interface Type",
|
||||
"JkBmsInterfaceUart": "TTL-UART on MCU",
|
||||
@ -648,9 +649,7 @@
|
||||
"LowerPowerLimit": "Lower power limit",
|
||||
"UpperPowerLimit": "Upper power limit",
|
||||
"PowerMeters": "Power meter",
|
||||
"MqttTopicPowerMeter1": "MQTT topic - Power meter #1",
|
||||
"MqttTopicPowerMeter2": "MQTT topic - Power meter #2 (optional)",
|
||||
"MqttTopicPowerMeter3": "MQTT topic - Power meter #3 (optional)",
|
||||
"IgnoreSoc": "Ignore Battery SoC",
|
||||
"BatterySocStartThreshold": "Battery SoC - Start threshold",
|
||||
"BatterySocStopThreshold": "Battery SoC - Stop threshold",
|
||||
"BatterySocSolarPassthroughStartThreshold": "Battery SoC - Start threshold for full solar passthrough",
|
||||
@ -661,7 +660,7 @@
|
||||
"VoltageSolarPassthroughStopThreshold": "DC Voltage - Stop threshold for full solar passthrough",
|
||||
"VoltageSolarPassthroughStartThresholdHint": "Inverter power is set according to Victron MPPT power (minus efficiency factors) when full solar passthrough is active. Use this if you like to supply excess power to the grid when battery is full. This is started when battery voltage goes over this limit and stopped if voltage drops below stop limit.",
|
||||
"VoltageLoadCorrectionFactor": "DC Voltage - Load correction factor",
|
||||
"BatterySocInfo": "<b>Hint:</b> The battery SoC (State of Charge) values can only be used if the battery communication interface is enabled. If the battery has not reported any SoC updates in the last minute, the voltage thresholds will be used as fallback.",
|
||||
"BatterySocInfo": "<b>Hint:</b> The battery SoC (State of Charge) values are only used if the battery communication interface reported SoC updates in the last minute. Otherwise the voltage thresholds will be used as fallback.",
|
||||
"InverterIsBehindPowerMeter": "Inverter is behind Power meter",
|
||||
"Battery": "DC / Battery",
|
||||
"VoltageLoadCorrectionInfo": "<b>Hint:</b> When the power output is higher, the voltage is usually decreasing. In order to not stop the inverter too early (Stop treshold), a power factor can be specified here to correct this. Corrected voltage = DC Voltage + (Current power * correction factor)."
|
||||
|
||||
@ -4,5 +4,6 @@ export interface BatteryConfig {
|
||||
provider: number;
|
||||
jkbms_interface: number;
|
||||
jkbms_polling_interval: number;
|
||||
mqtt_topic: string;
|
||||
mqtt_soc_topic: string;
|
||||
mqtt_voltage_topic: string;
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ export interface PowerLimiterConfig {
|
||||
target_power_consumption_hysteresis: number;
|
||||
lower_power_limit: number;
|
||||
upper_power_limit: number;
|
||||
ignore_soc: boolean;
|
||||
battery_soc_start_threshold: number;
|
||||
battery_soc_stop_threshold: number;
|
||||
voltage_start_threshold: number;
|
||||
|
||||
@ -53,11 +53,21 @@
|
||||
:text="$t('batteryadmin.MqttConfiguration')" textVariant="text-bg-primary" addSpace>
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label">
|
||||
{{ $t('batteryadmin.MqttTopic') }}
|
||||
{{ $t('batteryadmin.MqttSocTopic') }}
|
||||
</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" v-model="batteryConfigList.mqtt_topic" />
|
||||
<input type="text" class="form-control" v-model="batteryConfigList.mqtt_soc_topic" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label">
|
||||
{{ $t('batteryadmin.MqttVoltageTopic') }}
|
||||
</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" v-model="batteryConfigList.mqtt_voltage_topic" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -142,7 +142,12 @@
|
||||
<CardElement :text="$t('powerlimiteradmin.Battery')" textVariant="text-bg-primary" add-space
|
||||
v-show="powerLimiterConfigList.enabled"
|
||||
>
|
||||
<div class="row mb-3">
|
||||
<InputElement
|
||||
:label="$t('powerlimiteradmin.IgnoreSoc')"
|
||||
v-model="powerLimiterConfigList.ignore_soc"
|
||||
type="checkbox"/>
|
||||
|
||||
<div class="row mb-3" v-show="!powerLimiterConfigList.ignore_soc">
|
||||
<label for="batterySocStartThreshold" class="col-sm-2 col-form-label">{{ $t('powerlimiteradmin.BatterySocStartThreshold') }}:</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="input-group">
|
||||
@ -154,7 +159,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="row mb-3" v-show="!powerLimiterConfigList.ignore_soc">
|
||||
<label for="batterySocStopThreshold" class="col-sm-2 col-form-label">{{ $t('powerlimiteradmin.BatterySocStopThreshold') }}</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="input-group">
|
||||
@ -166,7 +171,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3" v-show="powerLimiterConfigList.solar_passthrough_enabled">
|
||||
<div class="row mb-3" v-show="powerLimiterConfigList.solar_passthrough_enabled && !powerLimiterConfigList.ignore_soc">
|
||||
<label for="batterySocSolarPassthroughStartThreshold" class="col-sm-2 col-form-label">{{ $t('powerlimiteradmin.BatterySocSolarPassthroughStartThreshold') }}
|
||||
<BIconInfoCircle v-tooltip :title="$t('powerlimiteradmin.BatterySocSolarPassthroughStartThresholdHint')" />
|
||||
</label>
|
||||
@ -180,7 +185,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-secondary" role="alert" v-html="$t('powerlimiteradmin.BatterySocInfo')"></div>
|
||||
<div class="alert alert-secondary" role="alert" v-html="$t('powerlimiteradmin.BatterySocInfo')" v-show="!powerLimiterConfigList.ignore_soc"></div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label for="inputVoltageStartThreshold" class="col-sm-2 col-form-label">{{ $t('powerlimiteradmin.VoltageStartThreshold') }}:</label>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user