Bodged in vehicle SoC

This commit is contained in:
johannes 2024-11-14 19:54:19 +01:00
parent 8293b77789
commit a89d097948
2 changed files with 5 additions and 4 deletions

View file

@ -270,7 +270,7 @@ class fsmEvse():
strPresentVoltage = str(self.hardwareInterface.getInletVoltage()) strPresentVoltage = str(self.hardwareInterface.getInletVoltage())
# in case we control a real power supply: give the precharge target to it # 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") self.callbackShowStatus(strPresentVoltage, "EVSEPresentVoltage")
msg = addV2GTPHeader(exiEncode("E"+self.schemaSelection+"g_"+strPresentVoltage)) # EDg for Encode, Din, PreChargeResponse msg = addV2GTPHeader(exiEncode("E"+self.schemaSelection+"g_"+strPresentVoltage)) # EDg for Encode, Din, PreChargeResponse
if (testsuite_faultinjection_is_triggered(TC_EVSE_Shutdown_during_PreCharge)): if (testsuite_faultinjection_is_triggered(TC_EVSE_Shutdown_during_PreCharge)):
@ -329,11 +329,11 @@ class fsmEvse():
strEVTargetCurrentMultiplier = jsondict["EVTargetCurrent.Multiplier"] strEVTargetCurrentMultiplier = jsondict["EVTargetCurrent.Multiplier"]
iTarget = combineValueAndMultiplier(strEVTargetCurrentValue, strEVTargetCurrentMultiplier) iTarget = combineValueAndMultiplier(strEVTargetCurrentValue, strEVTargetCurrentMultiplier)
self.addToTrace("EV wants EVTargetVoltage " + str(uTarget) + " and EVTargetCurrent " + str(iTarget)) 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)) current_soc = int(jsondict.get("DC_EVStatus.EVRESSSOC", -1))
full_soc = int(jsondict.get("FullSOC", -1)) full_soc = int(jsondict.get("FullSOC", -1))
energy_capacity = int(jsondict.get("EVEnergyCapacity.Value", -1)) energy_capacity = int(jsondict.get("EVEnergyCapacity.Value", -1))
energy_request = int(jsondict.get("EVEnergyRequest.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") self.publishSoCs(current_soc, full_soc, energy_capacity, energy_request, origin="CurrentDemandReq")

View file

@ -185,13 +185,14 @@ class hardwareInterface():
self.mqttclient.publish(getConfigValue("mqtt_topic") + "/charger_voltage", voltageNow) self.mqttclient.publish(getConfigValue("mqtt_topic") + "/charger_voltage", voltageNow)
self.mqttclient.publish(getConfigValue("mqtt_topic") + "/charger_current", currentNow) 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 # 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) self.homeplughandler.sendSpecialMessageToControlThePowerSupply(targetVoltage, targetCurrent)
#here we can publish the voltage and current requests received from the PEV side #here we can publish the voltage and current requests received from the PEV side
if getConfigValue("charge_parameter_backend") == "mqtt": if getConfigValue("charge_parameter_backend") == "mqtt":
self.mqttclient.publish(getConfigValue("mqtt_topic") + "/pev_voltage", str(targetVoltage)) 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): def getInletVoltage(self):
# uncomment this line, to take the simulated inlet voltage instead of the really measured # uncomment this line, to take the simulated inlet voltage instead of the really measured