Feature: support for Huawei target power consumption

This commit is contained in:
MalteSchm 2024-04-24 20:26:56 +02:00 committed by GitHub
parent 74330a5617
commit f0df583c13
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 39 additions and 10 deletions

View File

@ -253,6 +253,7 @@ struct CONFIG_T {
float Auto_Power_Lower_Power_Limit;
float Auto_Power_Upper_Power_Limit;
uint8_t Auto_Power_Stop_BatterySoC_Threshold;
float Auto_Power_Target_Power_Consumption;
} Huawei;

View File

@ -157,5 +157,6 @@
#define HUAWEI_AUTO_POWER_LOWER_POWER_LIMIT 150
#define HUAWEI_AUTO_POWER_UPPER_POWER_LIMIT 2000
#define HUAWEI_AUTO_POWER_STOP_BATTERYSOC_THRESHOLD 95
#define HUAWEI_AUTO_POWER_TARGET_POWER_CONSUMPTION 0
#define VERBOSE_LOGGING true

View File

@ -227,6 +227,7 @@ bool ConfigurationClass::write()
huawei["lower_power_limit"] = config.Huawei.Auto_Power_Lower_Power_Limit;
huawei["upper_power_limit"] = config.Huawei.Auto_Power_Upper_Power_Limit;
huawei["stop_batterysoc_threshold"] = config.Huawei.Auto_Power_Stop_BatterySoC_Threshold;
huawei["target_power_consumption"] = config.Huawei.Auto_Power_Target_Power_Consumption;
// Serialize JSON to file
if (serializeJson(doc, f) == 0) {
@ -482,6 +483,7 @@ bool ConfigurationClass::read()
config.Huawei.Auto_Power_Lower_Power_Limit = huawei["lower_power_limit"] | HUAWEI_AUTO_POWER_LOWER_POWER_LIMIT;
config.Huawei.Auto_Power_Upper_Power_Limit = huawei["upper_power_limit"] | HUAWEI_AUTO_POWER_UPPER_POWER_LIMIT;
config.Huawei.Auto_Power_Stop_BatterySoC_Threshold = huawei["stop_batterysoc_threshold"] | HUAWEI_AUTO_POWER_STOP_BATTERYSOC_THRESHOLD;
config.Huawei.Auto_Power_Target_Power_Consumption = huawei["target_power_consumption"] | HUAWEI_AUTO_POWER_TARGET_POWER_CONSUMPTION;
f.close();
return true;

View File

@ -384,7 +384,11 @@ void HuaweiCanClass::loop()
// Calculate new power limit
float newPowerLimit = -1 * round(PowerMeter.getPowerTotal());
newPowerLimit += _rp.output_power;
float efficiency = (_rp.efficiency > 0.5 ? _rp.efficiency : 1.0);
// Powerlimit is the requested output power + permissable Grid consumption factoring in the efficiency factor
newPowerLimit += _rp.output_power + config.Huawei.Auto_Power_Target_Power_Consumption / efficiency;
if (verboseLogging){
MessageOutput.printf("[HuaweiCanClass::loop] newPowerLimit: %f, output_power: %f \r\n", newPowerLimit, _rp.output_power);
}
@ -424,7 +428,6 @@ void HuaweiCanClass::loop()
}
// Calculate output current
float efficiency = (_rp.efficiency > 0.5 ? _rp.efficiency : 1.0);
float calculatedCurrent = efficiency * (newPowerLimit / _rp.output_voltage);
// Limit output current to value requested by BMS

View File

