mirror of
https://github.com/uhi22/pyPLC.git
synced 2024-11-10 01:05:42 +00:00
feature: EvseMode: by pressing space, the user can stop the charge loop with EVSEStatusCode=EVSE_Shutdown
This commit is contained in:
parent
c42afc7a6b
commit
03ca236536
2 changed files with 14 additions and 1 deletions
13
fsmEvse.py
13
fsmEvse.py
|
@ -266,7 +266,14 @@ class fsmEvse():
|
||||||
strPresentVoltage = str(self.simulatedPresentVoltage)
|
strPresentVoltage = str(self.simulatedPresentVoltage)
|
||||||
self.callbackShowStatus(strPresentVoltage, "EVSEPresentVoltage")
|
self.callbackShowStatus(strPresentVoltage, "EVSEPresentVoltage")
|
||||||
strEVSEPresentCurrent = "1" # Just as a dummy current
|
strEVSEPresentCurrent = "1" # Just as a dummy current
|
||||||
msg = addV2GTPHeader(exiEncode("EDi_"+strPresentVoltage + "_" + strEVSEPresentCurrent)) # EDi for Encode, Din, CurrentDemandRes
|
if (self.blChargeStopTrigger == 1):
|
||||||
|
# User pressed the STOP button on the charger. Send EVSE_Shutdown.
|
||||||
|
self.addToTrace("User pressed the STOP button on the charger. Sending EVSE_Shutdown.")
|
||||||
|
strEVSEStatus = "2" # 2=EVSE_Shutdown, means the user stopped the session on the charger.
|
||||||
|
else:
|
||||||
|
# The normal case. No stop requested from user. Just send EVSE_Ready.
|
||||||
|
strEVSEStatus = "1" # 1=EVSE_Ready
|
||||||
|
msg = addV2GTPHeader(exiEncode("EDi_"+strPresentVoltage + "_" + strEVSEPresentCurrent + "_" + strEVSEStatus)) # EDi for Encode, Din, CurrentDemandRes
|
||||||
if (testsuite_faultinjection_is_triggered(TC_EVSE_Malfunction_during_CurrentDemand)):
|
if (testsuite_faultinjection_is_triggered(TC_EVSE_Malfunction_during_CurrentDemand)):
|
||||||
# send a CurrentDemandResponse with StatusCode EVSE_Malfunction, to simulate e.g. a voltage overshoot
|
# send a CurrentDemandResponse with StatusCode EVSE_Malfunction, to simulate e.g. a voltage overshoot
|
||||||
msg = addV2GTPHeader("809a02203fa9e71c31bc920100821b430b933b4b7339032b93937b908e08043000081828440201818000040060a11c06030306402038441380")
|
msg = addV2GTPHeader("809a02203fa9e71c31bc920100821b430b933b4b7339032b93937b908e08043000081828440201818000040060a11c06030306402038441380")
|
||||||
|
@ -373,6 +380,7 @@ class fsmEvse():
|
||||||
self.cyclesInState = 0
|
self.cyclesInState = 0
|
||||||
self.rxData = []
|
self.rxData = []
|
||||||
self.evccid = ""
|
self.evccid = ""
|
||||||
|
self.blChargeStopTrigger = 0
|
||||||
|
|
||||||
def mainfunction(self):
|
def mainfunction(self):
|
||||||
self.Tcp.mainfunction() # call the lower-level worker
|
self.Tcp.mainfunction() # call the lower-level worker
|
||||||
|
@ -383,6 +391,9 @@ class fsmEvse():
|
||||||
self.cyclesInState += 1 # for timeout handling, count how long we are in a state
|
self.cyclesInState += 1 # for timeout handling, count how long we are in a state
|
||||||
self.stateFunctions[self.state](self)
|
self.stateFunctions[self.state](self)
|
||||||
|
|
||||||
|
def stopCharging(self):
|
||||||
|
self.blChargeStopTrigger = 1
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print("Testing the evse state machine")
|
print("Testing the evse state machine")
|
||||||
|
|
|
@ -124,6 +124,8 @@ class pyPlcWorker():
|
||||||
print("stopping the charge process")
|
print("stopping the charge process")
|
||||||
if (hasattr(self, 'pev')):
|
if (hasattr(self, 'pev')):
|
||||||
self.pev.stopCharging()
|
self.pev.stopCharging()
|
||||||
|
if (hasattr(self, 'evse')):
|
||||||
|
self.evse.stopCharging()
|
||||||
# self.addToTrace("UserAction " + strAction)
|
# self.addToTrace("UserAction " + strAction)
|
||||||
self.hp.sendTestFrame(strAction)
|
self.hp.sendTestFrame(strAction)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue