Пример #1
0
 //获取补水压力上下限 水箱水位上下限
 public static byte[] Get_addpumpmm(byte address)
 {
     return(DataInfo.xd100GetData(address, 20, 79));
 }
Пример #2
0
 //获取压差曲线
 public static byte[] Get_cycpumpline(byte address)
 {
     return(DataInfo.xd100GetData(address, 0x3e));
 }
Пример #3
0
 //获取循环泵压差设定
 public static byte[] Get_cycpumpvalue(byte address)
 {
     return(DataInfo.xd100GetData(address, 0x40, 0x4b));
 }
Пример #4
0
 //获取调节阀控制模式
 public static byte[] Get_valvecontrol(byte address)
 {
     return(DataInfo.xd100GetData(address, 20, 71));
 }
Пример #5
0
 //获取调节阀开度上下限
 public static byte[] Get_valvemm(byte address)
 {
     return(DataInfo.xd100GetData(address, 20, 73));
 }
Пример #6
0
 //获取二次回温度修正
 public static byte[] Get_BT2revise(byte address)
 {
     return(DataInfo.xd100GetData(address, 20, 35));
 }
Пример #7
0
 //设置室外温度设置
 public static byte[] Set_outtemp(byte address, xd100x.outtemp ot)
 {
     byte[] t1     = BitConverter.GetBytes(ot._outtemp);
     byte[] buffer = { t1[0], t1[1], t1[2], t1[3] };
     return(DataInfo.SetData(address, 0x29, buffer));
 }
Пример #8
0
 //解析室外温度模式
 public static xd100x.outmode Read_outmode(byte[] inByte)
 {
     xd100x.outmode om = new xd100x.outmode();
     om._outmode = DataInfo.GetByteValue(inByte, 7);
     return(om);
 }
Пример #9
0
 //解析室外温度值
 public static xd100x.outtemp Read_outtemp(byte[] inByte)
 {
     xd100x.outtemp op = new xd100x.outtemp();
     op._outtemp = DataInfo.GetFloatValue(inByte, 8);
     return(op);
 }
Пример #10
0
 //解析设置值
 public static xd100x.valvevalue Read_valvevalue(byte[] inByte)
 {
     xd100x.valvevalue vv = new xd100x.valvevalue();
     vv._value = DataInfo.GetFloatValue(inByte, 9);
     return(vv);
 }
Пример #11
0
 //解析循环泵压差设定
 public static xd100x.cycpumpvalue Read_cycpumpvalue(byte[] inByte)
 {
     xd100x.cycpumpvalue cv = new xd100x.cycpumpvalue();
     cv._pressure = DataInfo.GetFloatValue(inByte, 8);
     return(cv);
 }
Пример #12
0
 //数据解析区域
 #region Read
 //解析设置类型
 public static xd100x.valvecontrol Read_valvecontrol(byte[] inByte)
 {
     xd100x.valvecontrol vc = new xd100x.valvecontrol();
     vc._control = DataInfo.GetByteValue(inByte, 8);
     return(vc);
 }
Пример #13
0
 //补水泵启动
 public static byte[] Set_addpumprun(byte address)
 {
     return(DataInfo.SetData(address, 0x33));
 }
Пример #14
0
 //补水泵停
 public static byte[] Set_addpumpstop(byte address)
 {
     return(DataInfo.SetData(address, 0x32));
 }
Пример #15
0
 //获取报警设置温度液位
 public static byte[] Get_alarmt(byte address)
 {
     return(DataInfo.xd100GetData(address, 20, 82));
 }
