ShuoKeController.cs 23.1 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636
using log4net;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading;

namespace OnlineStore.DeviceLibrary
{
    /// <summary>
    /// 硕科控制模块代码
    /// </summary>
    public class ShuoKeControls
    {
        public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
        private static AcSerialBean bean = null;
        public static bool isRun = false;
        private static Dictionary<int, ShuoKeInfo> shuokeMap = new Dictionary<int, ShuoKeInfo>();
        public static string PortName = "";
        private static int SleepMS = 50;
        private static int DReviceLength = 5;
        #region 串口操作
        public static bool ResertInitPort(string comPortName, int baudRate, int tparity, int dataBits, StopBits stopBits)
        {
            PortName = comPortName;
            if (isRun)
            {
                ClosePort();
            }
            return InitPort(comPortName, baudRate, tparity, dataBits, stopBits);
        }
        public static bool InitPort(string comPortName, int baudRate, int tparity, int dataBits, StopBits stopBits)
        {
            if (isRun)
            {
                return true;
            }
            try
            {
                PortName = comPortName;
                Parity parity = (Parity)tparity;
                bean = new AcSerialBean(comPortName, baudRate, parity, 8, stopBits);
                bool result = bean.openPort();
                if (!result)
                {
                    return false;
                }
                //bean.DataReceived += DataReceived;
                isRun = true;
            }
            catch (Exception ex)
            {
                isRun = false;
                LogUtil.error(LOGGER, "打开步进控制器串口失败:" + ex.ToString());
                return false;
            }
            return true;
        }
        public static void ClosePort()
        {
            isRun = false;
            if (bean == null)
            {
                return;
            }
            bean.closePort();
            LogUtil.info(LOGGER, "关闭步进控制器串口完成");
        }
       
      
        /// <summary>
        /// 发送数据并获取返回值
        /// </summary>
        /// <param name="data">发送的数据</param>
        /// <param name="outTime">超时时间</param>
        /// <returns>返回值的长度</returns>
        public static byte[] SendCommand( byte[] data, int outTime, int reviceLength)
        {
            if (outTime <= 0)
            {
                outTime = 30;
            }
            if (outTime > 80)
            {
                outTime = 80;
            }
            byte[] returnData = null;

            try
            {
                if (data == null)
                {
                    return returnData;
                }
                string strSend = "";
                for (int i = 0; i < data.Length; i++)
                {
                    strSend += string.Format("{0:X2} ", data[i]);
                }
                if (strSend.Equals(""))
                {
                    return returnData;
                }
              
                    LogUtil.debug("串口" + PortName + " 写入数据:" + strSend + "");
                 
              
                if (bean == null)
                {
                    LogUtil.debug(" 试图向未打开串口【" + PortName + "】写入数据:" + strSend + "。");
                }
                else
                {
                    bean.SendCommand(data, ref returnData, outTime, reviceLength);
                }
            }
            catch (Exception ex)
            {
                LogUtil.info(ex.ToString());
            }
            return returnData;
        }

