예제 #1
0
    def parseobj(self,IdString,DataString):
        if IdString=="770":
            try:
                toRet={"PlugPower HearthBeat":1}
            except Exception as e:
                toRet={"PlugPower HearthBeat":str(e)}

        elif IdString=="1F0":
            BattVolt = getBytes(DataString, 0, 16) / 100
            V_measured = BattVolt
            Current = (getBytes(DataString, 2, 16)-65536) / 10
            Temperature = getBytes(DataString, 4, 16) / 100
            SOC = getBytes(DataString, 1, 8)


            toRet = "[0-1] {:3.3f}Volts<br>".format(SOC)
            toRet +="[2-3] I:{}Amps<br>".format(Current)
            toRet +="[4-5]T:{}C<br>".format(Temperature)
            toRet +="[7] SOC:{}%\n{:<80s}{:1.2f}V/cell   ".format(SOC, " ", BattVolt / 40)
            toRet2 = {"BattVolt"     : V_measured,
                      "Current"     : Current,
                      "Temperature" : Temperature,
                      "SOC"         : SOC
                      }
        """
예제 #2
0
    def parse(self, IdString, DataString):
        if IdString == "226":  # bytes 0&1 :tbd     bytes2,3,4,5:measured voltage       bytes 6&7:current
            self.isNBL = True
            self.isloader = False
            lineDesc = ""
            toRet = " NBL PLC CMD<br><br>"
            toRet =   "[0:0] 0x{:04X} Command = {} bit1: brake<br>" + \
                    lineDesc + "[1,7] 0x{} <br> "

            toRet = toRet.format((getBytes(DataString, 0, 8)),
                                 getBytes(DataString, 0, 8), 0)

        return toRet
예제 #3
0
    def parse(self,IdString,DataString):
        if IdString=="770":
            try:
                toRet="PlugPower HearthBeat:"
            except Exception as e:
                toRet="PlugPower HearthBeat "+str(e)

        elif IdString=="1F0":

            SOC = getBytes(DataString, 1, 8)
            decodeing=FCerror
            """FCfulltravel := FuelCell_RX.DATA[2].0;
            FClimptravel := FuelCell_RX.DATA[2].1;
            FCfullhydr := FuelCell_RX.DATA[2].2;
            FClimphydr := FuelCell_RX.DATA[2].3;

            FCerror :=			FuelCell_RX.DATA[0].0;
            FCenable	:=		FuelCell_RX.DATA[0].1;
            FCloadshed	:=	FuelCell_RX.DATA[0].2;
            FCrefuel	:=		FuelCell_RX.DATA[0].3;
            FChighwater	:=	FuelCell_RX.DATA[0].4;
            FCews	:=			FuelCell_RX.DATA[0].5;
            FClowfuel	:=		FuelCell_RX.DATA[0].6;

            """
            toRet = "[ 1 ] {} % SOC<br>".format(SOC)
            toRet +="[2-3] I:{}Amps<br>".format(Current)
            toRet +="[4-5]T:{}C<br>".format(Temperature)
            toRet +="[7] SOC:{}%\n{:<80s}{:1.2f}V/cell   ".format(SOC, " ", BattVolt / 40)
            return toRet

        else:
            toRet="?"
        return toRet
예제 #4
0
    def parse(self, IdString, DataString):
        toRet = "GreenCube: "
        toRet += " id:0x{:02X}\t".format(int(IdString, 16) & 0x7F)

        if IdString in ["19C", "38C"]:
            datastr = DataString
            SOC = str(int(datastr[0:2], 16))
            Status = bin(int(datastr[3:5], 16))[2:].zfill(8)
            Voltage = getBytes(DataString, 2, 32)

            Current = int(datastr[18:20], 16) + 256 * (int(datastr[21:23], 16))
            Current = getBytes(DataString, 6, 16)


            toRet = toRet + \
                "Batterie 19c   SOC(0):" + SOC + \
                "\tStatus(1):" + Status + \
                "\tVoltage(2-5):" + str(int(1000 * Voltage / 1024) / 1000) + \
                "\t\r\nI(6-7):" + str(0 + Current / 15)

        elif IdString in ["29C", "48C"]:
            datastr = DataString
            DisVoltageLimit = int(
                datastr[6:8],
                16) + 256 * int(datastr[9:11], 16) + 256 * 256 * int(
                    datastr[12:14], 16) + 256 * 256 * 256 * int(
                        datastr[15:17], 16)
            MaxDisCurrent = int(datastr[0:2],
                                16) + 256 * (int(datastr[3:5], 16))
            Temperature = int(datastr[18:20],
                              16) + 256 * (int(datastr[21:23], 16))
            toRet = toRet + \
                    "Batterie 29c   VMin: " + str(int(1000 * DisVoltageLimit / 1024) / 1000) + \
                    "\tImax:" + str(MaxDisCurrent / 16) + \
                    "\tTemp:" + str(Temperature / 8) + \
                    "\t" + str(getBytes(datastr, 2, 32) / 1024)

        elif IdString in ["39C", "28C"]:
            toRet = toRet + "Batterie 39c ?:" + str(getBytes(
                DataString, 0, 32)) + " == " + str(
                    getBytes(DataString, 0, 16) / 16)
        elif IdString == "71C":
            toRet = "GreenCube HB"
        else:
            toRet += IdString
        return toRet
예제 #5
0
    def parse(self, IdString, DataString):
        if IdString == "72A":
            try:
                toRet = "Acuity HearthBeat:"
            except Exception as e:
                toRet = "Acuity HearthBeat " + str(e)

        elif IdString == "1AA":
            BattVolt = getBytes(DataString, 0, 16) / 100
            V_measured = BattVolt
            Current = (getBytes(DataString, 2, 16) - 65536) / 10
            Temperature = getBytes(DataString, 4, 16) / 100
            SOC = getBytes(DataString, 7, 8)

            toRet = "[0-1] {:3.3f}Volts<br>".format(BattVolt)
            toRet += "[2-3] I:{}Amps<br>".format(Current)
            toRet += "[4-5]T:{}C<br>".format(Temperature)
            toRet += "[7] SOC:{}%\n{:<80s}{:1.2f}V/cell   ".format(
                SOC, " ", BattVolt / 40)
            return toRet

        elif IdString == "4AA":
            ss = getBytes(DataString, 0, 8)
            mm = getBytes(DataString, 1, 8)
            hh = getBytes(DataString, 2, 8)
            Tstr = "{}:{}:{}".format(hh, mm, ss)
            return "Real-Time-Clock " + Tstr
        elif IdString == "2AA":
            return "Acuity BAttery Stats"
        else:
            toRet = "?"
        return toRet
예제 #6
0
    def parse(self, IdString, DataString):
        toRet = "NBL Pump   :"
        # toRet += " 0x{:02X}\t".format(int(IdString, 16) & 0x7F)
        lineDesc = toRet
        ##########################

        if IdString == "1A8":
            toRet = toRet + "unknown nbl"

        elif IdString == "3A8":  # bytes 0&1 :tbd     bytes2,3,4,5:measured voltage       bytes 6&7:current
            toRet = toRet + "unknown nbl"
        elif IdString == "2A8":  # bytes 0&1 :tbd     bytes2,3,4,5:measured voltage       bytes 6&7:current
            toRet = toRet + " NBL Pump<br>" + \
                    lineDesc + "[2,3] 0x{:04X}  = {}<br>" + \
                    lineDesc + "[4,5] 0x{:04X}  = {}<br> " + \
                    lineDesc + "[6,7] 0x{:04X} Pump Current = {}<br>"
            toRet = toRet.format((getBytes(DataString, 2, 16)),
                                 getBytes(DataString, 2,
                                          16), (getBytes(DataString, 4, 16)),
                                 getBytes(DataString, 4, 16),
                                 (getBytes(DataString, 6, 16)),
                                 getBytes(DataString, 6, 16))
        elif IdString == "1A7":
            toRet = toRet + " NBL Pump command to Drive<br>"
            toRet = toRet + " Pump Status    /  Fault Flash Code PUmp<br>" \
                            """CAN_Pump_hourmeter_ON					bit	CAN_Pump_status.1<br>
        CAN_Pump_Drive_disable				bit	CAN_Pump_status.2<br>
        CAN_Pump_Ignition_protection	bit	CAN_Pump_status.4<br>
        CAN_Belt_hourMeter_ON					bit	CAN_Pump_status.8<br>
        CAN_Pump_faulted_flag					bit	CAN_Pump_status.16		"""
        return toRet
예제 #7
0
    def parse(self, IdString, DataString):
        if IdString == "72C":
            toRet = "HearthBeat ACT "

        elif IdString == "22C":  # bytes 0&1 :tbd     bytes2,3,4,5:measured voltage       bytes 6&7:current
            Volts = getBytes(DataString, 2, 32)
            toRet  = "ACT msg<br>" \
                     "[0:1] {} -----------> Charger Status: {} <br>".format(DataString[0:6],DataString[0:6])
            toRet += "[2,3,4,5] {} -> Output Voltage: {:2.1f} Volts   <br>".format(
                DataString[6:18], Volts / 1024)
            toRet += "[6,7] {} -----------> Output Current: {:3.1f} Amps".format(
                DataString[18:24],
                getBytes(DataString, 6, 16) / 16)

        elif IdString == "1AC":
            #VoltLimit
            Volts = int(getBytes(DataString, 2, 32))
            Current = getBytes(DataString, 6, 16)
            toRet = "ACT ctrl msg<br>" \
                    "[0-1] {} -------> ??? <br>" \
                    "[2-5] {} -> MeasuredVolts: {:2.1f} Volts - {:2.1f}V *** /1000 or /1024<br>" \
                    "[6-7] {} -------> Max_Current :  {} Amps".format( DataString[0:6],DataString[6:17],Volts/1000, Volts/1024, DataString[18:26],Current/10)

        elif IdString == "2AC":
            ChargeStatus = getBytes(DataString, 0, 8)
            SOC = getBytes(DataString, 1, 8)
            TemperatureH = getBytes(DataString, 2, 8)
            TemperatureL = getBytes(DataString, 3, 8)
            Voltage = getBytes(DataString, 4, 32)
            toRet  = "ACT ctrl msg<br>" \
                     "[ 0 ] {} ----------> Charge_Mode: {}<br>".format(DataString[0:2],ChargeStatus)
            toRet += "[ 1 ] {} ----------> Battery_SOC: {}% <br>".format(
                DataString[3:5], SOC)
            toRet += "[4-7] {} -> Max_Voltage: {:2.1f}V - {:2.1f}V *** /1000 or /1024".format(
                DataString[12:24], float(Voltage / 1000),
                float(Voltage / 1024))
            #print("Voltage: {}".format(float(Voltage/1000)))return toRet

        return toRet
예제 #8
0
    def parse(self,IdString,DataString):
        toRet =""
        if IdString == "2F0":
            Voltage=getBytes(DataString,0,16)/10
            Current=getBytes(DataString,2,16)

            if Current & 0x8000:
                Current = (0xFFFF-Current)/10
            else:
                Current = Current/10

            SOC=getBytes(DataString,4,8)
            Capacity=getBytes(DataString,5,8)
            StatusFlag=getBytes(DataString,6,8)
            StatFlag2=getBytes(DataString,7,8)

            toRet += "2f0   {}V \t{}Amps \tSOC:{}%\tCapacity:{}\tStatus: {} {}".format(Voltage,Current,SOC,Capacity,StatusFlag,StatFlag2)

        elif IdString == "2F1":
            CellMaxVolt=getBytes(DataString,0,16)/1000
            CellMaxPos=getBytes(DataString,2,16)
            CellMinVolt=getBytes(DataString,4,16)/1000
            CellMinPos=getBytes(DataString,6,16)

            toRet += "2f1   CellMax:{}V  idx:{:08b}\t\t\nCellMin:{}V idx:{:08b}".format(CellMaxVolt,CellMaxPos,CellMinVolt,CellMinPos)
        elif IdString == "2F2":
            CellMaxTemp=getBytes(DataString,0,16)/10
            CellMaxPos=getBytes(DataString,2,16)
            CellMinTemp=getBytes(DataString,4,16)/10
            CellMinPos=getBytes(DataString,6,16)

            toRet += "2f2   CellMax:{}C   idx:{:08b}\t\t CellMin{}C idx:{:08b}".format(CellMaxTemp,CellMaxPos,CellMinTemp,CellMinPos)

        elif IdString == "2F3":
            DischargeHours=getBytes(DataString,0,16)
            ChargeHours=getBytes(DataString,2,16)
            RelayFlags=getBytes(DataString,4,8)
            PackSafetyFlag=getBytes(DataString,5,8)
            PackStatusFlag=getBytes(DataString,6,8)
            PLCFaultCode=getBytes(DataString,7,8)
            toRet += "2f3   DiscHrs:{}\tChargeHrs:{}  RelayFlags:{}\tSafetyFlags:{}   PLC_Fault:{}".format(DischargeHours,ChargeHours,RelayFlags,PackSafetyFlag,PackStatusFlag,PLCFaultCode)

        elif IdString == "326":
            MaxDiscCurrent = (0x7FFF & getBytes(DataString,0,16))/10
            MaxChargeCurrent=getBytes(DataString,2,16)/10

            ChargeVoltageRequires = getBytes(DataString,4,16)
            ChargerCurrentRequires= getBytes(DataString,6,16)
            toRet += "326   MaxDisCurrent:{}\t\tMaxFeedBackCurrent:{}<br>" \
                     "ChargeVoltageRequires:{}   ChargeCurrentRequires:{}".format(MaxDiscCurrent,MaxChargeCurrent,ChargeVoltageRequires,ChargerCurrentRequires)

        elif IdString== "189":
            toRet += "189 Charger ACInput Current, DOD, SOH, Pack status"
        elif IdString== "289":
            toRet += "289 sub packs status"
        elif IdString== "389":
            toRet += "389 System fault code"
        elif IdString== "489":
            ChargerCurrentDC = getBytes(DataString,4,16)
            ChargingRemainingTime = getBytes(DataString,6,16)
            toRet += "489"
        elif IdString== "2F4":
            toRet += "2F4 Heating Status"
        elif IdString== "2F5":

            toRet += "2F5 software Rev:"+getBytes(DataString,0,8)+'.'+getBytes(DataString,1,8)+'.'+getBytes(DataString,2,8)
        elif IdString== "20A":

            toRet += "20A "+getBytes(DataString,0,8)+'.'+getBytes(DataString,1,8)+'.'+getBytes(DataString,2,8)
        elif IdString== "20B":

            toRet += "20B "+getBytes(DataString,0,8)+'.'+getBytes(DataString,1,8)+'.'+getBytes(DataString,2,8)
        return toRet
예제 #9
0
    def parse(self, IdString, DataString):
        value = getBytes(DataString, 0, -32)

        toRet = "CurrentSensor +++: {:>03.3f} Amps ".format(value / 1000)
        return toRet
예제 #10
0
    def parse(self, IdString, DataString):
        self.IdString = IdString
        self.DataString = DataString

        toRet = "PUMP   :"
        #toRet += " 0x{:02X}\t".format(int(IdString, 16) & 0x7F)
        lineDesc = toRet
        ##########################

        if IdString == "70B":
            toRet = toRet + "HearthBeat"

        elif IdString == "8B":  # bytes 0&1 :tbd     bytes2,3,4,5:measured voltage       bytes 6&7:current
            toRet = toRet + "Emergency"

        elif IdString == "20B":  # bytes 0&1 :tbd     bytes2,3,4,5:measured voltage       bytes 6&7:current
            toRet = toRet + " PLC CMD<br><br>"+\
                    lineDesc+"[2,3] 0x{:04X} throttle = {}<br>"+ \
                    lineDesc+"[4,5] 0x{:04X} pump nominalspeed = {}<br> "+ \
                    lineDesc+"[6,7] 0x{:04X} pump percent = {}<br>"
            toRet = toRet.format((getBytes(DataString, 2, 16)),
                                 getBytes(DataString, 2,
                                          16), (getBytes(DataString, 4, 16)),
                                 getBytes(DataString, 4, 16),
                                 (getBytes(DataString, 6, 16)),
                                 getBytes(DataString, 6, 16))
            toRet = toRet + " PLC CMD<br><br>"
            toRet += "[2,3] 0x{:04X} throttle = {}          <br>".format(
                self.CanData(2, 16), self.CanData(2, 16))
            toRet += "[4,5] 0x{:04X} pump nominalspeed = {} <br>".format(
                self.CanData(4, 16), self.CanData(4, 16))
            toRet += "[6,7] 0x{:04X} pump percent = {}      <br>".format(
                self.CanData(6, 16), self.CanData(6, 16))

        elif IdString == "30B":  # bytes 0&1 :tbd     bytes2,3,4,5:measured voltage       bytes 6&7:current
            toRet = toRet + " PLC CMD<br><br>"

        elif hex(int("0x" + IdString, 16) & 0x7F0) == "0x180":
            toRet = lineDesc + "[0,1] 0x{:04X} inputCurrent = {}<br>" + \
                    lineDesc + "[4,5] 0x{:04X} motor RPM = {}<br> " + \
                    lineDesc + "[6,7] 0x{:04X} motorCurrent = {}<br>"
            toRet = toRet.format((getBytes(DataString, 2, 16)),
                                 getBytes(DataString, 2,
                                          16), (getBytes(DataString, 4, 16)),
                                 getBytes(DataString, 4, 16),
                                 (getBytes(DataString, 6, 16)),
                                 getBytes(DataString, 6, 16))

        elif hex(int("0x" + IdString, 16) & 0x7F0) == "0x280":
            toRet = lineDesc + "[0,1] 0x{:04X} R_Input = {}<br>" + \
                    lineDesc + "[2,3] 0x{:04X} CurtisVoltage = {}<br> " + \
                    lineDesc + "[4,5] 0x{:04X} Motor Temp = {}<br> " + \
                    lineDesc + "[6,7] 0x{:04X} Drive Temp = {}<br>"
            toRet = toRet.format(
                (getBytes(DataString, 0, 16)),
                getBytes(DataString, 0, 16), (getBytes(DataString, 2, 16)),
                getBytes(DataString, 2, 16), (getBytes(DataString, 4, 16)),
                getBytes(DataString, 4, 16), (getBytes(DataString, 6, 16)),
                getBytes(DataString, 6, 16))
            toRet = " PLC CMD<br><br>"
            toRet += "[0,1] 0x{:04X} R_Input = {}<br>       ".format(
                self.CanData(0, 16), self.CanData(0, 16))
            toRet += "[2,3] 0x{:04X} CurtisVoltage = {} V<br> ".format(
                self.CanData(2, 16),
                self.CanData(2, 16) / 100)
            toRet += "[4,5] 0x{:04X} Motor Temp = {} C<br>    ".format(
                self.CanData(4, 16),
                self.CanData(4, 16) / 10)
            toRet += "[6,7] 0x{:04X} Drive Temp = {} C<br>    ".format(
                self.CanData(6, 16),
                self.CanData(6, 16) / 10)
        """
        From VCL
        (* PDO T1 *)
            PDO_T1.DATA[2] := WORD_TO_BYTE(INT_TO_WORD(INT_VCLThrottleCommand) AND 16#00FF);
            PDO_T1.DATA[3] := WORD_TO_BYTE(SHR(INT_TO_WORD(INT_VCLThrottleCommand) AND 16#FF00,8));

            PDO_T1.DATA[4] := WORD_TO_BYTE(W_RegenNominalSpeed AND 16#00FF);
            PDO_T1.DATA[5] := WORD_TO_BYTE(SHR(W_RegenNominalSpeed AND 16#FF00,8));

            PDO_T1.DATA[6] := WORD_TO_BYTE(W_RegenPercent AND 16#00FF);
            PDO_T1.DATA[7] := WORD_TO_BYTE(SHR(W_RegenPercent AND 16#FF00,8));

        (* PDO T2 *)
            (*PDO_T2.DATA[0] := WORD_TO_BYTE(INT_TO_WORD(G_BatteryCurrent) AND 16#00FF);*)
            PDO_T2.DATA[0] := WORD_TO_BYTE(G_BatteryLevel AND 16#00FF);
            (*PDO_T2.DATA[1] := WORD_TO_BYTE(SHR(INT_TO_WORD(G_BatteryCurrent) AND 16#FF00,8));*)
            PDO_T2.DATA[1] := WORD_TO_BYTE(SHR(G_BatteryLevel AND 16#FF00,8));
        """

        # print("toRet:",toRet)
        return toRet
예제 #11
0
 def CanData(self, position, type):
     return getBytes(self.DataString, position, type)
예제 #12
0
    def parse(self, IdString, DataString):
        toRet = "Traction   :"
        #toRet += " 0x{:02X}\t".format(int(IdString, 16) & 0x7F)
        lineDesc = toRet
        ##########################

        if IdString == "70C":
            toRet = ""
            lineDesc = ""
            toRet = toRet + "HB"
        elif IdString == "20C":  # bytes 0&1 :tbd     bytes2,3,4,5:measured voltage       bytes 6&7:current
            toRet = toRet + " PLC CMD<br><br>"+\
                    lineDesc+"[2:3] 0x{:04X} throttle = {}<br>"+ \
                    lineDesc+"[4,5] 0x{:04X} pump nominalspeed = {}<br> "+ \
                    lineDesc+"[6,7] 0x{:04X} pump percent = {}<br>"
            toRet = toRet.format((getBytes(DataString, 2, 16)),
                                 getBytes(DataString, 2,
                                          16), (getBytes(DataString, 4, 16)),
                                 getBytes(DataString, 4, 16),
                                 (getBytes(DataString, 6, 16)),
                                 getBytes(DataString, 6, 16))
            toRet = toRet + " PLC CMD<br><br>"
        elif hex(int("0x" + IdString, 16) & 0x7F0) == "0x180":
            toRet = lineDesc + "[0,1] 0x{:04X} inputCurrent = {}<br>" + \
                    lineDesc + "[4,5] 0x{:04X} motor RPM = {}<br> " + \
                    lineDesc + "[6,7] 0x{:04X} motorCurrent = {}<br>"
            toRet = toRet.format((getBytes(DataString, 2, 16)),
                                 getBytes(DataString, 2,
                                          16), (getBytes(DataString, 4, 16)),
                                 getBytes(DataString, 4, 16),
                                 (getBytes(DataString, 6, 16)),
                                 getBytes(DataString, 6, 16))
        elif hex(int("0x" + IdString, 16) & 0x7F0) == "0x280":
            toRet = lineDesc + "[0,1] 0x{:04X} R_Input = {}<br>" + \
                    lineDesc + "[2,3] 0x{:04X} CurtisVoltage = {}<br> " + \
                    lineDesc + "[4,5] 0x{:04X} Motor Temp = {}<br> " + \
                    lineDesc + "[6,7] 0x{:04X} Drive Temp = {}<br>"
            toRet = toRet.format(
                (getBytes(DataString, 0, 16)),
                getBytes(DataString, 0, 16), (getBytes(DataString, 2, 16)),
                getBytes(DataString, 2, 16), (getBytes(DataString, 4, 16)),
                getBytes(DataString, 4, 16), (getBytes(DataString, 6, 16)),
                getBytes(DataString, 6, 16))
        else:
            toRet += " 18C " + IdString + "--" + hex(
                int("0x" + IdString, 16)
                & 0x7F0) + "<" + hex(int("0x" + IdString, 16) & 0x7F8) + "<"
        """
        # 180
        F PDO_R1.AVAILABLE>0 THEN
        R_InputCurrent := (BYTE_TO_REAL(PDO_R1.DATA[0])+BYTE_TO_REAL(PDO_R1.DATA[1])*256)/10;
        IF R_InputCurrent > 3276.8 THEN
            R_InputCurrent := REAL_TO_INT(R_InputCurrent - 6553.6);
        END_IF
        INT_MotorRPM := BYTE_TO_INT(PDO_R1.DATA[4])+BYTE_TO_INT(PDO_R1.DATA[5])*256;
        INT_MotorCurrent := (BYTE_TO_INT(PDO_R1.DATA[6])+BYTE_TO_INT(PDO_R1.DATA[7])*256)/10;


        ID:280
        R_Input1:= (BYTE_TO_REAL(PDO_R2.DATA[0]) + BYTE_TO_REAL(PDO_R2.DATA[1]) * 256) / 9.2;
        CurtisVoltage:= (BYTE_TO_REAL(PDO_R2.DATA[2]) + BYTE_TO_REAL(PDO_R2.DATA[3]) * 256) / 100;
        I_MotorTemperature:= (BYTE_TO_INT(PDO_R2.DATA[4]) + BYTE_TO_INT(PDO_R2.DATA[5]) * 256) / 10;
        I_CurtisTemperature:= (BYTE_TO_INT(PDO_R2.DATA[6]) + BYTE_TO_INT(PDO_R2.DATA[7]) * 256) / 10;
        (*To
        be
        setup
        by
        curtis in PAR
        file *)"""
        # print("toRet:",toRet)
        return toRet
예제 #13
0
    def parse(self,IdString,DataString):
        parseData = {"fct": "Regen" }

        toRet="REGEN   :"
        #toRet += " 0x{:02X}\t".format(int(IdString, 16) & 0x7F)
        lineDesc = toRet
        ##########################
        if IdString == "70D":
            toRet = toRet + "HearthBeat"


        elif IdString == "20D":  # bytes 0&1 :tbd     bytes2,3,4,5:measured voltage       bytes 6&7:current
            toRet = toRet + " PLC CMD<br><br>" + \
                    lineDesc + "[2:3] 0x{:04X} throttle = {}<br>" + \
                    lineDesc + "[4,5] 0x{:04X} pump nominalspeed = {}<br> " + \
                    lineDesc + "[6,7] 0x{:04X} pump percent = {}<br>"
            toRet = toRet.format(
                (getBytes(DataString, 2, 16)), getBytes(DataString, 2, 16),
                (getBytes(DataString, 4, 16)), getBytes(DataString, 4, 16),
                (getBytes(DataString, 6, 16)), getBytes(DataString, 6, 16))
        elif IdString == "30D":  # bytes 0&1 :tbd     bytes2,3,4,5:measured voltage       bytes 6&7:current
            toRet = toRet + " PLC CMD<br><br>"
        elif hex(int("0x"+IdString,16) & 0x7F0) == "0x180":
            toRet = lineDesc + "[0,1] 0x{:04X} inputCurrent = {}<br>" + \
                    lineDesc + "[4,5] 0x{:04X} motor RPM = {}<br> " + \
                    lineDesc + "[6,7] 0x{:04X} motorCurrent = {}<br>"
            toRet = toRet.format(
                (getBytes(DataString, 2, 16)), getBytes(DataString, 2, 16),
                (getBytes(DataString, 4, 16)), getBytes(DataString, 4, 16),
                (getBytes(DataString, 6, 16)), getBytes(DataString, 6, 16))
        elif hex(int("0x" + IdString, 16) & 0x7F0) == "0x280":
            toRet = lineDesc + "[0,1] 0x{:04X} R_Input = {}<br>" + \
                    lineDesc + "[2,3] 0x{:04X} CurtisVoltage = {}<br> " + \
                    lineDesc + "[4,5] 0x{:04X} Motor Temp = {}<br> " + \
                    lineDesc + "[6,7] 0x{:04X} Drive Temp = {}<br>"
            toRet = toRet.format(
                (getBytes(DataString, 0, 16)), getBytes(DataString, 0, 16),
                (getBytes(DataString, 2, 16)), getBytes(DataString, 2, 16),
                (getBytes(DataString, 4, 16)), getBytes(DataString, 4, 16),
                (getBytes(DataString, 6, 16)), getBytes(DataString, 6, 16))
        # print("toRet:",toRet)
        return toRet
예제 #14
0
    def parse(self,IdString,DataString):
        toRet = "NBL Drive   :"
        # toRet += " 0x{:02X}\t".format(int(IdString, 16) & 0x7F)
        lineDesc = toRet
        ##########################

        if IdString == "1A6":
            toRet = toRet + " NBL Drive<br><br>" + \
                    lineDesc + "[0,1] 0x{:04X}  = Switches{}<br>" + \
                    lineDesc + "[2,2] 0x{:04X}  = CAN_Controller_outputs {}<br>" + \
                    lineDesc + "[3,3] 0x{:04X}  = Drive_state{}<br> " + \
                    lineDesc + "[4,5] 0x{:04X}  = Pump_HM_scaled{}<br> " + \
                    lineDesc + "[6,7] 0x{:04X}  = Trac_HM_scaled{}<br>"
            toRet = toRet.format(
                (getBytes(DataString, 0, 16)), getBytes(DataString, 0, 16),
                (getBytes(DataString, 2,  8)), getBytes(DataString, 2, 8),
                (getBytes(DataString, 3,  8)), getBytes(DataString, 3, 8),
                (getBytes(DataString, 4, 16)), getBytes(DataString, 4, 16),
                (getBytes(DataString, 6, 16)), getBytes(DataString, 6, 16))
            """Purpose        	 Send Message to IFM Module.
                    ; Type           	 PDO1_MISO
                    ; Standard COB ID	- 0x1a6
                    Setup_Mailbox(CAN1,PDO_MISO,0,38,C_CYCLIC,C_XMT,0,0)
                    Setup_Mailbox_Data(CAN1,8,
                            @Switches,
                            @Switches+USEHB,
                            @CAN_Controller_outputs,
                            @Drive_state,
                            @Pump_HM_scaled,
                            @Pump_HM_scaled+USEHB,
                            @Trac_HM_scaled,
                            @Trac_HM_scaled+USEHB)			"""

        elif IdString == "3A6":  # bytes 0&1 :tbd     bytes2,3,4,5:measured voltage       bytes 6&7:current
            toRet = toRet + " NBL Drive<br><br>" + \
                    lineDesc + "[0,6] {}  = Status 1-7<br>" + \
                    lineDesc + "[7,7] {}  = UserFault <br>"
            toRet = toRet.format(
                DataString[:21],
                DataString[21:]
            )
            """
            ; MAILBOX 3
                    ; Purpose        	 Send Message to IFM Module.
                    ; Type           	 PDO3_MISO
                    ; Standard COB ID	- 0x3a6
                    Setup_Mailbox(CAN3,PDO3_MISO,0,38,C_CYCLIC,C_XMT,0,0)
                    Setup_Mailbox_Data(CAN3,8,
                            @Status1,
                            @Status2,
                            @Status3,
                            @Status4,
                            @Status5,
                            @Status6,
                            @Status7,
                            @UserFault1)
                """
        elif IdString == "2A6":  # bytes 0&1 :tbd     bytes2,3,4,5:measured voltage       bytes 6&7:current
            toRet = toRet + " NBL Drive<br><br>" + \
                    lineDesc + "[0,1] 0x{:04X} KSI = {}<br>" + \
                    lineDesc + "[2,3] 0x{:04X} Phas Current = {}<br>" + \
                    lineDesc + "[4,5] 0x{:04X} Batt Current = {}<br> " + \
                    lineDesc + "[6,7] 0x{:04X} Motor RPM = {}<br>"
            toRet = toRet.format(
                (getBytes(DataString, 0, 16)), getBytes(DataString, 0, 16),
                (getBytes(DataString, 2, 16)), getBytes(DataString, 2, 16),
                (getBytes(DataString, 4, 16)), getBytes(DataString, 4, 16),
                (getBytes(DataString, 6, 16)), getBytes(DataString, 6, 16))
            """
            ; MAILBOX 2
                    ; Purpose        	 Send Message to IFM Module.
                    ; Type           	 PDO2_MISO
                    ; Standard COB ID	- 0x2a6
                    Setup_Mailbox(CAN2,PDO2_MISO,0,38,C_CYCLIC,C_XMT,0,0)
                    Setup_Mailbox_Data(CAN2,8,
                            @Keyswitch_voltage,
                            @Keyswitch_voltage+USEHB,
                            @Current_RMS,
                            @Current_RMS+USEHB,
                            @Battery_current,
                            @Battery_current+USEHB,
                            @Motor_RPM,
                            @Motor_RPM+USEHB)
                            """
        elif IdString == "4A6":  # bytes 0&1 :tbd     bytes2,3,4,5:measured voltage       bytes 6&7:current
            toRet = toRet + " NBL Drive<br><br>" + \
                    lineDesc + "[0,1] 0x{:04X} Total HourMeter = {}<br>" + \
                    lineDesc + "[2,3] 0x{:04X} Program Num Low <br>" + \
                    lineDesc + "[4,5] 0x{:04X} Program Num High <br> " + \
                    lineDesc + "[6,7] 0x{:04X} Program Rev = {}<br>"     + \
                    lineDesc + "[6,7] 0x{:04X} BDI = {}%<br>"
            toRet = toRet.format(
                (getBytes(DataString, 0, 16)), getBytes(DataString, 0, 16),
                (getBytes(DataString, 2, 16)),
                (getBytes(DataString, 4, 16)),
                (getBytes(DataString, 6,  8)), getBytes(DataString, 6,  8),
                (getBytes(DataString, 7,  8)), getBytes(DataString, 7, 8))
            """
            ; MAILBOX 4
                    ; Purpose        	 Send Message to IFM Module.
                    ; Type           	 PDO4_MISO
                    ; Standard COB ID	- 0x4a6
                    Setup_Mailbox(CAN4,PDO4_MISO,0,38,C_CYCLIC,C_XMT,0,0)
                    Setup_Mailbox_Data(CAN4,8,
                            @Total_HM_scaled,
                            @Total_HM_scaled+USEHB,
                            @Program_number_LO,
                            @Program_number_LO+USEHB,
                            @Program_number_HI,
                            @Program_number_HI+USEHB,
                            @Program_Revision,
                            @BDI_Percentage)
                            """
        elif IdString == "227":  # bytes 0&1 :tbd     bytes2,3,4,5:measured voltage       bytes 6&7:current
            """ CAN_Start_pump_from_drive			bit	CAN_Pump_Commands.1
                CAN_Disable_Belt							bit	CAN_Pump_Commands.2
                CAN_Neutral_direction_flag		bit	CAN_Pump_Commands.4	"""

            toRet = toRet + " NBL Drive command to PUMP<br><br>" + \
                    lineDesc + "[0,0] 0x{:02X} CAN_Pump_Commands    NeutralDir / Disable Belt / StartPumpFromDrive<br>" + \
                    lineDesc + "[1,2] 0x{:04X} Throttle Command <br>" + \
                    lineDesc + "[3,7] 0x{} Program Num High <br> "

            toRet = toRet.format(
                (getBytes(DataString, 0, 8)), getBytes(DataString, 0, 8),
                (getBytes(DataString, 1, 16)))


        return toRet