flex_load_pid_parameters |
Load All PID Parameters
Usage
status = flex_load_pid_parameters(u8 boardID, u8 axis, PID* PIDValues, u8 inputVector);
Purpose
Loads all 8 PID control loop parameters for an axis.
Parameters
Name | Type | Description |
---|---|---|
boardID | u8 | assigned by Measurement & Automation Explorer (MAX) |
axis | u8 | axis to configure |
PIDValues | PID* | data structure containing all 8 PID parameters |
inputVector | u8 | source of the data for this function |
Parameter Discussion
axis is the axis for which to load PID parameters. 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.
PIDValues data structure contains all eight PID parameters in the following structure:
struct {
u16 kp;// Proportional Gain
u16 ki;// Integral Gain
u16 il;// Integration Limit
u16 kd;// Derivative Gain
u16 td;// Derivative Sample Period
u16 kv;// Velocity Feedback Gain
u16 aff;// Acceleration Feedforward Gain
u16 vff;// Velocity Feedforward Gain
} PID;
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 allows you to set all eight PID parameters at the same time for a given axis. You can call this function at any time. However, it is typically used during initialization to configure and tune an axis. NI-Motion also offers a Load Single PID Parameter function, which you can use to change an individual value on-the-fly without having to worry about the other unchanged values.
Refer to the motion controller documentation for an overview of the PID control loop on the NI motion controller and to the Load Single PID Parameter function for descriptions of the individual PID parameters and their ranges.
Note If you are doing onboard programming and are using inputVector to get the data this function needs, note that this function reads the variables starting at the memory address pointed to by inputVector in the following order: Kp, Ki, IL, Kd, Td, Kv, Aff, Vff. |
Loading a Second Set of PID Parameters
To load a second set of PID parameters, use the Load All PID Parameters and Load Single PID Parameter functions to load the second set of PID values. Instead of using regular axis constants, such as axis 1 = NIMC_AXIS1, axis 2 = NIMC_AXIS2, and so on, use the following alternate constants: axis 1 = NIMC_SECOND_PID1, axis 2 = NIMC_SECOND_PID2, up to NIMC_SECOND_PID30.
Use the Load Advanced Control Parameter function to enable the new set of PID parameters based on the condition specified in the value parameter.
Refer to the Remarks section of the Load Advanced Control Parameter topic for more information about how to change feedback while the axis is enabled.