From a89d097948457b041d31b1ee1dfeb81239338ed7 Mon Sep 17 00:00:00 2001 From: johannes Date: Thu, 14 Nov 2024 19:54:19 +0100 Subject: [PATCH] Bodged in vehicle SoC --- fsmEvse.py | 4 ++-- hardwareInterface.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fsmEvse.py b/fsmEvse.py index 042ee6e..6038758 100644 --- a/fsmEvse.py +++ b/fsmEvse.py @@ -270,7 +270,7 @@ class fsmEvse(): strPresentVoltage = str(self.hardwareInterface.getInletVoltage()) # in case we control a real power supply: give the precharge target to it - self.hardwareInterface.setPowerSupplyVoltageAndCurrent(uTarget, 1) + self.hardwareInterface.setPowerSupplyVoltageAndCurrent(uTarget, 1, 0) self.callbackShowStatus(strPresentVoltage, "EVSEPresentVoltage") msg = addV2GTPHeader(exiEncode("E"+self.schemaSelection+"g_"+strPresentVoltage)) # EDg for Encode, Din, PreChargeResponse if (testsuite_faultinjection_is_triggered(TC_EVSE_Shutdown_during_PreCharge)): @@ -329,11 +329,11 @@ class fsmEvse(): strEVTargetCurrentMultiplier = jsondict["EVTargetCurrent.Multiplier"] iTarget = combineValueAndMultiplier(strEVTargetCurrentValue, strEVTargetCurrentMultiplier) self.addToTrace("EV wants EVTargetVoltage " + str(uTarget) + " and EVTargetCurrent " + str(iTarget)) - self.hardwareInterface.setPowerSupplyVoltageAndCurrent(uTarget, iTarget) current_soc = int(jsondict.get("DC_EVStatus.EVRESSSOC", -1)) full_soc = int(jsondict.get("FullSOC", -1)) energy_capacity = int(jsondict.get("EVEnergyCapacity.Value", -1)) energy_request = int(jsondict.get("EVEnergyRequest.Value", -1)) + self.hardwareInterface.setPowerSupplyVoltageAndCurrent(uTarget, iTarget, current_soc) self.publishSoCs(current_soc, full_soc, energy_capacity, energy_request, origin="CurrentDemandReq") diff --git a/hardwareInterface.py b/hardwareInterface.py index d8a296b..559d4b8 100644 --- a/hardwareInterface.py +++ b/hardwareInterface.py @@ -185,13 +185,14 @@ class hardwareInterface(): self.mqttclient.publish(getConfigValue("mqtt_topic") + "/charger_voltage", voltageNow) self.mqttclient.publish(getConfigValue("mqtt_topic") + "/charger_current", currentNow) - def setPowerSupplyVoltageAndCurrent(self, targetVoltage, targetCurrent): + def setPowerSupplyVoltageAndCurrent(self, targetVoltage, targetCurrent, soc): # if we are the charger, and have a real power supply which we want to control, we do it here self.homeplughandler.sendSpecialMessageToControlThePowerSupply(targetVoltage, targetCurrent) #here we can publish the voltage and current requests received from the PEV side if getConfigValue("charge_parameter_backend") == "mqtt": self.mqttclient.publish(getConfigValue("mqtt_topic") + "/pev_voltage", str(targetVoltage)) - self.mqttclient.publish(getConfigValue("mqtt_topic") + "/pev_current", str(targetVoltage)) + self.mqttclient.publish(getConfigValue("mqtt_topic") + "/pev_current", str(targetCurrent)) + self.mqttclient.publish(getConfigValue("mqtt_topic") + "/soc", str(soc)) def getInletVoltage(self): # uncomment this line, to take the simulated inlet voltage instead of the really measured