Пример #16
0
        //数据处理逻辑
        #region
        //xd100n数据处理
        public static void Deal_XD100Data(byte[] inbyte, string ip)
        {
            //检测是否为xd100n数据
            //判断依据  1、CRC 2、ip 3、器件地址
            if (false == DataInfo.CheckCRC(inbyte))
            {
                return;
            }

            if (inbyte[0] != 0x21 || inbyte[1] != 0x58 || inbyte[2] != 0x44 || inbyte[4] != 0xa0)
            {
                return;
            }

            int busfferlistID = -1;

            for (int i = 0; i < xd100x._XD100xBuffer.Length; i++)
            {
                if (xd100x._XD100xBuffer[i]._Info._ip == ip && xd100x._XD100xBuffer[i]._Info._addr == inbyte[3])
                {
                    busfferlistID = i;
                    break;
                }
            }

            if (busfferlistID == -1)
            {
                return;
            }

            //实时数据 功能码30
            if (inbyte[5] == 30)
            {
                xd100x._XD100xBuffer[busfferlistID]._Data      = Read_ai(inbyte);
                xd100x._XD100xBuffer[busfferlistID]._SaveDatas = true;
                TimeSpan ts = DateTime.Now - Convert.ToDateTime(xd100x._XD100xBuffer[busfferlistID]._Data._dt);
                if (ts.TotalMinutes > 3)
                {
                    if (DateTime.Now.Date != Convert.ToDateTime(xd100x._XD100xBuffer[busfferlistID]._Data._dt).Date)
                    {
                        Tool.xd100x._XD100xBuffer[busfferlistID]._Command[42]._cmd   = Tool.xd100.Set_datetime(Tool.xd100x._XD100xBuffer[busfferlistID]._Info._addr);
                        Tool.xd100x._XD100xBuffer[busfferlistID]._Command[42]._onoff = true;
                    }
                }
                //2012
                if (SocketServer.Program.basedeviceid == xd100x._XD100xBuffer[busfferlistID]._Info._id)
                {
                    SocketServer.Program.baseouttemp = Tool.xd100x._XD100xBuffer[busfferlistID]._Data._OT;
                    SocketServer.Program.isseted     = false;
                }
            }
            //获取调节阀控制模式调节阀设定值
            if (inbyte[5] == 20 && inbyte[7] == 0x47)
            {
                xd100x._XD100xBuffer[busfferlistID]._Set._valvecontrol = Read_valvecontrol(inbyte);
                xd100x._XD100xBuffer[busfferlistID]._Set._valvevalue   = Read_valvevalue(inbyte);
            }
            //获取调节阀温度曲线
            if (inbyte[5] == 20 && inbyte[7] == 0x48)
            {
                xd100x._XD100xBuffer[busfferlistID]._Set._valveline = Read_valveline(inbyte);
                xd100x._XD100xBuffer[busfferlistID]._Set._valvetime = Read_valvetime(inbyte);
            }
            //获取调节阀开度上下限
            if (inbyte[5] == 20 && inbyte[7] == 0x49)
            {
                xd100x._XD100xBuffer[busfferlistID]._Set._valvemm = Read_valvemm(inbyte);
            }
            //获取压差曲线
            if (inbyte[5] == 0x3E)
            {
                xd100x._XD100xBuffer[busfferlistID]._Set._cycpumpline = Read_cycpumpline(inbyte);
            }
            //获取循环泵压差设定
            if (inbyte[5] == 0x40)
            {
                xd100x._XD100xBuffer[busfferlistID]._Set._cycpumpvalue = Read_cycpumpvalue(inbyte);
            }
            //获取补水泵压力设定
            if (inbyte[5] == 20 && inbyte[7] == 0x4d)
            {
                xd100x._XD100xBuffer[busfferlistID]._Set._addpumpvalue = Read_addpumpvalue(inbyte);
            }
            //获取补水压力上下限 水箱水位上下限
            if (inbyte[5] == 20 && inbyte[7] == 0x4f)
            {
                xd100x._XD100xBuffer[busfferlistID]._Set._addpumpmm = Read_addpumpmm(inbyte);
            }
            //获取报警设置压力
            if (inbyte[5] == 20 && inbyte[7] == 0x51)
            {
                xd100x._XD100xBuffer[busfferlistID]._Set._alarmp = Read_alarmp(inbyte);
            }
            //获取报警设置温度液位
            if (inbyte[5] == 20 && inbyte[7] == 0x52)
            {
                xd100x._XD100xBuffer[busfferlistID]._Set._alarmt = Read_alarmt(inbyte);
            }
            //获取室外温度模式 没有此功能
            //if (inbyte[5] == 40)
            //{
            //  xd100x._XD100xBuffer[busfferlistID]._Set._outmode = Read_outmode(inbyte);
            //}
            //获取室外温度值
            if (inbyte[5] == 20 && inbyte[7] == 0x1f)
            {
                xd100x._XD100xBuffer[busfferlistID]._Set._outtemp = Read_outtemp(inbyte);
            }
            //获取室外温度修正
            if (inbyte[5] == 20 && inbyte[7] == 31)
            {
                xd100x._XD100xBuffer[busfferlistID]._Set._outrevise       = Read_temprevise(inbyte);
                xd100x._XD100xBuffer[busfferlistID]._Set._outrevise._temp = xd100x._XD100xBuffer[busfferlistID]._Data._OT;
            }
            //获取室外温度修正
            if (inbyte[5] == 20 && inbyte[7] == 32)
            {
                xd100x._XD100xBuffer[busfferlistID]._Set._GT1revise       = Read_temprevise(inbyte);
                xd100x._XD100xBuffer[busfferlistID]._Set._GT1revise._temp = xd100x._XD100xBuffer[busfferlistID]._Data._GT1;
            }
            //获取室外温度修正
            if (inbyte[5] == 20 && inbyte[7] == 33)
            {
                xd100x._XD100xBuffer[busfferlistID]._Set._BT1revise       = Read_temprevise(inbyte);
                xd100x._XD100xBuffer[busfferlistID]._Set._BT1revise._temp = xd100x._XD100xBuffer[busfferlistID]._Data._BT1;
            }
            //获取室外温度修正
            if (inbyte[5] == 20 && inbyte[7] == 34)
            {
                xd100x._XD100xBuffer[busfferlistID]._Set._GT2revise       = Read_temprevise(inbyte);
                xd100x._XD100xBuffer[busfferlistID]._Set._GT2revise._temp = xd100x._XD100xBuffer[busfferlistID]._Data._GT2;
            }
            //获取室外温度修正
            if (inbyte[5] == 20 && inbyte[7] == 35)
            {
                xd100x._XD100xBuffer[busfferlistID]._Set._BT2revise       = Read_temprevise(inbyte);
                xd100x._XD100xBuffer[busfferlistID]._Set._BT2revise._temp = xd100x._XD100xBuffer[busfferlistID]._Data._BT2;
            }
            //设定成功返回
            if (inbyte[5] == 10)
            {
            }
            //主动上报报警
            if (inbyte[5] == 32)
            {
                xd100x._XD100xBuffer[busfferlistID]._Data._alarm = Read_alarmstate(inbyte);
                return;
            }
            xd100x._XD100xBuffer[busfferlistID]._Command[xd100x._XD100xBuffer[busfferlistID]._LastCommandIndex]._onoff         = false;
            xd100x._XD100xBuffer[busfferlistID]._Command[xd100x._XD100xBuffer[busfferlistID]._LastCommandIndex]._retrytimesnow = 0;
            xd100x._XD100xBuffer[busfferlistID]._Command[xd100x._XD100xBuffer[busfferlistID]._LastCommandIndex]._backdt        = DateTime.Now;
            xd100x._XD100xBuffer[busfferlistID]._Command[xd100x._XD100xBuffer[busfferlistID]._LastCommandIndex]._back          = true;
            xd100x._XD100xBuffer[busfferlistID]._Command[xd100x._XD100xBuffer[busfferlistID]._LastCommandIndex]._send          = false;
            xd100x._XD100xBuffer[busfferlistID]._Info._state = true;

            //只要有数据返回即解除ISocketRS占用
            Gprs.Gprs_IsOccupy(xd100x._XD100xBuffer[busfferlistID]._Info._ip, false);
        }
Пример #17
0
 //获取室外温度模式
 public static byte[] Get_outmode(byte address)
 {
     return(DataInfo.xd100GetData(address, 40));
 }
Пример #18
0
        //数据处理方法
        #region
        //读取命令生成区域
        #region Get

        //获取当前数据
        public static byte[] Get_ai(byte address)
        {
            return(DataInfo.xd100GetData(address, 30));
        }
Пример #19
0
 //设置调节阀开度上下限
 public static byte[] Set_valvemm(byte address, xd100x.valvemm vm)
 {
     byte[] buffer = { 73, Convert.ToByte(vm._min), Convert.ToByte(vm._max), Convert.ToByte(vm._deatharea) };
     return(DataInfo.SetData(address, 21, buffer));
 }
Пример #20
0
 //设置室外温度设置
 public static byte[] Set_outmode(byte address, xd100x.outmode om)
 {
     byte[] buffer = { Convert.ToByte(om._outmode) };
     return(DataInfo.SetData(address, 0x28, buffer));
 }