mirror of
https://github.com/uhi22/pyPLC.git
synced 2024-11-20 01:13:58 +00:00
feature: scoping of claralog
This commit is contained in:
parent
f7b14fb42e
commit
8c1e04f243
2 changed files with 14 additions and 47 deletions
|
@ -33,26 +33,6 @@ directory = 'local/pcaps_to_convert'
|
||||||
nLimitNumberOfPackets = -1
|
nLimitNumberOfPackets = -1
|
||||||
|
|
||||||
|
|
||||||
def getManufacturerFromMAC(strMAC):
|
|
||||||
# Examples based on https://macvendors.com/, and https://www.ipchecktool.com/tool/macfinder and own experience
|
|
||||||
if (strMAC[0:5]=="ec:a2"):
|
|
||||||
return "Kempower"
|
|
||||||
if (strMAC[0:8]=="dc:44:27"):
|
|
||||||
return "Tesla"
|
|
||||||
if (strMAC[0:8]=="ce:25:1a"):
|
|
||||||
return "Alpitronic"
|
|
||||||
if (strMAC[0:8]=="1a:a9:8e"):
|
|
||||||
return "Alpitronic"
|
|
||||||
if (strMAC[0:8]=="e8:eb:1b"):
|
|
||||||
return "Microchip (maybe ABB)"
|
|
||||||
if (strMAC[0:8]=="68:27:19"):
|
|
||||||
return "Microchip (maybe ABB)"
|
|
||||||
if (strMAC[0:8]=="80:1f:12"):
|
|
||||||
return "Microchip (maybe Compleo)"
|
|
||||||
if (strMAC[0:5]=="18:d7"):
|
|
||||||
return "(maybe Siemens)"
|
|
||||||
return "(unknown vendor)"
|
|
||||||
|
|
||||||
# Examples of the decoder result:
|
# Examples of the decoder result:
|
||||||
#"EVSEPresentVoltage.Multiplier": "0",
|
#"EVSEPresentVoltage.Multiplier": "0",
|
||||||
#"EVSEPresentVoltage.Value": "318",
|
#"EVSEPresentVoltage.Value": "318",
|
||||||
|
@ -93,45 +73,29 @@ def convertClaralogToTxt(inputFileName):
|
||||||
decoded=exiConnector.exiDecode(strExi, pre)
|
decoded=exiConnector.exiDecode(strExi, pre)
|
||||||
#print(decoded)
|
#print(decoded)
|
||||||
print(decoded, file=fileOut)
|
print(decoded, file=fileOut)
|
||||||
if (decoded.find("SessionSetupReq")>0):
|
print(decoded)
|
||||||
if ((t1CableCheckBegin>0) and (t2PreChargeBegin>t1CableCheckBegin) and (t3CurrentDemandBegin>t2PreChargeBegin)):
|
strTimeStamp = line[line.find("[")+1 : line.find("]")]
|
||||||
print("charger MAC " + chargerMAC + " " + getManufacturerFromMAC(chargerMAC))
|
print(strTimeStamp)
|
||||||
timeForCableCheck = t2PreChargeBegin - t1CableCheckBegin
|
|
||||||
timeForPreCharge = t3CurrentDemandBegin - t2PreChargeBegin
|
|
||||||
print("timeForCableCheck= " + ("%.3f" % timeForCableCheck))
|
|
||||||
print("timeForPreCharge= " + ("%.3f" % timeForPreCharge))
|
|
||||||
print(chargerMAC + ";" + getManufacturerFromMAC(chargerMAC) + ";" + \
|
|
||||||
"timeForCableCheck;" + ("%.3f" % timeForCableCheck) + ";" + \
|
|
||||||
"timeForPreCharge; " + ("%.3f" % timeForPreCharge), file=fileOutStatistics)
|
|
||||||
t1CableCheckBegin = 0
|
|
||||||
t2PreChargeBegin = 0
|
|
||||||
t3CurrentDemandBegin = 0
|
|
||||||
if (decoded.find("CableCheckReq")>0) and (t1CableCheckBegin==0):
|
|
||||||
t1CableCheckBegin = float(packet.sniff_timestamp)
|
|
||||||
chargerMAC = str(packet.eth.dst)
|
|
||||||
if (decoded.find("PreChargeReq")>0) and (t2PreChargeBegin==0):
|
|
||||||
t2PreChargeBegin = float(packet.sniff_timestamp)
|
|
||||||
if (decoded.find("CurrentDemandReq")>0) and (t3CurrentDemandBegin==0):
|
|
||||||
t3CurrentDemandBegin = float(packet.sniff_timestamp)
|
|
||||||
try:
|
try:
|
||||||
jsondict = json.loads(decoded)
|
jsondict = json.loads(decoded)
|
||||||
try:
|
try:
|
||||||
u = combineValueAndMultiplier(jsondict["EVSEPresentVoltage.Value"], jsondict["EVSEPresentVoltage.Multiplier"])
|
u = combineValueAndMultiplier(jsondict["EVSEPresentVoltage.Value"], jsondict["EVSEPresentVoltage.Multiplier"])
|
||||||
print("[" + str(packet.sniff_time) + "] EVSEPresentVoltage=" + str(u), file=fileOutValues)
|
print("[" + strTimeStamp + "] EVSEPresentVoltage=" + str(u), file=fileOutValues)
|
||||||
i = combineValueAndMultiplier(jsondict["EVSEPresentCurrent.Value"], jsondict["EVSEPresentCurrent.Multiplier"])
|
i = combineValueAndMultiplier(jsondict["EVSEPresentCurrent.Value"], jsondict["EVSEPresentCurrent.Multiplier"])
|
||||||
print("[" + str(packet.sniff_time) + "] EVSEPresentCurrent=" + str(i), file=fileOutValues)
|
print("[" + strTimeStamp + "] EVSEPresentCurrent=" + str(i), file=fileOutValues)
|
||||||
except:
|
except:
|
||||||
|
print("no present voltage")
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
u = combineValueAndMultiplier(jsondict["EVTargetVoltage.Value"], jsondict["EVTargetVoltage.Multiplier"])
|
u = combineValueAndMultiplier(jsondict["EVTargetVoltage.Value"], jsondict["EVTargetVoltage.Multiplier"])
|
||||||
print("[" + str(packet.sniff_time) + "] EVTargetVoltage=" + str(u), file=fileOutValues)
|
print("[" + strTimeStamp + "] EVTargetVoltage=" + str(u), file=fileOutValues)
|
||||||
i = combineValueAndMultiplier(jsondict["EVTargetCurrent.Value"], jsondict["EVTargetCurrent.Multiplier"])
|
i = combineValueAndMultiplier(jsondict["EVTargetCurrent.Value"], jsondict["EVTargetCurrent.Multiplier"])
|
||||||
print("[" + str(packet.sniff_time) + "] EVTargetCurrent=" + str(i), file=fileOutValues)
|
print("[" + strTimeStamp + "] EVTargetCurrent=" + str(i), file=fileOutValues)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
soc = jsondict["DC_EVStatus.EVRESSSOC"]
|
soc = jsondict["DC_EVStatus.EVRESSSOC"]
|
||||||
print("[" + str(packet.sniff_time) + "] EVRESSSOC=" + str(soc), file=fileOutValues)
|
print("[" + strTimeStamp + "] EVRESSSOC=" + str(soc), file=fileOutValues)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
except:
|
except:
|
||||||
|
|
7
scope.py
7
scope.py
|
@ -79,12 +79,15 @@ c.create_line(x0Scope, y0Scope, x0Scope, y0Scope+ySizeScope, fill="#FFFFFF")
|
||||||
c.create_line(x0Scope+xSizeScope, y0Scope+ySizeScope, x0Scope+xSizeScope, y0Scope, fill="#FFFFFF")
|
c.create_line(x0Scope+xSizeScope, y0Scope+ySizeScope, x0Scope+xSizeScope, y0Scope, fill="#FFFFFF")
|
||||||
c.create_line(x0Scope+xSizeScope, y0Scope+ySizeScope, x0Scope, y0Scope+ySizeScope, fill="#FFFFFF")
|
c.create_line(x0Scope+xSizeScope, y0Scope+ySizeScope, x0Scope, y0Scope+ySizeScope, fill="#FFFFFF")
|
||||||
|
|
||||||
inputFileName = "local/pcaps_to_convert/ccm_spi_ioniq_compleo_full_charge_sequence_ended_on_charger.txt.pcap.values.txt"
|
#inputFileName = "local/pcaps_to_convert/ccm_spi_ioniq_compleo_full_charge_sequence_ended_on_charger.txt.pcap.values.txt"
|
||||||
|
inputFileName = "local/pcaps_to_convert/johu_2023-12-10_log_ionity.claralog.values.txt"
|
||||||
fileIn = open(inputFileName, 'r')
|
fileIn = open(inputFileName, 'r')
|
||||||
Lines = fileIn.readlines()
|
Lines = fileIn.readlines()
|
||||||
|
|
||||||
# yellow green blue red orange
|
# yellow green blue red orange
|
||||||
channelColors = ["#FFFF00", "#10FF10", "#4040FF", "#FF4040", "#FFC000" ]
|
#channelColors = ["#FFFF00", "#10FF10", "#4040FF", "#FF4040", "#FFC000" ]
|
||||||
|
channelColors = ["#FFFF00", "#10FF10" ]
|
||||||
|
|
||||||
numberOfChannels = len(channelColors)
|
numberOfChannels = len(channelColors)
|
||||||
print(str(numberOfChannels) + " channels")
|
print(str(numberOfChannels) + " channels")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue