.

PID with Gain Table

Overview

Overview

This block computes a servo algorithm with Proportional, Integral, and Derivative (PID) filter transformation and Feed Forwards. The integration sum is limited (MovingImax and RestImax) and the derivative may be filtered (Ksm). The block supports up to five different values for each parameter. The parameter values are loaded as text-based parameter files. At run-time, the block parameters can be simultaneously changed at any time by updating the Gain Index input to the PID_GT block.

Example

The following example demonstrates the PID with Gain Table block usage in a simple model. The application can write into the Memory User Buffer location to change the Gain Index.

PID

 

The coefficients for this block are as follows:

AxisNumber Specifies the Axis object for Position, Velocity, and Acceleration information.
Kp

Proportional gain.

Kp output = input * Kp

Ki

Integral gain.

Ki output = Σ(input) * Ki, not to exceed MovingIMax or RestIMax.

Kd

Derivative gain.

Kd output = (position error (current) - position error (previous)) * Kd

Kpff Position feed forward — NOT USED
Kvff

Velocity feed forward.

Kvff output = Cmd Velocity(axisNumber) * Kvff

Kaff

Acceleration feed forward.

Kaff output = Cmd Accel(axisNumber) * Kaff

Kiff

Friction feed forward.

Kfff output = (IF Cmd Velocity <> 0) * Kfff *sign(Cmd Velocity)

MovingImax

Limit value for the integration sum when Command Velocity <> 0.

RestImax

Limit value for the integration sum when Command Velocity = 0.

Ksm

Smoothing parameter.

0 = no smoothing
1 = infinite smoothing

OutputLimit

Command signal Output Limit.

OutputLimitH

Command signal High Output Limit.

OutputLimitL

Command signal Low Output Limit.

Ts Sample period of the PID algorithm. This is the cycle time of the PID algorithm in Simulink simulation. This value has no effect on the PID execution on the controller.
Subsample Code A code which determines the schedule for updating this block (every sample, even samples only, etc.). See Subsampling.

Matlab/Simulink

Simulink Interface

PID_Simulink

The Position Error input should connect to a position error block or equivalent (for example the output of a sum block). The Output is the torque command ready to connect to a motor output or equivalent. The Gain Index input determines which of the five gain tables are used by the servo algorithm. Valid values are 0 through 4.

IMPORTANT!  The new Servo Gains are applied immediately when the Gain Index value is changed. The Position Integrator Reset input controls the resetting of the Integrator sum internal to the block. When a non-zero value is detected at the Reset input the integrator sum will be set to zero.

The block has two user data fields (User Data 0, User Data 1) to store application-specific data for convenient storage and retrieval. See User Data Storage for details.

The block's update schedule is determined by the Subsample Code (See Subsampling). The following Parameter Dialog Box is opened by double-clicking on the block in a Simulink Model

PID_GT_Blk

 

C++ API

PID_GTBlock

Declaration

Public Method

PID_GTBlock&   PID_GT();
Required Header: mechaware.h

Description

This block represents the standard PID algorithm as used on the ZMP-SynqNet controller including the Gain Tables and Feed Forward parameters. The only exception is the addition of Ksm value for smoothing.

Each Parameter must have corresponding .txt file containing structure with five (5) Coefficient values. Individual parameters can be modified using the API functions below.

int32_t PID_GT().AxisNumber Axis number
double PID_GT().ErrorSum Summation of position integral error.
double PID_GT().ErrorDelta Derivative error.
double PID_GT().Kp[index] Set derivative gain value at index (0 - 4).

Kd output = (position error (current) - position error (previous) * Kd smoothed (See Ksm below).
double PID_GT().Ki[index] Set integral gain value at index (0 - 4).

Ki output = Σ(input) * Ki, not to exceed IMax.
double PID_GT().Kd[index] Set derivative gain value at index (0 - 4).

Kd output = (position error (current) - position error (previous) * Kd smoothed (See Ksm below).
double PID_GT().Kpff[index] Not used.
double PID_GT().Kvff[index] Set velocity feed forward gain at index (0 - 4).
double PID_GT().Kaff[index] Set friction feed forward gain at index (0 - 4).
double PID_GT().Kfff[index] Set friction feed forward gain at index (0 - 4).
double PID_GT().MovingIMax Limit for the maximum value of the integration sum when Command Velocity <> 0.
double PID_GT().RestIMax Limit for the maximum value of the integration sum when Velocity = 0.
double PID_GT().Ksm[index] Smoothing parameter.

0 = no smoothing
1 = infinite smoothing
double PID_GT().OutputLimit[index] Control loop output limit.

The absolute value of the control output will never exceed this value. (DAC counts)
double PID_GT().OutputLimitHigh[index] Control loop output positive limit

The control output will never exceed this value in the positive sense. The smaller (more negative) value contained between Output Limit and Output Limit High will take precedence. (DAC counts)
double PID_GT().OutputLimitLow[index] Control loop output negative limit.

The control output will never exceed this value in the positive sense. The smaller (more negative) value contained between Output Limit and Output Limit High will take precedence. (DAC counts)
double PID_GT().OutputOffset[index] Control loop offset.

Creates an offset to the control output. The Output Offset is not removed from the DAC in an abort condition. (DAC counts)

Methods

Block Methods

Remarks

The PID with Reset block is an alternate PID block without gain tables or feed forward terms.

See Also

PIV with Gain Table

 

       Legal Notice  |  Tech Email  |  Feedback
      
Copyright ©
2001-2012 Motion Engineering