        private static void DataReceived(string portName, object sender, SerialDataReceivedEventArgs e, byte[] bits)
        {
            string strSend = "";
            for (int i = 0; i < bits.Length; i++)
            {
                strSend += string.Format("{0:X2} ", bits[i]);
            }
            if (strSend.Equals(""))
            {
                return;
            }

            //校验
            ushort pChecksum = 0;
            AcSerialBean.CalculateCRC(bits, bits.Length - 2, out pChecksum);
            string checkStr = Convert.ToString(pChecksum, 16);
            byte[] checkByte = AcSerialBean.StringToByte(checkStr);
            if (checkByte.Length == 1)
            {
                if (!bits[bits.Length - 2].Equals(checkByte[0]))
                {
                    bean.clearInBuffer();
                    LogUtil.info(LOGGER, "  【" + portName + "】 收到数据【" + strSend + "】,校验错误");
                    return;
                } 
            }
            else
            {
                if (!bits[bits.Length - 1].Equals(checkByte[0]) || (!bits[bits.Length - 2].Equals(checkByte[1])))
                {
                    bean.clearInBuffer();
                    LogUtil.info(LOGGER, " 【" + portName + "】 收到数据【" + strSend + "】,校验错误");
                    return;
                }
            }

            LogUtil.debug(LOGGER, " 【" + portName + "】 收到数据【" + strSend + "】");
            int slvAddr = (int)bits[0];
            byte cmd = bits[1];
            //查询状态
            if (cmd.Equals(ShuoKeCMD.SearchMoveStatus))
            {
                ShuoKeInfo info = DataToStatus(bits);
             
            }
            else if (cmd.Equals(ShuoKeCMD.GetAbsPosition))
            {
                int position = DataToPosition(bits);
            }
        }
        private static bool CheckByte(byte[] bits)
        {
            string strSend = "";
            if (bits == null)
            {
                return false;
            }
            for (int i = 0; i < bits.Length; i++)
            {
                strSend += string.Format("{0:X2} ", bits[i]);
            } 
            //校验
            ushort pChecksum = 0;
            AcSerialBean.CalculateCRC(bits, bits.Length - 2, out pChecksum);
            string checkStr = Convert.ToString(pChecksum, 16);
            byte[] checkByte = AcSerialBean.StringToByte(checkStr);
            if (checkByte.Length == 1)
            {
                if (!bits[bits.Length - 2].Equals(checkByte[0]))
                {
                    bean.clearInBuffer();
                    LogUtil.info(LOGGER, "【" + PortName + "】收到数据【" + strSend + "】校验错误");
                    return false ;
                }
            }
            else
            {
                if (!bits[bits.Length - 1].Equals(checkByte[0]) || (!bits[bits.Length - 2].Equals(checkByte[1])))
                {
                    bean.clearInBuffer();
                    LogUtil.info(LOGGER, "【" + PortName + "】收到数据【" + strSend + "】校验错误");
                    return false ;
                }
            }return true;
        }
        private static int DataToPosition(byte[] bits)
        {
            int absValue = -1;
            if (!CheckByte(bits))
            {
                return absValue;
            }
            if (bits.Length >= 7)
            {
                int slvAddr = (int)bits[0];
                byte[] positionData = new byte[4];
                Array.Copy(bits, 3, positionData, 0, 4);
                string a = AcSerialBean.byteToHexStr(positionData);
                 absValue = Convert.ToInt32(a, 16);
                LogUtil.debug(LOGGER, "收到驱动器【" + slvAddr + "】绝对位置【" + absValue + "】"); 
                if (shuokeMap.ContainsKey(slvAddr))
                {
                    shuokeMap[slvAddr].LastPosition = absValue;
                }
                else
                {
                    ShuoKeInfo info = new ShuoKeInfo(slvAddr, absValue);
                    shuokeMap.Add(slvAddr, info);
                }
            }
            return absValue;
        }
        private static ShuoKeInfo DataToStatus(byte[] bits)
        {
            ShuoKeInfo info = new ShuoKeInfo(-1, -1);
            if (!CheckByte(bits))
            {
                return info;
            }
            if (bits.Length >= 8)
            {
                //[数据1]:1表示运动中,0表示停止
                //[数据2]:LL-左限位IO状态 1表示有效 0表示无效
                //[数据3]:O-原点IO状态 1表示有效 0表示无效,,=1表示原点灭,=0表示当前原点亮
                // [数据4]:RL-右限位IO状态 1表示有效 0表示无效
                //[数据5]:EN-使能IO状态 1表示有效 0表示无效
                int slvAddr = (int)bits[0];
                byte cmd = bits[1];
                int isInMove = bits[3];
                int isLLimit = bits[4];
                int isOrg = bits[5];
                int isRLimit = bits[6];
                int isEn = bits[7];
                  info = new ShuoKeInfo(isInMove, slvAddr, isLLimit, isOrg, isRLimit, isEn);
                try
                {

                    if (shuokeMap.ContainsKey(slvAddr))
                    {
                        info.LastPosition = shuokeMap[slvAddr].LastPosition;
                        shuokeMap.Remove(slvAddr);
                    }
                    shuokeMap.Add(slvAddr, info);
                }
                catch (Exception ex)
                {
                    LogUtil.error(LOGGER, "记录状态出错:" + ex.ToString());
                }
                LogUtil.debug(LOGGER, "收到驱动器【" + slvAddr + "】运动状态:运动【" + isInMove + "】左限位【" + isLLimit + "】右限位【" + isRLimit + "】原点【" + isOrg + "】使能【" + isEn + "】");
            }
            return info;
        }

        public static int GetLastPosition(int slvAddr)
        {
            if (shuokeMap.ContainsKey(slvAddr))
            {
                ShuoKeInfo info = shuokeMap[slvAddr];
                return info.LastPosition;
            }
            return -1;
        }
        #endregion

        #region 逻辑判断

