Example #1
0
        //解析实时数据
        public XD100nData Read_nowdata(byte[] inByte)
        {
            XD100nData _rdata = new XD100nData();
            _rdata._dt = DateTime.Now;
            _rdata._outsideTemp = (float)Math.Round(DataInfo.GetLongValue2(inByte, 15) / 10.0, 1);
            _rdata._oneGiveTemp = (float)Math.Round(DataInfo.GetLongValue2(inByte, 17) / 10.0, 1);
            _rdata._oneBackTemp = (float)Math.Round(DataInfo.GetLongValue2(inByte, 19) / 10.0, 1);
            _rdata._twoGiveTemp = (float)Math.Round(DataInfo.GetLongValue2(inByte, 21) / 10.0, 1);
            _rdata._twoBackTemp = (float)Math.Round(DataInfo.GetLongValue2(inByte, 23) / 10.0, 1);

            _rdata._oneGivePress = (float)Math.Round(DataInfo.GetLongValue2(inByte, 25) / 1000.0, 2);
            _rdata._oneBackPress = (float)Math.Round(DataInfo.GetLongValue2(inByte, 27) / 1000.0, 2);
            _rdata._twoGivePress = (float)Math.Round(DataInfo.GetLongValue2(inByte, 29) / 1000.0, 2);
            _rdata._twoBackPress = (float)Math.Round(DataInfo.GetLongValue2(inByte, 31) / 1000.0, 2);

            _rdata._openDegree = (float)Math.Round(DataInfo.GetLongValue2(inByte, 33) / 10.0, 1);
            _rdata._WatBoxLevel = (float)Math.Round(DataInfo.GetLongValue2(inByte, 35) / 100.0, 1);

            _rdata._oneInstant = (float)Math.Round(DataInfo.GetFloatValue2(inByte, 37), 1);
            _rdata._oneAccum = DataInfo.GetULongValue2(inByte, 41);

            _rdata._oneHeat = (float)Math.Round(DataInfo.GetFloatValue2(inByte, 45), 1);
            _rdata._oneAddHeat = DataInfo.GetULongValue2(inByte, 49) / 10d;

            _rdata._twoInstant = (float)Math.Round(DataInfo.GetFloatValue2(inByte, 65), 1);
            _rdata._twoAccum = DataInfo.GetULongValue2(inByte, 69);

            _rdata._twoHeat = (float)Math.Round(DataInfo.GetFloatValue2(inByte, 73), 1);
            _rdata._twoAddHeat = DataInfo.GetULongValue2(inByte, 77) / 10d;

            _rdata._subInstant = (float)Math.Round(DataInfo.GetFloatValue2(inByte, 53), 1);
            _rdata._subAccum = DataInfo.GetULongValue2(inByte, 57);

            byte statebyte = DataInfo.GetByteValue(inByte, 86);
            GRPumpState grPumpState = PumpParse(statebyte);
            _rdata._pump = grPumpState;
            byte[] warnbyte = new byte[2];
            warnbyte[1] = DataInfo.GetByteValue(inByte, 88);
            warnbyte[0] = DataInfo.GetByteValue(inByte, 87);
            GRAlarmData grAlarmData = AlarmParse(warnbyte);
            _rdata._alarm = grAlarmData;

            _rdata._twoGiveBaseTemp = (float)Math.Round(DataInfo.GetLongValue2(inByte, 97) / 10.0, 1);
            _rdata._twoPressCha = (float)Math.Round(DataInfo.GetLongValue2(inByte, 99) / 100.0, 2);
            _rdata._twoBackBasePress = (float)Math.Round(DataInfo.GetLongValue2(inByte, 101) / 100.0, 2);
            XDRZInfo xdrz = new XDRZInfo();
            xdrz._station._StationId = _sID;
            xdrz._nowDatas = _rdata;
            return _rdata;
        }
Example #2
0
 public void InsertSql(XDRZInfo bd)
 {
     string str = string.Format("INSERT INTO tb_rzrealdata (StationId,DT,oneGiveTemp,oneBackTemp,twoGiveTemp,twoBackTemp,outsideTemp,twoGiveBaseTemp,oneGivePress,oneBackPress,WatBoxLevel,twoGivePress,twoBackPress,twoBackBasePress,oneInstant,oneAccum,subInstant,subAccum,oneHeat,oneAddHeat,twoInstant,twoAccum,twoHeat,twoAddHeat,twoPressCha,openDegree,pumpState1,pumpState2,pumpState3,addPumpState1,addPumpState2,alarmword) VALUES ({0},'{1}',{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21},{22},{23},{24},{25},'{26}','{27}','{28}','{29}','{30}',{31})",
         bd._station._StationId, bd._nowDatas._dt, bd._nowDatas._oneGiveTemp, bd._nowDatas._oneBackTemp, bd._nowDatas._twoGiveTemp, bd._nowDatas._twoBackTemp, bd._nowDatas._outsideTemp, bd._nowDatas._twoGiveBaseTemp, bd._nowDatas._oneGivePress, bd._nowDatas._oneBackPress, bd._nowDatas._WatBoxLevel, bd._nowDatas._twoGivePress, bd._nowDatas._twoBackPress, bd._nowDatas._twoBackBasePress, bd._nowDatas._oneInstant, bd._nowDatas._oneAccum, bd._nowDatas._subInstant, bd._nowDatas._subAccum, bd._nowDatas._oneHeat, bd._nowDatas._oneAddHeat, bd._nowDatas._twoInstant, bd._nowDatas._twoAccum, bd._nowDatas._twoHeat, bd._nowDatas._twoAddHeat, bd._nowDatas._twoPressCha, bd._nowDatas._openDegree, bd._nowDatas._pump._cycPump1, bd._nowDatas._pump._cycPump2, bd._nowDatas._pump._cycPump3, bd._nowDatas._pump._recruitPump1, bd._nowDatas._pump._recruitPump2,bd._nowDatas._alarm._word);
     Tool.DB.runCmd(str);
     if (bd._nowDatas._alarm._all == GRAlarm.有)
     {
         str = string.Format("INSERT INTO tb_rzalarmdata (StationId,DT,powercut,watboxdlow,watboxdhight,addPump2break,addPump1break,Pump3break,Pump2break,Pump1break,watboxalow,watboxahight,twoGiveTempH,oneGiveTempL,twoBackPressL,twoBackPressH,oneGivePressL) VALUES ({0},'{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}')", bd._station._StationId, bd._nowDatas._dt, bd._nowDatas._alarm._diaodian, bd._nowDatas._alarm._kaiguandi, bd._nowDatas._alarm._kaiguangao, bd._nowDatas._alarm._bushuibeng2, bd._nowDatas._alarm._bushuibeng1, bd._nowDatas._alarm._xunhuanbeng3, bd._nowDatas._alarm._xunhuanbeng2, bd._nowDatas._alarm._xunhuanbeng1, bd._nowDatas._alarm._shuiweidi, bd._nowDatas._alarm._shuiweigao, bd._nowDatas._alarm._ercigonggaowen, bd._nowDatas._alarm._yicigongdiwen, bd._nowDatas._alarm._ercihuidiya, bd._nowDatas._alarm._ercihuigaoya, bd._nowDatas._alarm._yicigongdiya);
         Tool.DB.runCmd(str);
     }
 }