예제 #1
0
파일: xd100.cs 프로젝트: wwkkww1983/bt
        //解析实时数据
        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);
        }