Exemplo n.º 1
0
        /// <summary>
        /// (인증필요)AB Plc 객체 생성.
        /// </summary>
        /// <param name="ePlcType">PLC종류 : AB</param>
        /// <param name="strIPAddress">Remote Gateway를 사용 할 경우 ip address 입력, local gateway 사용 시 공백 입력</param>
        /// <param name="strProgramID">local : 'RSLinx OPC Server' / 원격 : 'RSLinx Remote OPC Server'</param>
        /// <param name="strGroupName">Item Group명 : 미입력시'Group'으로 설정 </param>
        /// <param name="strTopicName">설정되 Topic 이릅</param>
        /// <param name="intUpdateRate">Value 업데이스 시간(ms)</param>
        /// <param name="strLogFileName">기록을 쌓을 로그 파일(프로그램 폴더 \Log_PlcModule 폴더에 기록.</param>
        public clsPLCModule(enPlcType ePlcType, string strIPAddress, string strProgramID, string strGroupName, string strTopicName, int intUpdateRate, string strLogFileName)
        {
            enPLCType = ePlcType;

            try
            {
#if (ABPLC_A || ABPLC_B)
                if (ePlcType == enPlcType.AB)
                {
                    clsPLC = new clsABPLC(strIPAddress, strProgramID, strGroupName, strTopicName, intUpdateRate);
                }
                else
                {
                    throw new Exception(string.Format("AB PLC 생성자의 Type이 잘 못 되었니다.(생성 요청 타입 : {0})", enPLCType.ToString()));
                }
#endif

                enPLCType = ePlcType;
                InitClass(strLogFileName);
            }
            catch (Exception ex)
            {
                ProcException(ex);
                throw ex;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Melsec A/Q plc 객체 생성
        /// </summary>
        /// <param name="ePlcType"></param>
        /// <param name="?"></param>
        /// <param name="intPort"></param>
        /// <param name="strLogFileName"></param>
        public clsPLCModule(enPlcType ePlcType, string strIPAddress, int intPort, string strDeviceType, string strLogFileName)
        {
            try
            {
                enPLCType = ePlcType;

                if (ePlcType == enPlcType.Melsec_A)
                {
                    clsPLC = new clsMelsecA(strIPAddress, intPort, strDeviceType);
                }
                else if (ePlcType == enPlcType.Melsec_Q)
                {
                    clsPLC = new clsMelsecQ(strIPAddress, intPort, strDeviceType);
                }
                else
                {
                    throw new Exception(string.Format("Melsec A/Q 생성자의 Type이 잘 못 되었니다.(생성 요청 타입 : {0})", enPLCType.ToString()));
                }


                InitClass(strLogFileName);
            }
            catch (Exception ex)
            {
                ProcException(ex);
            }
        }
Exemplo n.º 3
0
        public void Set_Module(enPlcType ePlcType, string strIPAddress, int intPort, string strDeviceType,
                               string LogFolderPath, string strLogFileName)
        {
            if (clsPLC != null)
            {
                return;
            }

            try
            {
                enPLCType = ePlcType;

                IPAddress = strIPAddress;
                Port      = intPort;

                switch (ePlcType)
                {
                case enPlcType.Melsec_A:
                    clsPLC = new PLCModule.PLCModules.clsMelsecA(strIPAddress, intPort, strDeviceType);
                    break;

                case enPlcType.Melsec_Q:
                    clsPLC = new PLCModule.PLCModules.clsMelsecQ(strIPAddress, intPort, strDeviceType);
                    break;

                case enPlcType.LS_XGT:
                    clsPLC = new PLCModule.PLCModules.clsLS_XGT(strIPAddress, intPort, strDeviceType);
                    break;

                case enPlcType.LS_XGI:
                    clsPLC = new PLCModule.PLCModules.clsLS_XGI(strIPAddress, intPort, strDeviceType);
                    break;

                case enPlcType.TEST:
                    clsPLC = new PLCModule.PLCModules.clsTEST(strIPAddress, intPort, strDeviceType);
                    break;

                default:
                    throw new Exception(string.Format("Melsec A/Q 생성자의 Type이 잘 못 되었니다.(생성 요청 타입 : {0})", enPLCType.ToString()));
                }

                InitClass(LogFolderPath, strLogFileName);
            }
            catch (Exception ex)
            {
                ProcException(ex);
            }
        }