        public static bool IsMoveEnd(int slvAddr, int targetPosition, DateTime time, out string msg)
        {
            ShuoKeInfo shuokeInfo = GetStatus(slvAddr);
            msg = " IsInMove【" + shuokeInfo.IsInMove + "】 ";
            if (shuokeInfo.IsInMove == 0 && shuokeInfo.UpdateTime > time)
            {
                int position = GetABSPosition(slvAddr);
                msg += "位置【" + position + "】";
                if (Math.Abs(position - targetPosition) < 10 || targetPosition.Equals(-2000))
                {
                    return true;
                }
                else
                {
                    LogUtil.info("【" + PortName + "】 目标位置【" + targetPosition + "】当前位置【" + position + "】,已经不再运动中");
                }
            }
            return false;
        }
       
        //public static bool IsHomeMoveEnd(int slvAddr, DateTime time, out string msg)
        //{
        //    ShuoKeInfo shuokeInfo = GetStatus(slvAddr);
        //    msg = " IsInMove【" + shuokeInfo.IsInMove + "】Org【" + shuokeInfo.Org + "】";
        //    if (shuokeInfo.IsInMove .Equals(0) && shuokeInfo.Org.Equals(0)&&shuokeInfo.UpdateTime>time)
        //    {
        //        return true;
        //    }
        //    //如果是运动结束状态,但原点未到达,直接重新开始运动
        //    else if (shuokeInfo.IsInMove.Equals(0) && shuokeInfo.Org.Equals(1) && shuokeInfo.UpdateTime > time)
        //    {
        //        TimeSpan span = DateTime.Now - lastRHomeTime;
        //        if (span.TotalSeconds > 3)
        //        {
        //            LogUtil.error("【" + PortName + "】已经停止运动但不在原点,重新回原点");
        //            lastRHomeTime = DateTime.Now;
        //            HomeMove(slvAddr);
        //        }
        //    }
        //    return false;
        //}
        #endregion


        #region 驱动器操作方法
        public static ShuoKeInfo GetStatus(int slvAddr)
        {
            byte[] reviceData = SendData(slvAddr, ShuoKeCMD.SearchMoveStatus, 0x00, 0,10); 
            return DataToStatus(reviceData);
        }
        public static void DStoop(int slvAddr)
        {
           byte[] reviceData = SendData(slvAddr, ShuoKeCMD.DStopMove, 0x00, 0,DReviceLength); 
        }
        public static void SuddownStop(int slvAddr)
        {
           byte[] reviceData = SendData(slvAddr, ShuoKeCMD.SuddownStopMove, 0x00, 0, DReviceLength); 
        }
        public static int GetABSPosition(int slvAddr)
        {
           byte[] reviceData = SendData(slvAddr, ShuoKeCMD.GetAbsPosition, 0x00, 0, 9); 
            return DataToPosition(reviceData); 
        }
       
        // <param name="homeType">0=反方向,1=正方向</param>
        public static void HomeMove(int slvAddr, byte homeType=1)
        {
            string fangx = homeType.Equals(0) ? "反方向" : "正方向";
            LogUtil.info("压紧轴原点返回:" + fangx);
           byte[] reviceData = SendData(slvAddr, ShuoKeCMD.HomeMove, 0x01, homeType, DReviceLength); 
           
        }

        public static void SetConfigSpeed(AC_SA_Config Config)
        { 
            ShuoKeControls.SetSpeed(Config.CompressAxis_Slv, ShuoKeCMD.SetAddSpeed, Config.CompressAxis_AddSpeed); 
            ShuoKeControls.SetSpeed(Config.CompressAxis_Slv, ShuoKeCMD.SetDelSpeed, Config.CompressAxis_DelSpeed); 
            ShuoKeControls.SetSpeed(Config.CompressAxis_Slv, ShuoKeCMD.SetEndSpeed, Config.CompressAxis_EndSpeed); 
            ShuoKeControls.SetSpeed(Config.CompressAxis_Slv, ShuoKeCMD.SetHomeSpeed, Config.CompressAxis_HomeSpeed); 
            ShuoKeControls.SetSpeed(Config.CompressAxis_Slv, ShuoKeCMD.SetMaxSpeed, Config.CompressAxis_MaxSpeed); 
            ShuoKeControls.SetSpeed(Config.CompressAxis_Slv, ShuoKeCMD.SetStartSpeed, Config.CompressAxis_StartSpeed);

        }

        public static void VolMove(int slvAddr, int speed)
        { 
           byte[] reviceData = SendData(slvAddr, ShuoKeCMD.VolMove, 0x04, speed, DReviceLength); 
        }

