コード例 #1
0
        /// <summary>
        ///     单例初始化
        /// </summary>
        /// <param name="nType">运动控制板卡类型</param>
        /// <param name="nAxisNum">最大轴数,最大8</param>
        /// <param name="nCardNum">卡号</param>
        /// <returns></returns>
        public static CMotionWorkChristmas GetInstance(MOTION_TYPE nType, short nAxisNum, short nCardNum)
        {
            if (_LIST_MOTION_WORKING.Count > nCardNum)
                if (_LIST_MOTION_WORKING[nCardNum] != null)
                    return _LIST_MOTION_WORKING[nCardNum];

            lock (_LOCK)
            {
                switch (nType)
                {
                    case (short) MOTION_TYPE.GTS_MOTION: //固高
                        _MOTION_BASE = new CGtMotion(nAxisNum);
                        break;
                    default: //默认固高
                        _MOTION_BASE = new CGtMotion(nAxisNum);
                        break;
                }

                //if (_LIST_MOTION_WORKING[nCardNum] == null) _LIST_MOTION_WORKING[nCardNum] = new CMotionWorkChristmas(_MOTION_BASE, nCardNum);
                if (!(_LIST_MOTION_WORKING.Count > nCardNum))
                    _LIST_MOTION_WORKING.Add(new CMotionWorkChristmas(_MOTION_BASE, nCardNum));
                return _LIST_MOTION_WORKING[nCardNum];
            }
        }
コード例 #2
0
 protected CMotionWorkBase(CMotionBase cMotionBase, short nCardNum)
 {
     m_cMotionBase = cMotionBase;
     m_nCardNo     = nCardNum;
 }
コード例 #3
0
        private CMotionWorkChristmas(CMotionBase obj, short nCardNum)
            : base(obj, nCardNum)
        {
            m_nMaxAxisNum = obj.m_nMaxAxisNum;
            m_nDiNum = DI_NUM;
            m_nDoNum = DO_NUM;

            m_oLockScanDiBit = new object();

            m_oLockSetDoBit = new object();


            m_dAxisResolution = new double[m_nMaxAxisNum];

            m_bScanEnd = false;

            m_bUniversalIn = new bool[DI_NUM];
            m_bUniversalOut = new bool[DI_NUM];
            //m_bInit = false;

            m_nDiStatus = new[] {0, 0, 0, 0, 0};
            m_bAxisPosLmt = new bool[m_nMaxAxisNum];
            m_bAxisNegLmt = new bool[m_nMaxAxisNum];
            m_bAxisAlarm = new bool[m_nMaxAxisNum];
            m_bAxisHome = new bool[m_nMaxAxisNum];


            m_nAxisStatus = new int[m_nMaxAxisNum];
            m_bFlagAlarm = new bool[m_nMaxAxisNum];
            m_bFlagMError = new bool[m_nMaxAxisNum];
            m_bFlagPosLimit = new bool[m_nMaxAxisNum];
            m_bFlagNegLimit = new bool[m_nMaxAxisNum];
            m_bFlagAStop = new bool[m_nMaxAxisNum];
            m_bFlagSStop = new bool[m_nMaxAxisNum];
            m_bFlagMotion = new bool[m_nMaxAxisNum];
            m_bFlagServoOn = new bool[m_nMaxAxisNum];

            m_dAxisPos = new double[m_nMaxAxisNum];

            for (var i = 0; i < m_nDiNum; i++) m_bUniversalIn[i] = true;

            for (var i = 0; i < m_nDoNum; i++) m_bUniversalOut[i] = true;

            for (var i = 0; i < m_nMaxAxisNum; i++)
            {
                m_dAxisResolution[i] = 0;


                m_bAxisPosLmt[i] = true;
                m_bAxisNegLmt[i] = true;
                m_bAxisAlarm[i] = true;
                m_bAxisHome[i] = true;

                m_nAxisStatus[i] = 0;
                m_bFlagAlarm[i] = true;
                m_bFlagMError[i] = true;
                m_bFlagPosLimit[i] = true;
                m_bFlagNegLimit[i] = true;
                m_bFlagAStop[i] = true;
                m_bFlagSStop[i] = true;
                m_bFlagMotion[i] = true;
                m_bFlagServoOn[i] = true;

                m_dAxisPos[i] = 0.0;
            }
        }