/// <summary>
        /// 根据数据类型,直接写入主Mapping
        /// </summary>
        /// <param name="points"></param>
        /// <param name="log"></param>
        public static void Register(ref PointDeviceCollcet points, ILog log)
        {
            var boolPointMapping = PointMapping <bool> .GetInstance(log);

            var bytePointMapping = PointMapping <byte> .GetInstance(log);

            var ushortPointMapping = PointMapping <ushort> .GetInstance(log);

            var shortPointMapping = PointMapping <short> .GetInstance(log);

            var uintPointMapping = PointMapping <uint> .GetInstance(log);

            var intPointMapping = PointMapping <int> .GetInstance(log);

            var folatPointMapping = PointMapping <float> .GetInstance(log);

            var doublePointMapping = PointMapping <double> .GetInstance(log);

            var stringPointMapping = PointMapping <string> .GetInstance(log);

            ///注册
            Register(ref points, boolPointMapping, log);
            Register(ref points, bytePointMapping, log);
            Register(ref points, ushortPointMapping, log);
            Register(ref points, shortPointMapping, log);
            Register(ref points, uintPointMapping, log);
            Register(ref points, intPointMapping, log);
            Register(ref points, folatPointMapping, log);
            Register(ref points, doublePointMapping, log);
            Register(ref points, stringPointMapping, log);
        }
        /// <summary>
        /// 根据XML配置文件创建Modbus点表
        /// 并将点表绑定到通用点表(PointMapping)
        /// </summary>
        /// <param name="workBook"></param>
        /// <param name="log"></param>
        /// <returns></returns>
        public static PointVirtualCollcet CreateMoudbus(XMLWorkbook workBook, ILog log)
        {
            PointMeDataList mappingIdexList = PointMeDataList.GetInstance();
            var             result          = new PointVirtualCollcet();
            List <string>   colums          = workBook.llStrings[0];//第一行列表为索引列数据;

            workBook.llStrings.RemoveAt(0);
            foreach (var ls in workBook.llStrings)
            {
                string     addressName = "";
                int        address;
                string     pointName    = "";
                int        bindingIndex = 0;
                BindingWay bindingWay   = BindingWay.OneWay;

                ByteOrder byteOrder = ByteOrder.None;
                if (ls.Count < colums.Count)
                {
                    continue;
                }
                for (int i = 0; i < colums.Count; i++)
                {
                    switch (colums[i].ToLower())
                    {
                    case "addressname":
                        addressName = ls[i];
                        break;

                    case "pointname":
                        var pointGroup = ls[i].Split(new char[] { '[' });

                        if (pointGroup != null && pointGroup.Length >= 2)
                        {
                            pointName     = pointGroup[0];
                            pointGroup[1] = pointGroup[1].Replace("]", "");    //string类型处理,去掉‘]’
                            int.TryParse(pointGroup[1], out bindingIndex);
                        }
                        break;

                    case "bindingway":
                        int temp;
                        if (int.TryParse(ls[i], out temp))
                        {
                            bindingWay = (BindingWay)temp;
                        }
                        break;

                    case "byteorder":
                        int temp1;
                        if (int.TryParse(ls[i], out temp1))
                        {
                            byteOrder = (ByteOrder)temp1;
                        }
                        break;
                    }
                }
                string type;

                /*
                 * ===============================
                 * 1.根据地址名生成相应的Modbus点
                 * 2.根据配置表绑定到对应的主地址表
                 * 3.如果绑定成功则添加到list中
                 * 4。根据不同的绑定类型分为:只读,只写,可读可写
                 * ===============================
                 */

                if (addressName != "" && int.TryParse(addressName, out address) && pointName != "")
                {
                    if (addressName.Substring(0, 1) == "0" || addressName.Substring(0, 1) == "1")
                    {
                        if (mappingIdexList.Find(pointName, out type) && type == ds.ValueType.Bool)
                        {
                            VirtulPoint <bool> boolPoint = new VirtulPoint <bool>(addressName, type)
                            {
                            };
                            var sourcePoint = PointMapping <bool> .GetInstance(log).GetPoint(pointName);

                            if (PointsBinding.BoolBinding(sourcePoint, bindingIndex, boolPoint, bindingWay))
                            {
                                result.BoolPoints.Add(boolPoint);
                            }
                        }
                    }
                    if (addressName.Substring(0, 1) == "3" || addressName.Substring(0, 1) == "4")
                    {
                        if (mappingIdexList.Find(pointName, out type))
                        {
                            VirtulPoint <ushort> ushortPoint1 = new VirtulPoint <ushort>(addressName, ds.ValueType.UInt16);
                            VirtulPoint <ushort> ushortPoint2 = new VirtulPoint <ushort>((address + 1).ToString(), ds.ValueType.UInt16);

                            if (type == ds.ValueType.Byte)
                            {
                                var sourcePoint = PointMapping <byte> .GetInstance(log).GetPoint(pointName);

                                if (PointsBinding.UshortBinding(sourcePoint, bindingIndex, ushortPoint1, bindingWay))
                                {
                                    result.UshortPoints.Add(ushortPoint1);
                                }
                            }
                            if (type == ds.ValueType.Int16)
                            {
                                var sourcePoint = PointMapping <short> .GetInstance(log).GetPoint(pointName);

                                if (PointsBinding.UshortBinding(sourcePoint, bindingIndex, ushortPoint1, bindingWay))
                                {
                                    result.UshortPoints.Add(ushortPoint1);
                                }
                            }
                            if (type == ds.ValueType.UInt16)
                            {
                                var sourcePoint = PointMapping <ushort> .GetInstance(log).GetPoint(pointName);

                                if (PointsBinding.UshortBinding(sourcePoint, bindingIndex, ushortPoint1, bindingWay))
                                {
                                    result.UshortPoints.Add(ushortPoint1);
                                }
                            }
                            if (type == ds.ValueType.Int32)
                            {
                                var sourcePoint = PointMapping <int> .GetInstance(log).GetPoint(pointName);

                                if (PointsBinding.UshortBinding(sourcePoint, bindingIndex, new VirtulPoint <ushort>[] { ushortPoint1, ushortPoint2 }, byteOrder, bindingWay))
                                {
                                    result.UshortPoints.Add(ushortPoint1);
                                    result.UshortPoints.Add(ushortPoint2);
                                }
                            }
                            if (type == ds.ValueType.UInt32)
                            {
                                var sourcePoint = PointMapping <uint> .GetInstance(log).GetPoint(pointName);

                                if (PointsBinding.UshortBinding(sourcePoint, bindingIndex, new VirtulPoint <ushort>[] { ushortPoint1, ushortPoint2 }, byteOrder, bindingWay))
                                {
                                    result.UshortPoints.Add(ushortPoint1);
                                    result.UshortPoints.Add(ushortPoint2);
                                }
                            }
                            if (type == ds.ValueType.Float)
                            {
                                var sourcePoint = PointMapping <float> .GetInstance(log).GetPoint(pointName);

                                if (PointsBinding.UshortBinding(sourcePoint, bindingIndex, new VirtulPoint <ushort>[] { ushortPoint1, ushortPoint2 }, byteOrder, bindingWay))
                                {
                                    result.UshortPoints.Add(ushortPoint1);
                                    result.UshortPoints.Add(ushortPoint2);
                                }
                            }
                        }
                    }
                }
                else
                {
                    log.ErrorLog(string.Format("adderss error or binding point is null!"));
                }
            }
            return(result);
        }