Ejemplo n.º 1
0
        private void Halt_Click(object sender, RoutedEventArgs e)
        {
            AxisDiagnosticClickEventArgs _AxisDiagnosticEvent = new AxisDiagnosticClickEventArgs();

            _AxisDiagnosticEvent.COMMAND = new Axis_HmiToPlc();
            _AxisDiagnosticEvent.ID      = this.ID;

            #region Servo Enable/Disable
            _AxisDiagnosticEvent.COMMAND.SERVO_OFF           = false;
            _AxisDiagnosticEvent.COMMAND.SERVO_ON            = false;
            _AxisDiagnosticEvent.COMMAND.SERVO_ON_BW         = false;
            _AxisDiagnosticEvent.COMMAND.SERVO_ON_FW         = false;
            _AxisDiagnosticEvent.COMMAND.CONTROLLER_OVERRIDE = 0;
            #endregion
            #region Servo motion dynamics
            _AxisDiagnosticEvent.COMMAND.TARGET_ACCELERATION = double.Parse(TargetAcceleration.Text);
            _AxisDiagnosticEvent.COMMAND.TARGET_DECELERATION = double.Parse(TargetDeceleration.Text);
            _AxisDiagnosticEvent.COMMAND.TARGET_JERK         = double.Parse(TargetJerk.Text);
            _AxisDiagnosticEvent.COMMAND.TARGET_POSITION     = double.Parse(TargetPosition.Text);
            _AxisDiagnosticEvent.COMMAND.TARGET_VELOCITY     = double.Parse(TargetVelocity.Text);
            if (_AxisDiagnosticEvent.COMMAND.TARGET_VELOCITY <= 0)
            {
                return;
            }
            #endregion
            #region Jog mode
            _AxisDiagnosticEvent.COMMAND.SERVO_JOG_MODE    = false;
            _AxisDiagnosticEvent.COMMAND.SERVO_JOG_BW_FAST = false;
            _AxisDiagnosticEvent.COMMAND.SERVO_JOG_BW_SLOW = false;
            _AxisDiagnosticEvent.COMMAND.SERVO_JOG_FW_FAST = false;
            _AxisDiagnosticEvent.COMMAND.SERVO_JOG_FW_SLOW = false;
            #endregion
            #region Servo movement commands
            _AxisDiagnosticEvent.COMMAND.SERVO_HOME     = false;
            _AxisDiagnosticEvent.COMMAND.SERVO_MOVE_ABS = false;
            _AxisDiagnosticEvent.COMMAND.SERVO_MOVE_REL = false;
            _AxisDiagnosticEvent.COMMAND.SERVO_RESET    = false;
            _AxisDiagnosticEvent.COMMAND.SERVO_HALT     = false;
            #endregion

            if (HaltClicked != null)
            {
                HaltClicked(this, _AxisDiagnosticEvent);
            }
        }
Ejemplo n.º 2
0
        private void AxisReset_Click(object sender, RoutedEventArgs e)
        {
            AxisDiagnosticClickEventArgs _AxisDiagnosticEvent = new AxisDiagnosticClickEventArgs();

            _AxisDiagnosticEvent.COMMAND = new Axis_HmiToPlc();
            _AxisDiagnosticEvent.ID      = this.ID;

            #region Servo Enable/Disable
            _AxisDiagnosticEvent.COMMAND.SERVO_OFF           = false;
            _AxisDiagnosticEvent.COMMAND.SERVO_ON            = (bool)EnableControl.IsChecked;
            _AxisDiagnosticEvent.COMMAND.SERVO_ON_BW         = (bool)EnableBw.IsChecked;
            _AxisDiagnosticEvent.COMMAND.SERVO_ON_FW         = (bool)EnableFw.IsChecked;
            _AxisDiagnosticEvent.COMMAND.CONTROLLER_OVERRIDE = AxisOverride.Value;
            #endregion
            #region Servo motion dynamics
            _AxisDiagnosticEvent.COMMAND.TARGET_ACCELERATION = 0;
            _AxisDiagnosticEvent.COMMAND.TARGET_DECELERATION = 0;
            _AxisDiagnosticEvent.COMMAND.TARGET_JERK         = 0;
            _AxisDiagnosticEvent.COMMAND.TARGET_POSITION     = 0;
            _AxisDiagnosticEvent.COMMAND.TARGET_VELOCITY     = 0;
            #endregion
            #region Jog mode
            _AxisDiagnosticEvent.COMMAND.SERVO_JOG_MODE    = false;
            _AxisDiagnosticEvent.COMMAND.SERVO_JOG_BW_FAST = false;
            _AxisDiagnosticEvent.COMMAND.SERVO_JOG_BW_SLOW = false;
            _AxisDiagnosticEvent.COMMAND.SERVO_JOG_FW_FAST = false;
            _AxisDiagnosticEvent.COMMAND.SERVO_JOG_FW_SLOW = false;
            #endregion
            #region Servo movement commands
            _AxisDiagnosticEvent.COMMAND.SERVO_HOME     = false;
            _AxisDiagnosticEvent.COMMAND.SERVO_MOVE_ABS = false;
            _AxisDiagnosticEvent.COMMAND.SERVO_MOVE_REL = false;
            _AxisDiagnosticEvent.COMMAND.SERVO_RESET    = true;
            _AxisDiagnosticEvent.COMMAND.SERVO_HALT     = false;
            #endregion

            if (ResetClicked != null)
            {
                ResetClicked(this, _AxisDiagnosticEvent);
            }
        }