EvseMode: show data of the power supply

This commit is contained in:
uhi22 2024-05-27 18:40:35 +02:00
parent d52fe797ad
commit 195c4868b0
3 changed files with 38 additions and 4 deletions

View file

@ -262,7 +262,7 @@ class fsmEvse():
self.simulatedPresentVoltage += 20
if (self.simulatedPresentVoltage<uTarget):
self.simulatedPresentVoltage += 5
strPresentVoltage = str(self.simulatedPresentVoltage) # "345"
strPresentVoltage = str(int(self.simulatedPresentVoltage*10)/10) # "345"
# in case we control a real power supply: give the precharge target to it
self.hardwareInterface.setPowerSupplyVoltageAndCurrent(uTarget, 1)
self.callbackShowStatus(strPresentVoltage, "EVSEPresentVoltage")
@ -323,7 +323,7 @@ class fsmEvse():
except:
self.addToTrace("ERROR: Could not decode the CurrentDemandReq")
self.simulatedPresentVoltage = uTarget + 3*random() # The charger provides the voltage which is demanded by the car.
strPresentVoltage = str(self.simulatedPresentVoltage)
strPresentVoltage = str(int(self.simulatedPresentVoltage*10)/10) # "345"
self.callbackShowStatus(strPresentVoltage, "EVSEPresentVoltage")
strEVSEPresentCurrent = "1" # Just as a dummy current
if (self.blChargeStopTrigger == 1):
@ -353,7 +353,7 @@ class fsmEvse():
# todo: check the request content, and fill response parameters
# simulate the decreasing voltage during the weldingDetection:
self.simulatedPresentVoltage = self.simulatedPresentVoltage*0.8 + 3*random()
strPresentVoltage = str(self.simulatedPresentVoltage)
strPresentVoltage = str(int(self.simulatedPresentVoltage*10)/10) # "345"
self.callbackShowStatus(strPresentVoltage, "EVSEPresentVoltage")
msg = addV2GTPHeader(exiEncode("E"+self.schemaSelection+"j_"+strPresentVoltage)) # EDj for Encode, Din, WeldingDetectionRes
self.showDecodedTransmitMessage(msg)

View file

@ -60,6 +60,12 @@ def cbShowStatus(s, selection=""):
if (selection == "UandI"):
lblRequestedUandI['text']= "Target " + s + ""
s=""
if (selection == "PowerSupplyUPresent"):
lblPowerSupplyUPresent['text']= "UPresent " + s + "V"
s=""
if (selection == "PowerSupplyUTarget"):
lblPowerSupplyUTarget['text']= "UTarget " + s + "V"
s=""
if (len(s)>0):
lblStatus['text']=s
root.update()
@ -101,8 +107,19 @@ if (myMode == C_EVSE_MODE):
print("starting in EvseMode")
root = tk.Tk()
root.geometry("400x350")
#root.geometry("400x350")
root.geometry("600x350")
lastKey = ''
if (myMode == C_EVSE_MODE):
frmPowerSupply = tk.Frame(root, bg='lightblue', bd=3)
frmPowerSupply.pack(side='right', fill='both', expand='True')
lblPowerSupplyUTarget = tk.Label(frmPowerSupply, text="(UTarget)", bg='lightblue')
lblPowerSupplyUTarget.config(font=('Helvetica bold', 18))
lblPowerSupplyUTarget.pack()
lblPowerSupplyUPresent = tk.Label(frmPowerSupply, text="(PowerSupplyUPresent)", bg='lightblue')
lblPowerSupplyUPresent.config(font=('Helvetica bold', 18))
lblPowerSupplyUPresent.pack()
lblHelp = tk.Label(root, justify= "left")
lblHelp['text']="x=exit \nS=GET_SW \nP=PEV mode \nE=EVSE mode \nL=Listen mode \ns=SET_KEY \nG=GET_KEY (try twice) \nt=SET_KEY modified \n space=stop charging"
lblHelp.pack()
@ -124,6 +141,7 @@ lblEVSEPresentVoltage = tk.Label(root, text="(EVSEPresentVoltage)")
lblEVSEPresentVoltage.config(font=('Helvetica bold', 16))
lblEVSEPresentVoltage.pack()
if (myMode == C_EVSE_MODE):
lblTestcase = tk.Label(root, text="(test case)")
lblTestcase.pack()

View file

@ -730,6 +730,19 @@ class pyPlcHomeplug():
self.addToTrace("[EVSE] transmitting ATTEN_CHAR.IND")
self.sniffer.sendpacket(bytes(self.mytransmitbuffer))
def evaluateStartAttenCharInd(self):
# self.addToTrace("received START_ATTEN_CHAR.IND")
# nothing to do as PEV or EVSE.
# interpretation just in case we use it as special message in EVSE mode to get information from the power supply
if (self.iAmEvse==1):
if ((self.myreceivebuffer[38] == 0xDC) and (self.myreceivebuffer[39] == 0x55) and (self.myreceivebuffer[40] == 0xAA)):
uPresent = self.myreceivebuffer[43]
uPresent*=256
uPresent+=self.myreceivebuffer[44]
uPresent/=10 # scaling in the message is 0.1V
self.callbackShowStatus(str(uPresent), "PowerSupplyUPresent")
# Todo: evaluate other information of the power supply, like cable check result, current, temperature, ...
def evaluateAttenCharInd(self):
self.addToTrace("received ATTEN_CHAR.IND")
if (self.iAmPev==1):
@ -804,6 +817,8 @@ class pyPlcHomeplug():
self.evaluateSlacParamReq()
if (mmt == CM_SLAC_PARAM + MMTYPE_CNF):
self.evaluateSlacParamCnf()
if (mmt == CM_START_ATTEN_CHAR + MMTYPE_IND):
self.evaluateStartAttenCharInd()
if (mmt == CM_MNBC_SOUND + MMTYPE_IND):
self.evaluateMnbcSoundInd()
if (mmt == CM_ATTEN_CHAR + MMTYPE_IND):
@ -1130,6 +1145,7 @@ class pyPlcHomeplug():
self.composeSpecialMessage()
self.addToTrace("transmitting SpecialMessage to control the power supply")
self.transmit(self.mytransmitbuffer)
self.callbackShowStatus(str(targetVoltage), "PowerSupplyUTarget")
def enterPevMode(self):
self.iAmEvse = 0 # not emulating a charging station