//解析报警设置 public static xd100x.alarmp Read_alarmp(byte[] inByte) { xd100x.alarmp ap = new xd100x.alarmp(); ap._yicigdiya = (float)Math.Round(DataInfo.GetLongValue2(inByte, 3) / 100.0, 2); ap._erciggaoya = (float)Math.Round(DataInfo.GetLongValue2(inByte, 5) / 100.0, 2); ap._ercihgaoya = (float)Math.Round(DataInfo.GetLongValue2(inByte, 7) / 100.0, 2); ap._ercihdiya = (float)Math.Round(DataInfo.GetLongValue2(inByte, 9) / 100.0, 2); return(ap); }
//解析报警设置压力 public static xd100x.alarmp Read_alarmp(byte[] inByte) { xd100x.alarmp ap = new xd100x.alarmp(); ap._yicigdiya = DataInfo.GetFloatValue(inByte, 8); ap._erciggaoya = DataInfo.GetFloatValue(inByte, 12); ap._ercihgaoya = DataInfo.GetFloatValue(inByte, 16); ap._ercihdiya = DataInfo.GetFloatValue(inByte, 20); return(ap); }
//设置报警设置压力 public static byte[] Set_alarmp(byte address, xd100x.alarmp ap) { byte[] t1 = BitConverter.GetBytes(ap._yicigdiya); byte[] t2 = BitConverter.GetBytes(ap._erciggaoya); byte[] t3 = BitConverter.GetBytes(ap._ercihgaoya); byte[] t4 = BitConverter.GetBytes(ap._ercihdiya); byte[] buffer = { 81, t1[0], t1[1], t1[2], t1[3], t2[0], t2[1], t2[2], t2[3], t3[0], t3[1], t3[2], t3[3], t4[0], t4[1], t4[2], t4[3] }; return(DataInfo.SetData(address, 21, buffer)); }
//设置报警设置压力 public static byte[] Set_alarmp(byte address, xd100x.alarmp ap) { int[] buffer = { Convert.ToInt16(ap._yicigdiya * 100), Convert.ToInt16(ap._erciggaoya * 100), Convert.ToInt16(ap._ercihgaoya * 100), Convert.ToInt16(ap._ercihdiya * 100) }; return(DataInfo.ModbusSetData(address, 0x10, 198, buffer)); }