Пример #1
0
        //-------------------------------------------------------------------------------------------------//

        public DriverMachine(XmlNode xmlNodeEquipmentConfig, Specification specification)
            : base(xmlNodeEquipmentConfig, specification)
        {
            const string STRLOG_MethodName = "DriverMachine";

            Logfile.WriteCalled(null, STRLOG_MethodName);

            try
            {
                //
                // Initialise static variables
                //
                if (DriverMachine.firstInstance == true)
                {
                    DriverMachine.dcDriveInstance = new DCDrive(xmlNodeEquipmentConfig, KeepAlive);
                    DriverMachine.plcInstance     = new PLC(xmlNodeEquipmentConfig, KeepAlive);
                    DriverMachine.initialiseDelay = DriverMachine.dcDriveInstance.InitialiseDelay + DriverMachine.plcInstance.InitialiseDelay;
                    DriverMachine.statusMessage   = STRLOG_PLC + STRLOG_NotInitialised + STRLOG_DCDrive + STRLOG_NotInitialised;
                    DriverMachine.firstInstance   = false;
                }

                //
                // Provide access to the instances
                //
                this.dcDrive = dcDriveInstance;
                this.plc     = plcInstance;
            }
            catch (Exception ex)
            {
                //
                // Log the message and throw the exception back to the caller
                //
                Logfile.WriteError(ex.Message);
                throw;
            }

            Logfile.WriteCompleted(null, STRLOG_MethodName);
        }
        //-------------------------------------------------------------------------------------------------//
        public DriverMachine(XmlNode xmlNodeEquipmentConfig, Specification specification)
            : base(xmlNodeEquipmentConfig, specification)
        {
            const string STRLOG_MethodName = "DriverMachine";

            Logfile.WriteCalled(null, STRLOG_MethodName);

            try
            {
                //
                // Initialise static variables
                //
                if (DriverMachine.firstInstance == true)
                {
                    DriverMachine.dcDriveInstance = new DCDrive(xmlNodeEquipmentConfig, KeepAlive);
                    DriverMachine.plcInstance = new PLC(xmlNodeEquipmentConfig, KeepAlive);
                    DriverMachine.initialiseDelay = DriverMachine.dcDriveInstance.InitialiseDelay + DriverMachine.plcInstance.InitialiseDelay;
                    DriverMachine.statusMessage = STRLOG_PLC + STRLOG_NotInitialised + STRLOG_DCDrive + STRLOG_NotInitialised;
                    DriverMachine.firstInstance = false;
                }

                //
                // Provide access to the instances
                //
                this.dcDrive = dcDriveInstance;
                this.plc = plcInstance;
            }
            catch (Exception ex)
            {
                //
                // Log the message and throw the exception back to the caller
                //
                Logfile.WriteError(ex.Message);
                throw;
            }

            Logfile.WriteCompleted(null, STRLOG_MethodName);
        }