@ -196,6 +196,7 @@ void WebApiHuaweiClass::onAdminGet(AsyncWebServerRequest* request)
root["lower_power_limit"] = config.Huawei.Auto_Power_Lower_Power_Limit;
root["upper_power_limit"] = config.Huawei.Auto_Power_Upper_Power_Limit;
root["stop_batterysoc_threshold"] = config.Huawei.Auto_Power_Stop_BatterySoC_Threshold;
root["target_power_consumption"] = config.Huawei.Auto_Power_Target_Power_Consumption;
response->setLength();
request->send(response);
@ -266,6 +267,8 @@ void WebApiHuaweiClass::onAdminPost(AsyncWebServerRequest* request)
config.Huawei.Auto_Power_Lower_Power_Limit = root["lower_power_limit"].as<float>();
config.Huawei.Auto_Power_Upper_Power_Limit = root["upper_power_limit"].as<float>();
config.Huawei.Auto_Power_Stop_BatterySoC_Threshold = root["stop_batterysoc_threshold"];
config.Huawei.Auto_Power_Target_Power_Consumption = root["target_power_consumption"];
WebApi.writeConfig(retMsg);
response->setLength();

View File

@ -852,13 +852,15 @@
"enableVoltageLimit": "Start Spannungslimit",
"stopVoltageLimitHint": "Maximal Spannung des Ladegeräts. Entspricht der geünschten Ladeschlussspannung der Batterie. Verwendet für die Automatische Leistungssteuerung und beim Notfallladen",
"enableVoltageLimitHint": "Die automatische Leistungssteuerung wird deaktiviert wenn die Ausgangsspannung über diesem Wert liegt und wenn gleichzeitig die Ausgangsleistung unter die minimale Leistung fällt.\nDie automatische Leistungssteuerung wird re-aktiveiert wenn die Batteriespannung unter diesen Wert fällt.",
"maxPowerLimitHint": "Maximale Ausgangsleistung. Verwendet für die Automatische Leistungssteuerung und beim Notfallladen",
"upperPowerLimitHint": "Maximale Ausgangsleistung. Verwendet für die Automatische Leistungssteuerung und beim Notfallladen",
"lowerPowerLimit": "Minimale Leistung",
"upperPowerLimit": "Maximale Leistung",
"StopBatterySoCThreshold": "Laden bei SoC beenden",
"StopBatterySoCThresholdHint": "Zur Verlängerung der Akku-Lebensdauer kann der Ladevorgang bei einem bestimmten SoC gestoppt werden.\nHinweis: Manche LiFePO-Akkus müssen gelegentlich voll geladen werden, um die SoC-Anzeige akkurat zu halten.",
"Seconds": "@:base.Seconds",
"EnableEmergencyCharge": "Notfallladen: Batterie wird mit maximaler Leistung geladen wenn durch das Batterie BMS angefordert"
"EnableEmergencyCharge": "Notfallladen: Batterie wird mit maximaler Leistung geladen wenn durch das Batterie BMS angefordert",
"targetPowerConsumption": "Angestrebter Netzbezug",
"targetPowerConsumptionHint": "Bei postiven Werten wird die eingestellte Leistung aus dem Stromnetz bezogen. Bei negativen Werten wird das Netzteil vorzeitig abgeschaltet."
},
"battery": {
"battery": "Batterie",

View File

@ -859,13 +859,15 @@
"enableVoltageLimit": "Re-enable voltage limit",
"stopVoltageLimitHint": "Maximum charger voltage. Equals battery charge voltage limit. Used for automatic power control and when emergency charging",
"enableVoltageLimitHint": "Automatic power control is disabled if the output voltage is higher then this value and if the output power drops below the minimum output power limit (set below).\nAutomatic power control is re-enabled if the battery voltage drops below the value set in this field.",
"maxPowerLimitHint": "Maximum output power. Used for automatic power control and when emergency charging",
"upperPowerLimitHint": "Maximum output power. Used for automatic power control and when emergency charging",
"lowerPowerLimit": "Minimum output power",
"upperPowerLimit": "Maximum output power",
"StopBatterySoCThreshold": "Stop charging at SoC",
"StopBatterySoCThresholdHint": "To prolong the battery's lifespan, charging can be stopped at a certain SoC level.\nHint: In order to keep the SoC reading accurate, some LiFePO cells must be charged to full capacity regularly.",
"Seconds": "@:base.Seconds",
"EnableEmergencyCharge": "Emergency charge. Battery charged with maximum power if requested by Battery BMS"
"EnableEmergencyCharge": "Emergency charge. Battery charged with maximum power if requested by Battery BMS",
"targetPowerConsumption": "Target power consumption",
"targetPowerConsumptionHint": "Postitive values use grid power to charge the battery. Negative values result in early shutdown"
},
"battery": {
"battery": "Battery",

View File

@ -847,13 +847,15 @@
"enableVoltageLimit": "Re-enable voltage limit",
"stopVoltageLimitHint": "Maximum charger voltage. Equals battery charge voltage limit. Used for automatic power control and when emergency charging",
"enableVoltageLimitHint": "Automatic power control is disabled if the output voltage is higher then this value and if the output power drops below the minimum output power limit (set below).\nAutomatic power control is re-enabled if the battery voltage drops below the value set in this field.",
"maxPowerLimitHint": "Maximum output power. Used for automatic power control and when emergency charging",
"upperPowerLimitHint": "Maximum output power. Used for automatic power control and when emergency charging",
"lowerPowerLimit": "Minimum output power",
"upperPowerLimit": "Maximum output power",
"StopBatterySoCThreshold": "Stop charging at SoC",
"StopBatterySoCThresholdHint": "To prolong the battery's lifespan, charging can be stopped at a certain SoC level.\nHint: In order to keep the SoC reading accurate, some LiFePO cells must be charged to full capacity regularly.",
"Seconds": "@:base.Seconds",
"EnableEmergencyCharge": "Emergency charge. Battery charged with maximum power if requested by Battery BMS"
"EnableEmergencyCharge": "Emergency charge. Battery charged with maximum power if requested by Battery BMS",
"targetPowerConsumption": "Target power consumption",
"targetPowerConsumptionHint": "Postitive values use grid power to charge the battery. Negative values result in early shutdown"
},
"battery": {
"battery": "Battery",

View File

@ -10,4 +10,5 @@ export interface AcChargerConfig {
upper_power_limit: number;
emergency_charge_enabled: boolean;
stop_batterysoc_threshold: number;
target_power_consumption: number;
}

View File

@ -78,16 +78,28 @@
</div>
</div>
<label for="upperPowerLimit" class="col-sm-2 col-form-label">{{ $t('acchargeradmin.upperPowerLimit') }}:
<BIconInfoCircle v-tooltip :title="$t('acchargeradmin.maxPowerLimitHint')" />
<BIconInfoCircle v-tooltip :title="$t('acchargeradmin.upperPowerLimitHint')" />
</label>
<div class="col-sm-10">
<div class="input-group">
<input type="number" class="form-control" id="upperPowerLimit"
placeholder="2000" v-model="acChargerConfigList.upper_power_limit"
aria-describedby="lowerPowerLimitDescription" min="100" max="3000" required/>
aria-describedby="upperPowerLimitDescription" min="100" max="3000" required/>
<span class="input-group-text" id="upperPowerLimitDescription">W</span>
</div>
</div>
<label for="targetPowerConsumption" class="col-sm-2 col-form-label">{{ $t('acchargeradmin.targetPowerConsumption') }}:
<BIconInfoCircle v-tooltip :title="$t('acchargeradmin.targetPowerConsumptionHint')" />
</label>
<div class="col-sm-10">
<div class="input-group">
<input type="number" class="form-control" id="targetPowerConsumption"
placeholder="0" v-model="acChargerConfigList.target_power_consumption"
aria-describedby="targetPowerConsumptionDescription" min="-3000" max="3000" required/>
<span class="input-group-text" id="targetPowerConsumptionDescription">W</span>
</div>
</div>
</div>
</CardElement>
<CardElement :text="$t('acchargeradmin.BatterySoCLimits')" textVariant="text-bg-primary" add-space