//泵状态解析 public static xd100x.PumpState PumpParse(byte state) { xd100x.PumpState grPs = new xd100x.PumpState(); grPs._CM1 = DataInfo.GetPumpState(state, 0); grPs._CM2 = DataInfo.GetPumpState(state, 1); grPs._CM3 = DataInfo.GetPumpState(state, 2); grPs._RM1 = DataInfo.GetPumpState(state, 3); grPs._RM2 = DataInfo.GetPumpState(state, 4); return(grPs); }
//数据解析区域 #region Read //解析实时数据 public static xd100x.Data Read_ai(byte[] inByte) { xd100x.Data _rdata = new xd100x.Data(); _rdata._dt = DateTime.Now; _rdata._OT = (float)Math.Round(DataInfo.GetLongValue2(inByte, 15) / 10.0, 1); _rdata._GT1 = (float)Math.Round(DataInfo.GetLongValue2(inByte, 17) / 10.0, 1); _rdata._BT1 = (float)Math.Round(DataInfo.GetLongValue2(inByte, 19) / 10.0, 1); _rdata._GT2 = (float)Math.Round(DataInfo.GetLongValue2(inByte, 21) / 10.0, 1); _rdata._BT2 = (float)Math.Round(DataInfo.GetLongValue2(inByte, 23) / 10.0, 1); _rdata._GP1 = (float)Math.Round(DataInfo.GetLongValue2(inByte, 25) / 1000.0, 2); _rdata._BP1 = (float)Math.Round(DataInfo.GetLongValue2(inByte, 27) / 1000.0, 2); _rdata._GP2 = (float)Math.Round(DataInfo.GetLongValue2(inByte, 29) / 1000.0, 2); _rdata._BP2 = (float)Math.Round(DataInfo.GetLongValue2(inByte, 31) / 1000.0, 2); _rdata._OD = (float)Math.Round(DataInfo.GetLongValue2(inByte, 33) / 10.0, 1); _rdata._WL = (float)Math.Round(DataInfo.GetLongValue2(inByte, 35) / 100.0, 1); _rdata._WI1 = (float)Math.Round(DataInfo.GetFloatValue2(inByte, 37), 1); _rdata._WS1 = DataInfo.GetULongValue2(inByte, 41); _rdata._HS1 = (float)Math.Round(DataInfo.GetFloatValue2(inByte, 45), 1); _rdata._HI1 = DataInfo.GetULongValue2(inByte, 49) / 10d; _rdata._WI2 = (float)Math.Round(DataInfo.GetFloatValue2(inByte, 65), 1); _rdata._WS2 = DataInfo.GetULongValue2(inByte, 69); _rdata._HS2 = (float)Math.Round(DataInfo.GetFloatValue2(inByte, 73), 1); _rdata._HI2 = DataInfo.GetULongValue2(inByte, 77) / 10d; _rdata._WI3 = (float)Math.Round(DataInfo.GetFloatValue2(inByte, 53), 1); _rdata._WS3 = DataInfo.GetULongValue2(inByte, 57); byte statebyte = DataInfo.GetByteValue(inByte, 86); xd100x.PumpState grPumpState = PumpParse(statebyte); _rdata._pump = grPumpState; byte[] warnbyte = new byte[2]; warnbyte[1] = DataInfo.GetByteValue(inByte, 88); warnbyte[0] = DataInfo.GetByteValue(inByte, 87); xd100x.AlarmState grAlarmData = AlarmParse(warnbyte); _rdata._alarm = grAlarmData; _rdata._GTB2 = (float)Math.Round(DataInfo.GetLongValue2(inByte, 97) / 10.0, 1); _rdata._PA2 = (float)Math.Round(DataInfo.GetLongValue2(inByte, 99) / 100.0, 2); _rdata._BPB2 = (float)Math.Round(DataInfo.GetLongValue2(inByte, 101) / 100.0, 2); return(_rdata); }
//解析实时数据 public static xd100x.Data Read_ai(byte[] inByte) { xd100x.Data _rdata = new xd100x.Data(); _rdata._dt = DateTime.Now; _rdata._GTB2 = (float)Math.Round(DataInfo.GetFloatValue(inByte, 15), 1); _rdata._PA2 = (float)Math.Round(DataInfo.GetFloatValue(inByte, 19), 2); _rdata._BPB2 = (float)Math.Round(DataInfo.GetFloatValue(inByte, 23), 2); _rdata._OT = (float)Math.Round(DataInfo.GetFloatValue(inByte, 27), 1); _rdata._GT1 = (float)Math.Round(DataInfo.GetFloatValue(inByte, 31), 1); _rdata._BT1 = (float)Math.Round(DataInfo.GetFloatValue(inByte, 35), 1); _rdata._GT2 = (float)Math.Round(DataInfo.GetFloatValue(inByte, 39), 1); _rdata._BT2 = (float)Math.Round(DataInfo.GetFloatValue(inByte, 43), 1); _rdata._GP1 = (float)Math.Round(DataInfo.GetFloatValue(inByte, 47), 2); _rdata._BP1 = (float)Math.Round(DataInfo.GetFloatValue(inByte, 51), 2); _rdata._GP2 = (float)Math.Round(DataInfo.GetFloatValue(inByte, 55), 2); _rdata._BP2 = (float)Math.Round(DataInfo.GetFloatValue(inByte, 59), 2); _rdata._OD = DataInfo.GetByteValue(inByte, 63); _rdata._WL = (float)Math.Round(DataInfo.GetFloatValue(inByte, 64), 2); _rdata._WI1 = (float)Math.Round(DataInfo.GetFloatValue(inByte, 68), 1); _rdata._WI3 = (float)Math.Round(DataInfo.GetFloatValue(inByte, 72), 1); _rdata._HS1 = (float)Math.Round(DataInfo.GetFloatValue(inByte, 76), 1); _rdata._HS2 = (float)Math.Round(DataInfo.GetFloatValue(inByte, 80), 1); _rdata._WI2 = (float)Math.Round(0f, 1); _rdata._WS1 = DataInfo.GetULongValue(inByte, 84); _rdata._WS3 = DataInfo.GetULongValue(inByte, 88); _rdata._HI1 = DataInfo.GetULongValue(inByte, 92); _rdata._HI2 = DataInfo.GetULongValue(inByte, 96); _rdata._WS2 = 0; byte[] warnbyte = new byte[2]; warnbyte[0] = DataInfo.GetByteValue(inByte, 101); warnbyte[1] = DataInfo.GetByteValue(inByte, 102); xd100x.AlarmState grAlarmData = AlarmParse(warnbyte); _rdata._alarm = grAlarmData; byte statebyte = DataInfo.GetByteValue(inByte, 103); xd100x.PumpState grPumpState = PumpParse(statebyte); _rdata._pump = grPumpState; return(_rdata); }