mirror of
https://github.com/uhi22/pyPLC.git
synced 2024-11-20 01:13:58 +00:00
EvseMode: simulated voltage during PreCharge and Charging
This commit is contained in:
parent
223c70dc86
commit
a2cbd78660
1 changed files with 13 additions and 4 deletions
15
fsmEvse.py
15
fsmEvse.py
|
@ -57,6 +57,7 @@ class fsmEvse():
|
||||||
|
|
||||||
def stateFunctionWaitForSessionSetupRequest(self):
|
def stateFunctionWaitForSessionSetupRequest(self):
|
||||||
if (len(self.rxData)>0):
|
if (len(self.rxData)>0):
|
||||||
|
self.simulatedPresentVoltage = 0
|
||||||
self.addToTrace("In state WaitForSessionSetupRequest, received " + prettyHexMessage(self.rxData))
|
self.addToTrace("In state WaitForSessionSetupRequest, received " + prettyHexMessage(self.rxData))
|
||||||
exidata = removeV2GTPHeader(self.rxData)
|
exidata = removeV2GTPHeader(self.rxData)
|
||||||
self.rxData = []
|
self.rxData = []
|
||||||
|
@ -136,10 +137,13 @@ class fsmEvse():
|
||||||
self.enterState(stateWaitForFlexibleRequest) # todo: not clear, what is specified in DIN
|
self.enterState(stateWaitForFlexibleRequest) # todo: not clear, what is specified in DIN
|
||||||
if (strConverterResult.find("PreChargeReq")>0):
|
if (strConverterResult.find("PreChargeReq")>0):
|
||||||
# todo: check the request content, and fill response parameters
|
# todo: check the request content, and fill response parameters
|
||||||
strPresentVoltage = "345"
|
# simulating preCharge
|
||||||
|
if (self.simulatedPresentVoltage<300):
|
||||||
|
self.simulatedPresentVoltage += 10
|
||||||
|
strPresentVoltage = str(self.simulatedPresentVoltage) # "345"
|
||||||
msg = addV2GTPHeader(exiEncode("EDg_"+strPresentVoltage)) # EDg for Encode, Din, PreChargeResponse
|
msg = addV2GTPHeader(exiEncode("EDg_"+strPresentVoltage)) # EDg for Encode, Din, PreChargeResponse
|
||||||
self.addToTrace("responding " + prettyHexMessage(msg))
|
self.addToTrace("responding " + prettyHexMessage(msg))
|
||||||
self.publishStatus("PreCharging")
|
self.publishStatus("PreCharging " + strPresentVoltage)
|
||||||
self.Tcp.transmit(msg)
|
self.Tcp.transmit(msg)
|
||||||
self.enterState(stateWaitForFlexibleRequest) # todo: not clear, what is specified in DIN
|
self.enterState(stateWaitForFlexibleRequest) # todo: not clear, what is specified in DIN
|
||||||
if (strConverterResult.find("ContractAuthenticationReq")>0):
|
if (strConverterResult.find("ContractAuthenticationReq")>0):
|
||||||
|
@ -151,7 +155,11 @@ class fsmEvse():
|
||||||
self.enterState(stateWaitForFlexibleRequest) # todo: not clear, what is specified in DIN
|
self.enterState(stateWaitForFlexibleRequest) # todo: not clear, what is specified in DIN
|
||||||
if (strConverterResult.find("CurrentDemandReq")>0):
|
if (strConverterResult.find("CurrentDemandReq")>0):
|
||||||
# todo: check the request content, and fill response parameters
|
# todo: check the request content, and fill response parameters
|
||||||
msg = addV2GTPHeader(exiEncode("EDi")) # EDi for Encode, Din, CurrentDemandRes
|
if (self.simulatedPresentVoltage<300):
|
||||||
|
self.simulatedPresentVoltage += 1;
|
||||||
|
strPresentVoltage = str(self.simulatedPresentVoltage)
|
||||||
|
strEVSEPresentCurrent = "10" # Just as a dummy current
|
||||||
|
msg = addV2GTPHeader(exiEncode("EDi_"+strPresentVoltage + "_" + strEVSEPresentCurrent)) # EDi for Encode, Din, CurrentDemandRes
|
||||||
self.addToTrace("responding " + prettyHexMessage(msg))
|
self.addToTrace("responding " + prettyHexMessage(msg))
|
||||||
self.publishStatus("CurrentDemand")
|
self.publishStatus("CurrentDemand")
|
||||||
self.Tcp.transmit(msg)
|
self.Tcp.transmit(msg)
|
||||||
|
@ -215,6 +223,7 @@ class fsmEvse():
|
||||||
self.state = 0
|
self.state = 0
|
||||||
self.cyclesInState = 0
|
self.cyclesInState = 0
|
||||||
self.rxData = []
|
self.rxData = []
|
||||||
|
self.simulatedPresentVoltage = 0
|
||||||
self.Tcp.resetTheConnection()
|
self.Tcp.resetTheConnection()
|
||||||
|
|
||||||
def socketStateNotification(self, notification):
|
def socketStateNotification(self, notification):
|
||||||
|
|
Loading…
Reference in a new issue