        public static void AbsMove(int slvAddr, int TargetPosition)
        {
            //            47、设置绝对位置并开始运动:不支持广播(开环的32位脉冲统计长度)
            //正负数表示绝对位置,如果已经到位置,则不做运动。(M4505S特有命令)
            //发送: 应答:
            //[设备地址] 0x01 [设备地址] 0x01
            //[命令] 0x50 [命令] 0x50
            //[数据长度] 4 [数据长度] 0
            //[数据] xxxxxxxx [数据] 无
            //[CRC校验1] 0xnn [CRC校验1] 0xnn
            //[CRC校验2] 0xnn [CRC校验2] 0xnn
            //数据:4BYTE,(支持32位有符号脉冲位置)
           byte[] reviceData = SendData(slvAddr, ShuoKeCMD.AbsMove, 0x04, TargetPosition, DReviceLength); 

        }
        public static void RelativeMove(int slvAddr, int position)
        {
            //1是正方向
            byte fangxiang = 0x01;
            if (position < 0)
            {
                fangxiang = 0x00;
                position = Math.Abs(position);
            }
            byte dataLength = 0x04;
            byte[] sendData = new byte[5 + dataLength];
            sendData[0] = (byte)slvAddr;
            sendData[1] = ShuoKeCMD.RelativeMove;
            sendData[2] = dataLength;

            sendData[3] = 0x00;
            sendData[4] = 0x00;
            sendData[5] = 0x00;
            sendData[6] = 0x00;
            string speed = Convert.ToString(position, 16);
            byte[] speedByte = AcSerialBean.StringToByte(speed);

            for (int i = 0; i < speedByte.Length; i++)
            {
                if (i >= 4)
                {
                    break;
                }
                sendData[6 - (speedByte.Length - 1 - i)] = speedByte[i];
            }
            sendData[3] = fangxiang;
            sendData = buildCheckData(sendData, 3 + dataLength); 
            byte[] reviceData = SendCommand(sendData,SleepMS,DReviceLength);
            Thread.Sleep(SleepMS);
        }
        public static void PositionClear(int slvAddr, byte setCMD)
        { 
           byte[] reviceData = SendData(slvAddr, setCMD, 0x00, 0, DReviceLength); 
        }
      
        /// <summary>
        /// 设置电机的速度
        /// </summary>
        /// <param name="slvAddr">电机地址</param>
        /// <param name="setCMD">设置速度的命令号</param>
        /// <param name="speedValue">速度值</param>
        public static void SetSpeed(int slvAddr, byte setCMD, int speedValue)
        { 
           byte[] reviceData = SendData(slvAddr, setCMD, 0x04, speedValue, DReviceLength); 
            Thread.Sleep(10);
        }

        private static byte[] SendData(int slvAddr, byte cmd, byte dataLength, int dataValue, int reviceDataLength)
        {
            byte[] sendData = new byte[5 + dataLength];
            sendData[0] = (byte)slvAddr;
            sendData[1] = cmd;
            sendData[2] = dataLength;
            if (dataLength.Equals(0x00))
            {
            }
            else if (dataLength.Equals(0x01))
            {
                sendData[3] = (byte)dataValue;
            }
            else if (dataLength.Equals(0x04))
            {
                sendData[3] = 0x00;
                sendData[4] = 0x00;
                sendData[5] = 0x00;
                sendData[6] = 0x00;
                string speed = Convert.ToString(dataValue, 16);
                byte[] speedByte = AcSerialBean.StringToByte(speed);

                for (int i = 0; i < speedByte.Length; i++)
                {
                    if (i >= 4)
                    {
                        break;
                    }
                    sendData[6 - (speedByte.Length - 1 - i)] = speedByte[i];
                }
            }
            sendData = buildCheckData(sendData, 3 + dataLength);
            byte[] reviceData = SendCommand(sendData, SleepMS, reviceDataLength);
            Thread.Sleep(SleepMS);
            return reviceData;
        }
        private static byte[] buildCheckData(byte[] sendData, int length)
        {
            ushort pChecksum = 0;
            AcSerialBean.CalculateCRC(sendData, length, out pChecksum);
            string checkStr = Convert.ToString(pChecksum, 16);
            byte[] checkByte = AcSerialBean.StringToByte(checkStr);
            if (checkByte.Length == 1)
            {
                sendData[length] = checkByte[0];
                sendData[length + 1] = 0x00;
            }
            else
            {
                sendData[length + 1] = checkByte[0];
                sendData[length] = checkByte[1];
            }
            return sendData;
        }
        #endregion 
    }

