Automatic Tuning POSITION Procedure
Automatic Tuning POSITION Procedure (Manual Mode):
The intent of the Position Tuning block is to move the SHA back and forth between two positions, and measure the observed response, to provide position Ki and Kp values.
Note: Running the RelayId block can cause the entire SHA to shake and move; make sure it is securely mounted or clamped prior to enabling the block and proper safety precautions are observed – motion will occur.
>SHA_RelayId blocks for Position and Force Tuning of the SHA. With the SHA AOI v1.2 and higher, SHA_RelayId blocks were added, to assist with Position and Force PID tuning of the SHA on the target hardware. The sample projects contain ladder which can be used/replicated in the SHA_Routine for tuning. Once the tuning is complete, these rungs can be removed, if desired.
>SHA_RelayId position tuning. The sample project includes ladder logic with an instance of the SHA_RelayId setup for Position tuning, shown below. The SHA_PositionControl block and related ladder logic for it are also expected to be in place. However, the SHA_PositionControl block must be disabled when the SHA_RelayId block is active. Also, if SHA_RelayId blocks for both Position and Force are present, only one of these RelayId blocks can be active at a time.
In the position tuning example above, typical input values are shown. The Kp and Ki output values will need to be entered into the SHA_Config PositionKp and PositionKi tags for this SHA, and then tested using moves with the SHA_PositionControl block.
- Hi – Represents the highest extend command pump speed to use, when moving to the Setpoint position + the DeltaSP (SetPoint) position.
- Low – Represents the maximum retract command pump speed to use, when moving from the Setpoint + DeltaSp position, back to the Setpoint – DeltaSP position. This Lo value must be negative, and is typically the same magnitude as the Hi value.
- Setpoint – Represents the starting position to use. From this starting position, the actuator will be jogged back and forth by the DeltaSP offset. In the example, this is a 2” extend position, as inches are being used. If in metric, this would instead be a value in mm.
- DeltaSP – Represents the position offset value to extend and retract to, from the setpoint. In the example, this is 0.002 inches. Depending on the position feedback resolution, a slightly higher value may be needed.
- PV – Represents the Process Variable, so in a Position use case, this is the scaled position feedback value.
- CV – Represents the Control Variable. In the Position case, this is the value to move into the axis.VelocityTrim to provide the motion.
- Ts – Represents the RPI time being used for the MotionTask, in seconds. The default value of 0.001 represents 1 millisecond.
- Ku – Represents the amplitude of the position ripple observed when the RelayId block runs. The value should stay consistent, if the feedback is being provided at a constant rate.
- Tu – Represents the observed time-period of the position oscillations. The value should be fairly steady, if the feedback is being provided at a constant rate.
- Kp – Represents the positional Kp value calculated by the RelayId block, for the given Aggressive value. This value is the average of the last 10 oscillations.
- Ki – Represents the positional Ki value calculated by the RelayId block, for the given Aggressive value, and is the average from the last 10 oscillations.
- Aggressive – Represents a percentage of the “hottest” tuning values to use when calculating the Ki and Kp. A value of 0.2 represents PID values that are 20% of the “hot” values (the values that would be used if Aggressive = 1.0). For faster systems: those with 1 ms scan/rpi and the IF4FXOF2F module, an Aggressive of 0.8 may be a better starting point; try to work up toward an Aggressive of 1, if possible. On slower feedback data systems, an Aggressive setting of 0.4 is a good starting point. Put the Kp and Ki values into the Position members of the SHA_Config, and then try some moves using the SHA_PositionControl to observe the results. On slow analog systems, the Aggressive may need to go as low as 0.2; but try for the highest values that give good results.
The Position Ki and Kp values from the RelayId block will typically have Ki greater than Kp; this kind of ratio helps minimize the positional “bounce back” when the actuator moves in to the ForceLimit or force impact zone. It is also recommended to move into the ForceLimit zone slowly, to minimize the effects of the SHA’s momentum when reaching the ForceLimit, and to limit the Force overshoot in this case. As a consequence of these PID ratios, the high-speed positional moves may have some rabbiting. If the positional Ki value is instead kept less than the Kp, say 1/3 to 1/10 of the Kp, then the high-speed moves will be smoother, but there can be more bounce-back when moving into the Force zone.
The Ki, Kp and output values are held and displayed when the block is disabled. When the block is re-enabled, it will take 10 cycles before the new data starts to display, because of the averaging.
When the position RelayId block is disabled, make sure there is logic to set the SHA Axis.VelocityTrim back to 0.0 to stop the axis motion.
Make a note of the Kp / Ki values in position SHA_RelayId block and enter these into the SHA_Config’s PositionKp and PositionKi tags.
Testing the new Kp & Ki values:
>Testing the position Kp and Ki values using the SHA_PositionControl. With the SHA_PositionControl block disabled (and the position SHA_RelayId disabled), MRP the SHA_Position.CommandPosition to match the current feedback value (the Setpoint of the RelayId). Set the SHA_Config.PositionVelFeedforwardExtend and PositionVelFeedforwardRetract to 0 or set the EnableFeedforward in the SHA_PositionControl to False.
Next, use an MAM on the SHA_Position to move the actuator to a new position to observe how well the PID values work. For example, move to 1” extend position as shown (presuming Setpoint is beyond 1”):
Based on the results, adjust the Kp and Ki proportionally up or down, if needed; or, change the Aggressive value on the position RelayId block, and go back to ManualMode to re-run the position RelayId block to get new values. Repeat until the values are established.
>SHA_PositionControl continues to monitor data even while it is disabled. The Force output continues to update based on the Pressure feedback (the SHA_RelayId force tuning blocks take advantage of this).
>Prior to enabling the SHA_PositionControl block, it is advised to MRP the SHA_Position virtual axis CommandPosition to match the current feedback/actual position. If the SHA_PositionControl’s PositionReference does not match the PositionFeedback, then the SHA will attempt to move to the PositionReference using PID correction, which can be quite abrupt!