mirror of
https://github.com/uhi22/pyPLC.git
synced 2024-11-20 01:13:58 +00:00
Report charger parameters and momentary values to hardwareInterface
This commit is contained in:
parent
219ca7f51d
commit
9286c539f0
2 changed files with 19 additions and 3 deletions
|
@ -425,6 +425,8 @@ class fsmPev():
|
||||||
if (strConverterResult.find('"EVSEProcessing": "Finished"')>0):
|
if (strConverterResult.find('"EVSEProcessing": "Finished"')>0):
|
||||||
self.publishStatus("ChargeParams discovered")
|
self.publishStatus("ChargeParams discovered")
|
||||||
self.addToTrace("Checkpoint550: ChargeParams are discovered. Will change to state C.")
|
self.addToTrace("Checkpoint550: ChargeParams are discovered. Will change to state C.")
|
||||||
|
#Report charger paramters
|
||||||
|
self.hardwareInterface.setChargerParameters(500, 50) #TODO: send real parameters
|
||||||
# pull the CP line to state C here:
|
# pull the CP line to state C here:
|
||||||
self.hardwareInterface.setStateC()
|
self.hardwareInterface.setStateC()
|
||||||
self.addToTrace("Checkpoint555: Locking the connector.")
|
self.addToTrace("Checkpoint555: Locking the connector.")
|
||||||
|
@ -653,6 +655,7 @@ class fsmPev():
|
||||||
u = combineValueAndMultiplier(strEVSEPresentVoltageValue, strEVSEPresentVoltageMultiplier)
|
u = combineValueAndMultiplier(strEVSEPresentVoltageValue, strEVSEPresentVoltageMultiplier)
|
||||||
self.callbackShowStatus(format(u,".1f"), "EVSEPresentVoltage")
|
self.callbackShowStatus(format(u,".1f"), "EVSEPresentVoltage")
|
||||||
strEVSEStatusCode = y["DC_EVSEStatus.EVSEStatusCode"]
|
strEVSEStatusCode = y["DC_EVSEStatus.EVSEStatusCode"]
|
||||||
|
self.hardwareInterface.setChargerVoltageAndCurrent(u, EVTargetCurrent) #TODO: report real current!
|
||||||
except:
|
except:
|
||||||
self.addToTrace("ERROR: Could not decode the PreChargeResponse")
|
self.addToTrace("ERROR: Could not decode the PreChargeResponse")
|
||||||
if (strResponseCode!="OK"):
|
if (strResponseCode!="OK"):
|
||||||
|
|
|
@ -144,6 +144,14 @@ class hardwareInterface():
|
||||||
#if (getConfigValue("digital_output_device")=="celeron55device"):
|
#if (getConfigValue("digital_output_device")=="celeron55device"):
|
||||||
# return self.lock_confirmed
|
# return self.lock_confirmed
|
||||||
return 1 # todo: use the real connector lock feedback
|
return 1 # todo: use the real connector lock feedback
|
||||||
|
|
||||||
|
def setChargerParameters(self, maxVoltage, maxCurrent):
|
||||||
|
self.maxChargerVoltage = int(maxVoltage)
|
||||||
|
self.maxChargerCurrent = int(maxCurrent)
|
||||||
|
|
||||||
|
def setChargerVoltageAndCurrent(self, voltageNow, currentNow):
|
||||||
|
self.chargerVoltage = int(voltageNow)
|
||||||
|
self.chargerCurrent = int(currentNow)
|
||||||
|
|
||||||
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
|
||||||
|
@ -232,6 +240,11 @@ class hardwareInterface():
|
||||||
self.contactor_confirmed = False # Confirmation from hardware
|
self.contactor_confirmed = False # Confirmation from hardware
|
||||||
self.plugged_in = None # None means "not known yet"
|
self.plugged_in = None # None means "not known yet"
|
||||||
|
|
||||||
|
self.maxChargerVoltage = 500
|
||||||
|
self.maxChargerCurrent = 10
|
||||||
|
self.chargerVoltage = 0
|
||||||
|
self.chargerCurrent = 0
|
||||||
|
|
||||||
self.logged_inlet_voltage = None
|
self.logged_inlet_voltage = None
|
||||||
self.logged_dc_link_voltage = None
|
self.logged_dc_link_voltage = None
|
||||||
self.logged_cp_pwm = None
|
self.logged_cp_pwm = None
|
||||||
|
@ -413,12 +426,12 @@ class hardwareInterface():
|
||||||
self.capacity = message.data[6]
|
self.capacity = message.data[6]
|
||||||
|
|
||||||
#TODO: determine maximum charger current and voltage and also actual current and voltage
|
#TODO: determine maximum charger current and voltage and also actual current and voltage
|
||||||
msg = can.Message(arbitration_id=0x108, data=[ 0, 0, 0, 125, 0, 0, 0, 0], is_extended_id=False)
|
msg = can.Message(arbitration_id=0x108, data=[ 0, self.maxChargerVoltage & 0xFF, self.maxChargerVoltage >> 8, self.maxChargerCurrent, 0, 0, 0, 0], is_extended_id=False)
|
||||||
self.canbus.send(msg)
|
self.canbus.send(msg)
|
||||||
#Report unspecified version 10, this makes our custom implementation send the
|
#Report unspecified version 10, this makes our custom implementation send the momentary
|
||||||
#battery voltage in 0x100 bytes 0 and 1
|
#battery voltage in 0x100 bytes 0 and 1
|
||||||
status = 4 #report connector locked
|
status = 4 #report connector locked
|
||||||
msg = can.Message(arbitration_id=0x109, data=[ 10, 0, 0, 0, 0, 0, 0, 0], is_extended_id=False)
|
msg = can.Message(arbitration_id=0x109, data=[ 10, self.chargerVoltage & 0xFF, self.chargerVoltage >> 8, self.chargerCurrent, 0, status, 0, 0], is_extended_id=False)
|
||||||
self.canbus.send(msg)
|
self.canbus.send(msg)
|
||||||
|
|
||||||
if message.arbitration_id == 0x102:
|
if message.arbitration_id == 0x102:
|
||||||
|
|
Loading…
Reference in a new issue