/// <summary> /// 读取参数数据部分 /// </summary> /// <param name="data">用户数据</param> /// <param name="refValue">返回结果</param> private void Read_Par(byte[] Data, ref object oPars) { //从机地址 comAdr = Data[7]; //实际闸宽 width = Data[8] * 256 + Data[9]; //闸底高程 bottomHeight = Data[10] * 256 + Data[11]; //自由流系数 freeFlux = Data[12] / 100; //潜流系数 undrFlux = Data[21] / 100; //闸前水位量程 beforeLevel = Data[13] * 256 + Data[14]; //闸后水位量程 behindLevel = Data[15] * 256 + Data[16]; //闸前水位修正 if (Data[17] == 0x43) { beforeCorrect = (int)Data[18]; } if (Data[17] == 0x45) { beforeCorrect = (int)Data[18] * -1; } //闸后水位修正 if (Data[19] == 0x43) { behindCorrect = (int)Data[20]; } if (Data[19] == 0x45) { behindCorrect = (int)Data[20] * -1; } oPars = new Gate_Par(comAdr, width, bottomHeight, freeFlux, undrFlux, beforeLevel, behindLevel, beforeCorrect, behindCorrect); }
/// <summary> /// ��ȡ�������ݲ��� /// </summary> /// <param name="data">�û�����</param> /// <param name="refValue">���ؽ��</param> private void Read_Par(byte[] Data, ref object oPars) { //�ӻ���ַ comAdr = Data[7]; //ʵ��բ�� width = Data[8] * 256 + Data[9]; //բ�߳� bottomHeight = Data[10] * 256 + Data[11]; //������ϵ�� freeFlux = Data[12] / 100; //DZ��ϵ�� undrFlux = Data[21] / 100; //բǰˮλ���� beforeLevel = Data[13] * 256 + Data[14]; //բ��ˮλ���� behindLevel = Data[15] * 256 + Data[16]; //բǰˮλ���� if (Data[17] == 0x43) { beforeCorrect = (int)Data[18]; } if (Data[17] == 0x45) { beforeCorrect = (int)Data[18] * -1; } //բ��ˮλ���� if (Data[19] == 0x43) { behindCorrect = (int)Data[20]; } if (Data[19] == 0x45) { behindCorrect = (int)Data[20] * -1; } oPars = new Gate_Par(comAdr, width, bottomHeight, freeFlux, undrFlux, beforeLevel, behindLevel, beforeCorrect, behindCorrect); }