Пример #1
0
        public bool Init(EN_LAN_SEL _eLanSel, string _sParaFolderPath, int _iMaxIn, int _iMaxOut, EN_DIO_SEL _eDioSel)
        {
            m_eLangSel        = _eLanSel;
            m_sParaFolderPath = _sParaFolderPath;
            m_aIn             = new TDIo[_iMaxIn];
            m_aOut            = new TDIo[_iMaxOut];

            m_iMaxIn  = _iMaxIn;
            m_iMaxOut = _iMaxOut;


            if (_eDioSel == EN_DIO_SEL.AXL)
            {
                Dio = new MotionAXL.CDio();
            }
            else if (_eDioSel == EN_DIO_SEL.NMC2)
            {
                Dio = new MotionNMC2.CDio();
            }
            else
            {
                Log.ShowMessage("Err", "_eDioSel is not defined");
                return(false);
            }

            Dio.Init();

            LoadSave(true);
            //LoadSave(false);


            for (int i = 0; i < m_iMaxIn; i++)
            {
                m_aIn[i].DelayOn  = new CDelayTimer();
                m_aIn[i].DelayOff = new CDelayTimer();
            }

            for (int i = 0; i < m_iMaxOut; i++)
            {
                m_aOut[i].DelayOn  = new CDelayTimer();
                m_aOut[i].DelayOff = new CDelayTimer();

                m_aOut[i].Stat.bAtrVal = GetY(i, true);
                m_aOut[i].Stat.bVtrVal = m_aOut[i].Stat.bAtrVal;
            }

            Log.Trace("SMDLL", "Init Finished");

            return(true);
        }
Пример #2
0
        public bool Init(EN_LAN_SEL _eLanSel, string _sParaFolderPath, EN_DIO_SEL _eDioSel, Enum _eX, Enum _eY)
        {
            m_eLangSel        = _eLanSel;
            m_sParaFolderPath = _sParaFolderPath;

            Type  type1      = _eX.GetType();
            Array arrayTemp1 = Enum.GetValues(type1);

            m_iMaxIn = arrayTemp1.Length - 1;
            if (m_iMaxIn < 0)
            {
                m_iMaxIn = 0;
            }

            Type  type2      = _eY.GetType();
            Array arrayTemp2 = Enum.GetValues(type2);

            m_iMaxOut = arrayTemp2.Length - 1;
            if (m_iMaxOut < 0)
            {
                m_iMaxOut = 0;
            }

            m_aIn  = new TDIo[m_iMaxIn];
            m_aOut = new TDIo[m_iMaxOut];

            if (_eDioSel == EN_DIO_SEL.AXL)
            {
                Dio = new MotionAXL.CDio();
            }
            else if (_eDioSel == EN_DIO_SEL.NMC2)
            {
                Dio = new MotionNMC2.CDio();
            }
            else if (_eDioSel == EN_DIO_SEL.COMI)
            {
                Dio = new MotionComizoa.CDio();
            }
            else
            {
                Log.ShowMessage("Err", "_eDioSel is not defined");
                return(false);
            }

            Dio.Init();

            for (int i = 0; i < m_iMaxIn; i++)
            {
                m_aIn[i].Para.sEnum = arrayTemp1.GetValue(i).ToString();
            }
            for (int i = 0; i < m_iMaxOut; i++)
            {
                m_aOut[i].Para.sEnum = arrayTemp2.GetValue(i).ToString();
            }

            LoadSave(true);
            //LoadSave(false);


            for (int i = 0; i < m_iMaxIn; i++)
            {
                m_aIn[i].DelayOn  = new CDelayTimer();
                m_aIn[i].DelayOff = new CDelayTimer();
            }

            for (int i = 0; i < m_iMaxOut; i++)
            {
                m_aOut[i].DelayOn  = new CDelayTimer();
                m_aOut[i].DelayOff = new CDelayTimer();

                m_aOut[i].Stat.bAtrVal = GetY(i, true);
                m_aOut[i].Stat.bVtrVal = m_aOut[i].Stat.bAtrVal;
            }

            Log.Trace("SMDLL", "IO Init Finished");

            return(true);
        }