flex_load_velocity

NI-Motion Functions

flex_load_velocity

Device Compatibility

Device Compatibility
7330
Y
7340
Y
7344
Y
7350
Y
7390
Y
NI SoftMotion Controller for CANopen—Xenus
Y
NI SoftMotion Controller for CANopen—Accelnet
Y

Load Velocity

Usage

status = flex_load_velocity(u8 boardID, u8 axisOrVectorSpace, i32 velocity, u8 inputVector);

Purpose

Loads the maximum velocity for an axis or vector space.

Tip  Refer to the Remarks section for information about how the behavior of this function differs between controllers.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
axisOrVectorSpace u8 axis or vector space to control
velocity i32 velocity in counts/s or steps/s
inputVector u8 source of the data for this function

Parameter Discussion

axisOrVectorSpace is the axis or vector space to control. Valid values are NIMC_AXIS1 through NIMC_AXIS30 or NIMC_VECTOR_SPACE1 through NIMC_VECTOR_SPACE15. On motion controllers that support fewer than thirty axes, configuring non-existent axes or vector spaces returns error –70006 (NIMC_badResourceIDOrAxisError). Refer to Axes and Vector Spaces for axis and vector space resource IDs.

velocity is the target or maximum slewing velocity in counts/s (servo axes) or steps/s (stepper axes).

Note  It is possible to load a velocity slower than 1 count or step per second by using the Load Velocity in RPM or Load Move Constraints functions.

inputVector indicates the source of the data for this function. Available input vectors include immediate (0xFF), variable (0x01 through 0x78), or indirect variable (0x81 through 0xF8). Refer to Input and Return Vectors for more detailed information.

Using This Function

This function specifies the maximum trajectory velocity for individual axes or vector spaces. When executed on a vector space, the value controls the vector velocity along the vector move path. For velocity control applications, the sign of the loaded velocity specifies the move direction.

Velocity is a double-buffered parameter so you can load it on the fly without affecting the move in process, and it take effect on the next Start Motion or Blend Motion call. After it is loaded, this parameters remains in effect for all subsequent motion profiles until re-loaded by this function. You do not need to load velocity before each move unless you want to change the velocity.

Note  Use Load Move Constraints to load a velocity of less than 1 count/sec.
Note  The velocity loaded with this function is the maximum move velocity. Actual velocity attainable is determined by many factors including PID tuning, length of move, acceleration and deceleration values, and physical constraints of the amplifier/motor/mechanical system.
Note  Refer to Function Execution Times for benchmark timing information about your controller.

Remarks

This section includes information about how the behavior of this function differs among the controllers that support it.

NI 73xx Controller Considerations

The following list includes considerations you must make when you are using this function with a 73xx motion controller:

  • Velocity values in counts/s or steps/s are also converted to the internal 16.16 fixed-point format in units of counts or steps per sample (update) period before being used by the trajectory generator. Although the motion controller can control velocity to 1/65,536 of a count or step per sample, it is impossible to load a value that small with the Load Velocity function, as shown in the following formula:

    Velocity in counts or step/s = Vmin × ()

    where:
    Vmin is 1/65,536 counts/sample or steps/sample, and
    Ts is the sample period in seconds per sample.

    Ts = 625 × 10-6

    × 16,000 = 0.244 counts or steps/s

    This function takes an integer input with a minimum value of 1 count/s or step/s. You cannot load fractional values. If you need to load a velocity slower than one count or step per second, use the Load Velocity in RPM function.

    You can calculate the maximum velocity with the following equation:

    maximum velocity = Vmax

    where:
    Vmax is 20 MHz for servos,
    8 MHz for steppers on a 7350 controller,
    4 MHz for steppers on a 7330/40/90 controller,
    and is constrained by acceleration/deceleration according to the following equation:

    velocity (65536 × deceleration) – acceleration

    where velocity is in counts/sample and acceleration and deceleration are in counts/sample2.

  • NI 7350—For servo axes, the velocity range is from ±1 to ±20,000,000 counts/s. For stepper axes it is ±1 to ±8,000,000 steps/s. The upper range limits are the physical limitations of the encoder inputs and stepper generator outputs.
  • NI 7340—For servo axes, the velocity range is from ±1 to ±20,000,000 counts/s. For stepper axes it is ±1 to ±4,000,000 steps/s. The upper range limits are the physical limitations of the encoder inputs and stepper generator outputs.
  • NI 7330/7390—The velocity range is ±1 to ±4,000,000 steps/s. The upper range limits are the physical limitations of the encoder inputs and stepper generator outputs.
  • NI-Motion firmware uses a 16.16 fixed-point format internally to represent velocity in counts/sample period or steps/sample period and acceleration/deceleration in counts/sample period2 or steps/sample period2. If you change counts or steps per revolution or change the update rate using Enable Axis, you must reload the velocity and acceleration/deceleration.

NI SoftMotion Controller Considerations

The following list includes considerations you must make when you are using this function with the NI SoftMotion Controller:

  • The range of velocity values is not limited by the fixed 16.16 calculation, and full 64-bit precision is maintained.
  • Use Load Counts/Steps per Revolution to set the countsOrSteps value to 1. Otherwise, NI-Motion returns an error.