コード例 #1
0
        //-------------------------------------------------------------------------------------------------//

        public bool StartACDrive(ACDriveModes acDriveMode)
        {
            const string STRLOG_MethodName = "StartACDrive";

            string logMessage = STRLOG_ACDriveMode + acDriveMode.ToString();

            Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName, logMessage);

            this.lastError = null;
            bool success = false;

            try
            {
                //
                // Start the AC drive
                //
                switch (acDriveMode)
                {
                case ACDriveModes.NoLoad:

                    acDrive.ConfigureSpeed(ACDrive.MAXIMUM_Speed);
                    acDrive.StartDriveNoLoad();
                    break;

                case ACDriveModes.FullLoad:

                    acDrive.StartDriveFullLoad();
                    break;

                case ACDriveModes.LockedRotor:

                    acDrive.StartDriveLockedRotor();
                    break;

                case ACDriveModes.SynchronousSpeed:

                    acDrive.ConfigureSpeed(ACDrive.MAXIMUM_Speed);
                    acDrive.StartDriveSyncSpeed();
                    break;
                }

                success = true;
            }
            catch (Exception ex)
            {
                this.lastError = ex.Message;
                Logfile.WriteError(ex.Message);
            }

            logMessage = STRLOG_Success + success.ToString();

            Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName, logMessage);

            return(success);
        }
コード例 #2
0
        //-------------------------------------------------------------------------------------------------//

        private void ConfigureACDrive(int speedRampTime, int maxCurrent, int minTorque, int maxTorque)
        {
            acDrive.ConfigureSpeed(0);
            acDrive.ConfigureTorque(0);
            acDrive.ConfigureSpeedRampTime(speedRampTime);
            acDrive.ConfigureMaximumCurrent(maxCurrent);
            acDrive.ConfigureMinimumTorque(minTorque);
            acDrive.ConfigureMaximumTorque(maxTorque);
        }