//-------------------------------------------------------------------------------------------------//
        /// <summary>
        /// 
        /// </summary>
        /// <param name="labEquipmentConfiguration"></param>
        public EquipmentEngine(LabEquipmentConfiguration labEquipmentConfiguration)
            : base(labEquipmentConfiguration)
        {
            const string methodName = "EquipmentEngine";
            Logfile.WriteCalled(logLevel, STR_ClassName, methodName);

            try
            {
                /*
                 * Create instances of the equipment devices
                 */
                this.deviceRedLion = new DeviceRedLion(this.labEquipmentConfiguration);
            }
            catch (Exception ex)
            {
                Logfile.WriteError(ex.Message);
            }

            Logfile.WriteCompleted(logLevel, STR_ClassName, methodName);
        }
 public void SetDeviceRedLion(DeviceRedLion deviceRedLion)
 {
     this.deviceRedLion = deviceRedLion;
 }
        //-----------------------------------------------------------------------------------------------------------//
        /// <summary>
        /// 
        /// </summary>
        /// <param name="modbusIpMaster"></param>
        /// <param name="slaveId"></param>
        public ACDrive(ModbusIpMaster modbusIpMaster, int slaveId, DeviceRedLion.KeepAliveCallback keepAliveCallback)
        {
            const string methodName = "ACDrive";
            Logfile.WriteCalled(logLevel, STR_ClassName, methodName);

            this.modbusIpMaster = modbusIpMaster;
            this.slaveId = slaveId;
            this.keepAliveCallback = keepAliveCallback;

            /*
             * Create register map
             */
            if (RegisterMap == null)
            {
                RegisterMap = new Dictionary<int, RegisterDescription>();
                RegisterMap.Add((int)ModbusRegs_RO.DriveSpeed, new RegisterDescription(-3000000, 3000000, 0, -30000, 30000, "Motor Speed", "RPM", "f0", "Drive Speed"));
                RegisterMap.Add((int)ModbusRegs_RO.DriveTorque, new RegisterDescription(0, 16000, 0, 0, 1600, "Motor Torque", "%", "f0", "Drive Torque"));
                RegisterMap.Add((int)ModbusRegs_RO.LoadTemperature, new RegisterDescription(-400, 1600, 0, -40, 160, "Load Temp", "deg-C", "f01", "Load Temperature"));

                RegisterMap.Add((int)ModbusRegs_RW.ControlSpeed, new RegisterDescription(-200000000, 200000000, 0, -3000, 3000, "", "RPM", "", "Control Speed"));
                RegisterMap.Add((int)ModbusRegs_RW.ControlTorque, new RegisterDescription(-200000000, 200000000, 0, -2000, 2000, "", "%", "", "Control Torque"));
                RegisterMap.Add((int)ModbusRegs_RW.SpeedRampTime, new RegisterDescription(0, 1800000, 0, 0, 1800, "", "Secs", "", "Speed Ramp Time"));
                RegisterMap.Add((int)ModbusRegs_RW.MaximumCurrent, new RegisterDescription(0, 3000000, 0, 0, 30000000, "", "Milliamps", "", "Maximum Current"));
                RegisterMap.Add((int)ModbusRegs_RW.MaximumTorque, new RegisterDescription(0, 3000000, 0, 0, 300000, "", "%", "", "Maximum Torque"));
                RegisterMap.Add((int)ModbusRegs_RW.MinimumTorque, new RegisterDescription(49536, 65536, -65535, -1600, 0, "", "%", "", "Minimum Torque"));
            }

            Logfile.WriteCompleted(logLevel, STR_ClassName, methodName);
        }
        //-----------------------------------------------------------------------------------------------------------//
        /// <summary>
        /// 
        /// </summary>
        /// <param name="modbusIpMaster"></param>
        /// <param name="slaveId"></param>
        public DCDrive(ModbusIpMaster modbusIpMaster, int slaveId, DeviceRedLion.KeepAliveCallback keepAliveCallback)
        {
            const string methodName = "DCDrive";
            Logfile.WriteCalled(logLevel, STR_ClassName, methodName);

            this.modbusIpMaster = modbusIpMaster;
            this.slaveId = slaveId;
            this.keepAliveCallback = keepAliveCallback;

            /*
             * Create register map
             */
            if (RegisterMap == null)
            {
                RegisterMap = new Dictionary<int, RegisterDescription>();
                RegisterMap.Add((int)ModbusRegs_RO.SpeedEncoder, new RegisterDescription(0, 2000, 0, 0, 2000, "Motor Speed", "RPM", "f0", "Actual speed measured with pulse encoder"));
                RegisterMap.Add((int)ModbusRegs_RO.Torque, new RegisterDescription(0, 10000, 0, 0, 100, "Motor Torque", "%", "f01", "Motor torque"));
                RegisterMap.Add((int)ModbusRegs_RO.ArmatureVoltage, new RegisterDescription(-400, 400, 0, -400, 400, "Armature Voltage", "Volts", "", "Actual armature voltage"));
                RegisterMap.Add((int)ModbusRegs_RO.FieldCurrent, new RegisterDescription(0, 200, 0, 0, 2, "Field Current", "Amps", "f02", "Actual field current"));

                RegisterMap.Add((int)ModbusRegs_RW.ControlSpeed, new RegisterDescription(-20000, 20000, 0, -1500, 1500, "", "RPM", "f01", "Control Speed"));
                RegisterMap.Add((int)ModbusRegs_RW.ControlTorque, new RegisterDescription(-32700, 32700, 0, -327, 327, "", "%", "f01", "Control Torque"));
                RegisterMap.Add((int)ModbusRegs_RW.MinSpeedLimit, new RegisterDescription(-10000, 0, 0, -10000, 0, "", "RPM", "", "Minimum Speed Limit"));
                RegisterMap.Add((int)ModbusRegs_RW.MaxSpeedLimit, new RegisterDescription(0, 10000, 0, 0, 10000, "", "RPM", "", "Maximum Speed Limit"));
                RegisterMap.Add((int)ModbusRegs_RW.MaxTorqueLimit, new RegisterDescription(0, 32500, 0, 0, 325, "", "%", "", "Maximum Torque Limit"));
                RegisterMap.Add((int)ModbusRegs_RW.MinTorqueLimit, new RegisterDescription(-32500, 0, 0, -325, 0, "", "%", "", "Minimum Torque Limit"));
                RegisterMap.Add((int)ModbusRegs_RW.SpeedRampTime, new RegisterDescription(0, 30000, 0, 0, 300, "", "Secs", "", "Speed Ramp Time"));
                RegisterMap.Add((int)ModbusRegs_RW.FieldLimit, new RegisterDescription(0, 10000, 0, 0, 100, "", "%", "", "Field Limit"));
                RegisterMap.Add((int)ModbusRegs_RW.FieldTrim, new RegisterDescription(-20, 20, 0, -20, 20, "", "%", "", "Field Trim"));
            }

            Logfile.WriteCompleted(logLevel, STR_ClassName, methodName);
        }