//设置上下限压力 public static byte[] Set_addpumpmm(byte address, xd100x.addpumpmm amm) { int[] buffer = { Convert.ToInt16(amm._presshight * 100), Convert.ToInt16(amm._presslow * 100), Convert.ToInt16(amm._levelhight * 100), Convert.ToInt16(amm._levellow * 100) }; return(DataInfo.ModbusSetData(address, 0x10, 189, buffer)); }
//解析补水泵压力上下限和水箱水位上下限 public static xd100x.addpumpmm Read_addpumpmm(byte[] inByte) { xd100x.addpumpmm amm = new xd100x.addpumpmm(); amm._presshight = (float)Math.Round(DataInfo.GetLongValue2(inByte, 3) / 100.0, 2); amm._presslow = (float)Math.Round(DataInfo.GetLongValue2(inByte, 5) / 100.0, 2); amm._levelhight = (float)Math.Round(DataInfo.GetLongValue2(inByte, 7) / 100.0, 2); amm._levellow = (float)Math.Round(DataInfo.GetLongValue2(inByte, 9) / 100.0, 2); return(amm); }
//解析补水压力上下限 水箱水位上下限 public static xd100x.addpumpmm Read_addpumpmm(byte[] inByte) { xd100x.addpumpmm sam = new xd100x.addpumpmm(); sam._presshight = DataInfo.GetFloatValue(inByte, 8); sam._presslow = DataInfo.GetFloatValue(inByte, 12); sam._levelhight = DataInfo.GetFloatValue(inByte, 16); sam._levellow = DataInfo.GetFloatValue(inByte, 20); return(sam); }
//设置补水压力上下限 水箱水位上下限 public static byte[] Set_addpumpmm(byte address, xd100x.addpumpmm apmm) { byte[] t1 = BitConverter.GetBytes(apmm._presshight); byte[] t2 = BitConverter.GetBytes(apmm._presslow); byte[] t3 = BitConverter.GetBytes(apmm._levelhight); byte[] t4 = BitConverter.GetBytes(apmm._levellow); byte[] buffer = { 79, 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)); }