    public class ShuoKeCMD
    {
        /// <summary>
        /// 设置运动初速度://SndHex:01 25 04 00 00 00 64 FC DE  
        /// </summary>
        public static byte SetStartSpeed = 0x25;
        /// <summary>
        /// 设置运动最大速度://SndHex:01 27 04 00 00 27 10 E6 EB 
        /// </summary>
        public static byte SetMaxSpeed = 0x27;
        /// <summary>
        /// 设置运动末速度://SndHex:01 29 04 00 00 03 E8 FD 47
        /// </summary>
        public static byte SetEndSpeed = 0x29;
        /// <summary>
        /// 设置运动加速度://SndHex:01 2B 04 00 00 13 88 F1 4D  
        /// </summary>
        public static byte SetAddSpeed = 0x2B;
        /// <summary>
        /// 设置运动减速度://SndHex:01 2D 04 00 00 03 E8 FC C3 
        /// </summary>
        public static byte SetDelSpeed = 0x2D;
        /// <summary>
        /// 设置归零运动速度://SndHex:01 2F 04 00 00 27 10 E7 A3 
        /// </summary>
        public static byte SetHomeSpeed = 0x2F;
        /// <summary>
        ///  //查找原点命令:
        //SndHex:01 3E 01 00 61 84 
        /// </summary>
        public static byte HomeMove = 0x3E;
        /// <summary>
        /// 绝对位置运动//SndHex:01 50 04 FF FF D8 F0 AC 30 
        /// </summary>
        public static byte AbsMove = 0x50;
        /// <summary>
        /// 急停命令://SndHex:01 3C 00 31 00 
        /// </summary>
        public static byte SuddownStopMove = 0x3C;
        /// <summary>
        /// 减速停止命令://SndHex:01 3D 00 30 90 
        /// </summary>
        public static byte DStopMove = 0x3D;
        /// <summary>
        /// 绝对位置清零:        //SndHex:01 38 00 33 C0 
        /// </summary>
        public static byte AbsPositionClear = 0x38;
        /// <summary>
        /// 相对位置清零:        //SndHex:01 3A 00 32 A0 
        /// </summary>
        public static byte RelPositionClear = 0x3A;
        /// <summary>
        ///  查询运动状态://SndHex:01 3B 00 33 30 
        /// </summary>
        public static byte SearchMoveStatus = 0x3B;
        /// <summary>
        //查询设备地址://SndHex:00 21 00 69 90   
        /// </summary>
        public static byte SearchSlvAddr = 0x21;
        /// <summary>
        /// 设置32位运动速度,并恒速运动:SndHex:01 33 04 00 00 27 10 E5 FF 
        /// </summary>
        public static byte VolMove = 0x33;
        /// <summary>
        /// 查询绝对位置
        /// </summary>
        public static byte GetAbsPosition = 0x37;
        /// <summary>
        /// 相对位置运动
        /// </summary>
        public static byte RelativeMove = 0x32;
    }

    public class ShuoKeInfo
    {
        public ShuoKeInfo(int slv, int position)
        {
            this.IsInMove = -1;
            this.SlvAddr = slv;
            this.LLimit = -1;
            this.RLimit = -1;
            this.Org = -1;
            this.En = -1;
            UpdateTime = DateTime.Now;
            LastPosition = position;
        }
        public ShuoKeInfo(int ismove, int slv, int ll, int org, int rl, int en)
        {
            this.IsInMove = ismove;
            this.SlvAddr = slv;
            this.LLimit = ll;
            this.RLimit = rl;
            this.Org = org;
            this.En = en;
            UpdateTime = DateTime.Now;
            LastPosition = 0;
        }
        public int LastPosition { get; set; }
        /// <summary>
        /// 驱动器地址
        /// </summary>
        public int SlvAddr { get; set; }
        /// <summary>
        /// 是否在运动中
        /// </summary>
        public int IsInMove { get; set; }
        /// <summary>
        /// 左极限
        /// </summary>
        public int LLimit { get; set; }
        /// <summary>
        /// 右极限
        /// </summary>
        public int RLimit { get; set; }
        /// <summary>
        /// 原点信号是否有效
        /// </summary>
        public int Org { get; set; }
        /// <summary>
        /// 使能是否有效
        /// </summary>
        public int En { get; set; }

        public DateTime UpdateTime { get; set; }

        public string ToShowStr()
        {
            return "运动[" + IsInMove + "]左限位[" + LLimit + "]右限位[" + RLimit + "]原点[" + Org + "]使能[" + En + "][" + UpdateTime.ToShortTimeString() + "]";
        }
    }
}