flex_load_advanced_control_parameter

NI-Motion Functions

flex_load_advanced_control_parameter

Device Compatibility

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

Load Advanced Control Parameter

Usage

i32 status = flex_load_advanced_control_parameter (u8 boardID, u8 axis, u16 parameterType, u32 value, u8 inputVector);

Purpose

Sets an advanced control loop parameter for a given axis.

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)
axis u8 axis to configure
parameterType u16 parameter to configure
value u32 value to load for the specified parameter
inputVector u8 source of the data for this function

Parameter Discussion

axis is the axis to configure. Valid values are NIMC_AXIS1 through NIMC_AXIS30. On motion controllers that support fewer than thirty axes, configuring non-existent axes returns error –70006 (NIMC_badResourceIDOrAxisError). Refer to Axes for axis resource IDs.

parameterType is one of the following control loop parameters to set:

Constant Value Description
NIMC_STATIC_FRICTION_MODE 0x0 Enables or disables static friction compensation.
NIMC_STATIC_FRICTION_MAX_DEADZONE 0x3 Specifies the maximum deadzone window for static friction compensation.
NIMC_STATIC_FRICTION_MIN_DEADZONE 0x4 Specifies the minimum deadzone window for static friction compensation.
NIMC_STATIC_FRICTION_ITERM_OFFSET_FWD 0x5 Specifies the voltage necessary to overcome static friction when beginning a move in the forward direction.
NIMC_STATIC_FRICTION_ITERM_OFFSET_REV 0x6 Specifies the voltage necessary to overcome static friction when beginning a move in the reverse direction.
NIMC_PID_RATE_MULTIPLIER 0x7 Specifies a multiplier to slow the PID Rate.
NIMC_NOTCH_FILTER_FREQUENCY 0x8 Specifies the frequency of the signal that you want to remove.
NIMC_NOTCH_FILTER_BANDWIDTH 0x9 Specifies the bandwidth of the filter.
NIMC_NOTCH_FILTER_ENABLE 0xA Enables or disables the notch filter.
NIMC_LOWPASS_FILTER_CUTOFF_FREQUENCY 0xB Specifies a cutoff frequency to remove output filters.
NIMC_LOWPASS_FILTER_ENABLE 0xC Enables or disables the lowpass filter.
NIMC_SECONDARY_PID_MODE 0xD Configures the controller to use the second set of PID parameters based on the condition specified in value.

value is dependent upon the specified control loop parameterType.

inputVector contains the parameter and value that are 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

Use this function to configure a single control loop parameter for a given axis.

Enable Static Friction Mode to configure static friction (stiction) compensation on the motion system. Stiction compensation adjusts for increased power needed to overcome static friction when beginning a move from a standstill. Set Static Friction Mode to 1 to enable, or 0 to disable, static friction compensation.

The Max and Min Deadzones are the windows around the target position that determine its sensitivity to external forces that try to move it from its position. Inside the maximum deadzone window, an axis can be moved without response. As soon as the movement causes the axis to exceed the maximum deadzone, the control loop responds by correcting the position back to within the window defined by minimum deadzone. The range is 1 to 32,767.

Forward and Reverse Offset Voltages are the voltages necessary to overcome static friction when beginning a move. The voltages can be the same for both directions, but can be different under some circumstances. For example, if an axis moves against gravity in one direction and with gravity in the other direction, the offset voltage necessary to overcome static friction against gravity is higher than that of the direction that moves with gravity.

The PID Rate Multiplier specifies a multiplier to slow the PID Rate. The default is 1 (no change), and the range is 1-10. For example, with a 250µs PID Rate and a PID Rate Multiplier of 4, the effective control loop rate is shown in the following equation:

effective rate = PID Rate × PID Rate Multiplier = 250µs × 4 = 1 ms

Notch filters remove a narrow band of frequencies around a given point to filter output signals that could cause system instability. Set Notch Filter Enable to 1 to enable, or 0 to disable, the filter. Use Notch Filter Frequency to specify the frequency of the signal that you want to remove. The range for the frequency is 1 Hz to PID Rate (in Hz)/2. Use Notch Filter Bandwidth to specify the bandwidth of the filter.

For example, a 250µs PID Rate would have a maximum frequency of 2000 Hz as shown in the following equation:

max frequency = 4000 Hz/2 = 2000 Hz
or
max frequency = (250 µs/2)-1 = 2000 Hz

Lowpass filters remove output signals above a specific cutoff frequency. The range for the frequency is 1 Hz to PID Rate (in Hz)/2. Set Lowpass Filter Enable to 1 to enable, or 0 to disable, the lowpass filter.

Second Set of PID Parameters is used to configure the controller to transition from the primary set of PID parameters to the secondary set based on the current condition specified in value. This transition occurs in the control loop, so there is no latency between transition time. The following table includes valid conditions this transition can occur under.

Name Value Constant Description
Disabled 0 NIMC_PID_DISABLED Always uses the primary set of PID parameters.
Switch Feedback 1 NIMC_PID_CHANGE_IN_FEEDBACK Uses the secondary set of PID parameters when feedback changes.
Acceleration 2 NIMC_PID_ACCELERATING Uses the second set of PID parameters when the move is accelerating toward the target velocity.
Velocity 3 NIMC_PID_MOVING Uses the second set of PID parameters when the motor is moving. Otherwise uses the primary set of PID parameters.
Direction 4 NIMC_PID_MOVING_REVERSE Uses the second set of PID parameters if the motor is moving in the reverse direction. Otherwise, uses the primary set of PID parameters.

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 controller:

  • Static Friction and PID Rate Multiplier parameters can be set only on 7340/50 motion controllers.
  • Notch Filter and Lowpass Filter parameters can be set only on 7350 motion controllers.
  • The NIMC_SECONDARY_PID_MODE attribute is valid only on 7350 controllers.
    • Only the Disabled and Switch Feedback options are valid.
    • If the Switch Feedback option is selected, the control loop toggles between sets of PID parameters each time the feedback is changed. For example, if you are using encoder 1, the control loop uses the primary set of PID parameters. If you switch to ADC 1, the control loop uses the secondary set of PID parameters. If you switch back to encoder 1, the control loop switches back to the primary set of PID parameters.

NI SoftMotion Controller Considerations

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

  • If the Switch Feedback option is selected, the control loop uses the primary set of PID parameters when you use a primary resource and uses the secondary set of PID parameters when you use an auxiliary resource. For example, if you use encoder 1, the control loop uses the primary set of PID parameters. If you use auxiliary encoder 1, the control loop uses the secondary set of PID parameters.
  • NIMC_SECONDARY_PID_MODE is not valid for the NI SoftMotion Controller for CANopen.