PositionControlAdvanced

An advanced position control implementation.

The PositionControlAdvanced processing block can be found in the ‘Templates’ feature in the PMP installer.

position control advanced loop structure

Control loop structure where a feedback controller controls the position of a mechanical plant

The processing block is based on the feedback control structure shown above, where a reference is tracked by a mechanical plant using sensor feedback. The reference signal is the demanded position and the output of the plant is position, measured using an encoder.

Description

The implementation of the processing block is shown in Implementation of the processing block.

The block consists of multiple components, which are further explained in the following sections:

  • Tracking error calculation, loop control & homing blue-rect

  • Feedback controller yellow-rect

  • Settling state machine purple-rect

  • Saturation and limits green-rect

  • Signal propagation red-rect

position control advanced implementation

Implementation of the processing block

The block is based on the PositionControlSimple block, but has the following extensions that make it suitable for more advanced use cases:

Tracking error calculation, loop control & homing

The tracking error is calculated using the following equation:
TrackingError = (DelayedDemandPosition - ActualPosition) * CloseLoopRequest
ActualPosition = PositionSensor + HomeOffset

The position controller can be in open loop or closed loop state. A request for a certain loop state is done via the CloseLoopRequest input. The IsClosedLoop signal is used to inform PMP about the active loop state. The behavior for different loop states are as follows:

Loop state

Loop state

Move commands

Feedforward

Feedback

OpenLoop

Allowed

Enabled

Disabled

ClosedLoop

Allowed

Enabled

Enabled

The DelayedDemandPosition is the DemandPosition delayed by a time that can be specified in seconds using the FeedbackDelay signal. The feedback delay is 0 seconds by default and can be increased up to 10 milliseconds.

Hint

In a control loop with delay the effect of feedforward is not directly measurable on the sensor. This can cause the feedback controller to react to an error that the feedforward controller has already compensated for. This issue can be prevented by delaying the demand position used to calculate the tracking error. It is recommended to choose the FeedbackDelay equal to the IO delay of the control loop.

See also Demand position delay.

The HomeOffset can be used to add an offset to the relative position measurement to translate it to an absolute value. This absolute position is called the ActualPosition.

When closing the loop, the tracking error is set to zero to prevent an initial step in control output which could result in unexpected movement. This is achieved by setting the delayed demanded position equal to the actual position during the first calculation cycle in closed loop. The DemandPositionOffset signal is used to inform the trajectory interpolator of the change in demanded position. Similarly, the demanded position is updated when applying a home offset such that the home offset does not cause a step in tracking error.

Feedback controller

The tracking error is forwarded to the control algorithm. It includes 4 generic filters and a PID controller to implement the control algorithm.

The filters and PID controller are implemented in series. Each filter can be excluded from the control loop by configuring it as pass-through.

position control advanced implementation

Implementation of the feedback controller

Generic filter [1-4]

Each generic filter can be used to apply one of the following filters: 1st or 2nd order lowpass or highpass, 1st order lead/lag, 2nd order notch or 2nd order custom filters in either the continuous or discrete domain. By default, the generic filter type is set to PassThrough, which means that it’s disabled and the signal passes through the block.

PID

The PID controller combines a proportional, a derivative and an integral control term with a second order low pass filter. The second order low pass filter is applied to the results of the proportional and derivative terms, but not to the result of the integral term. The integrator output can be clipped to configurable limits. An IntegratorSaturated event is raised if the output exceeds the limits, i.e., IntegratorOutput < IntergratorLowerClip or IntegratorOutput > IntergratorUpperClip.

If the PID controller is not used, it can be configured as pass-through by using a proportional gain of one and setting the integrator and differentiator frequencies to zero. In this pass-through mode it is still required to configure the second order low pass filter.

Note

Each PMP Generic Filter block is a GenericFilter. The PID block is a PIDLowPass. Both blocks are discretized using Tustin’s method.

Settling state machine

The settling state machine can be configured using the following parameters:

Signal

Description

SettlingEnvelope

The SettlingEnvelope parameter specifies an envelope in which the tracking error must remain after reaching the trajectory state InPosition for SettlingInsideEnvelopeTime amount of time before it is considered settled. The unit of the parameter is equal to the unit of the tracking error.

SettlingInsideEnvelopeTime [s]

The SettlingInsideEnvelopeTime parameter specifies the time duration that the tracking error must remain within the SettlingEnvelope bounds during the settling phase. When the SettlingInsideEnvelopeTime is set to zero, the settling phase is skipped, and the SettlingEnvelope is ignored. The unit of the parameter is [s].

SettlingTimeout [s]

The SettlingTimeout parameter specifies the maximum duration of the settling phase. If the timeout is exceeded, the settling state machine will transition to Timeout. The timeout is disabled by setting Timeout = 0. The unit of the parameter is [s].

StabilizingTime [s]

The StabilizingTime parameter specifies the duration of the stabilizing phase. After the duration has ended, the settling state machine will transition to state Idle. When the StabilizingTime is zero, the stabilizing phase is skipped. The unit of the parameter is [s].

The settling state machine also defines whether the system is moving or not (see SettlingStateMachine).

Saturation and limits

Limits are available to evaluate if the tracking error and control output stay within defined bounds. Event are raised if these bounds are exceeded.

Tracking error limit

The purpose of the control loop is to keep the tracking error small. If the tracking error becomes very large, then it’s likely that some part of the loop is not correctly functioning. For instance due to a failing actuator, a noisy sensor or obstructed mechanics.

Tracking error limit implementation

Implementation of the tracking error limit

The limit can be configured using the TrackingErrorLimit signal. The TrackingErrorLimitExceeded event is active if the tracking error exceeds the configured limit:

  • When the system is moving:

    • |TrackingError| > TrackingErrorLimitMoving

  • WHen the system is not moving:

    • |TrackingError| > TrackingErrorLimitIdle

The IsMoving signal from the Settling state machine defines is the system is moving or not.

Saturation

The control output saturation limits make sure that the position controller is aware of the physical limitations of the connected actuator. If the control output saturates, then the integrator of the PID controller is locked to prevent ‘integral windup’.

Attention

The control output saturation is not intended to protect the actuator against thermal overload. These protections should be configured on the actuator interface.

Saturation implementation

Implementation of the saturation

Note

The values of the saturation limits depend on the unit of the control output.

The saturation limits can be configured using the ControlOutputUpperSaturationMoving, ControlOutputLowerSaturationMoving, ControlOutputUpperSaturationIdle and ControlOutputLowerSaturationIdle signals. The CoutSaturationExceeded event is active if the control output exceeds these limits:

  • When the system is moving:

    • ControlOutput < ControlOutputLowerSaturationMoving

    • ControlOutput > ControlOutputLowerSaturationMoving

  • WHen the system is not moving:

    • ControlOutput < ControlOutputLowerSaturationIdle

    • ControlOutput > ControlOutputLowerSaturationIdle

The saturation is disabled during movement if ControlOutputUpperSaturationMoving =< ControlOutputLowerSaturationMoving. The saturation is disabled during standstill if ControlOutputUpperSaturationIdle =< ControlOutputLowerSaturationIdle.

Hint

If possible, design the controller such that the control output saturation limit is never exceeded during normal operation. Then use this event to disable the axis. This way, unsafe high forces due to mechanical obstruction, instability or magnetic misalignment are detected and captured early.

Signal propagation

The processing block has inputs that can be used to combine the feedback control output with other signals that must be propagated to the actuator (see Implementation of the processing block). These inputs are:

Input

Description

FeedbackOffset

Input to apply an offset before the FeedbackControlOutput.

FeedforwardControl

This can be used to connect the feedforward controller to the position controller. It is added after the FeedbackControlOutput.

Integration

The integration of this processing block in the software platform is shown in Integration of position control in the software platform. Most connections between the processing block and other software components are required for correct operation, but some are optional. The optional connections are depicted using dashed lines.

position control advanced integration

Integration of position control in the software platform

Hint

In case a three phase actuator is used, the control output must be connected to the quadrature axis, often denoted as ‘DemandIq’.

Note

The unit of the signals in the processing block is not defined by the processing block itself. The unit of the control output, feedforward control and feedback offset depends on the unit of the Demand input of the actuator. The unit of the demand position, demand position offset, home offset and position sensor depends on the unit of the Actual signal of the sensor.

Interface

Inputs

Inputs

Name

Description

CloseLoopRequest

Input to request a ClosedLoop loop status.

DemandPosition

Demand position input used for tracking error calculation.

FeedbackOffset

Input to apply an offset before the FeedbackControlOutput.

FeedforwardControl

Input to connect the feedforward controller to the position controller.

HomeOffset

Home position offset value, used to add an offset to the relative position measurement to translate it to an absolute value

InPosition

Input that refelcts if the trajectory state is InPosition.

PositionSensor

Sensor value input used for tracking error calculation.

Read only signals

Read only signals

Name

Description

ActualPosition

Actual value of the position sensor after home offset.

CombinedControlOutput

Combined feedback and feedforward controller output.

ControlOutput

Output of the position controller.

DelayedDemandPosition

Internally used demand position that is delayed by the configurable feedback delay.

DemandPositionOffset

Offset for the demand position of the trajectory interpolator.

FeedbackControlOutput

Feedback controller output.

GenericFilterOutput

Control output of the sequence of generic filters.

IsClosedLoop

Indicates if the feedback control loop is open or closed.

IsMoving

The trajectory generators and/or interpolators are active.

PidOutput

Output of the PID controller.

SettlingDuration [s]

Total duration that the settling state machine is in state Settling.

SettlingState

Active state of the settling state machine.

TrackingError

Tracking error value.

Read-write signals

Read-write signals

Name

Description

ControlOutputLowerSaturationIdle

Controller output lower saturation value when the settling state machine is in Idle state.

ControlOutputLowerSaturationMoving

Controller output lower saturation value when the settling state machine is not in Idle state.

ControlOutputUpperSaturationIdle

Controller output upper saturation value when the settling state machine is in Idle state.

ControlOutputUpperSaturationMoving

Controller output upper saturation value when the settling state machine is not in Idle state.

FeedbackDelay [s]

Delay of DemandPosition before tracking error determination.

SettlingEnvelope

Envelope in which the TrackingError must remain after reaching the axis state InPosition for SettlingInsideEnvelopeTime amount of time before it is considered settled.

SettlingInsideEnvelopeTime [s]

Time for which the TrackingError must remain within the SettlingEnvelope before it is considered settled. Zero disables settling.

SettlingTimeout [s]

Time between trajectory complete and the axis being settled (settling complete) before the SettlingTimeoutExceeded event is generated.

StabilizingTime [s]

Time used for stabilizing after settling completes. Zero disables stabilizing.

TrackingErrorLimitIdle

Tracking error limit for feedback tracking limit determination when the settling state machine is in Idle state.

TrackingErrorLimitMoving

Tracking error limit for feedback tracking limit determination when the settling state machine is not in Idle state.

Events

Events

Name

Description

TrackingErrorLimitExceeded

Active if a configurable feedback tracking error limit is exceeded.

IntegratorSaturated

Active if the integrator output reaches the saturation limit.

CoutSaturationExceeded

Active if a configurable control output saturation limit is reached.

SettlingComplete

Active when the settling phase of the settling state machine is completed.

SettlingTimeoutExceeded

Active if the configurable settling timeout of the settling state machine is exceeded.

StabilizingComplete

Active when the stabilizing phase of the settling state machine is completed.

Filters

Filters

Name

Type

Discretization type

Control_GenericFilter1

BiQuad

Tustin

Control_GenericFilter2

BiQuad

Tustin

Control_GenericFilter3

BiQuad

Tustin

Control_GenericFilter4

BiQuad

Tustin

Control_PID_LowPass

PidLp

Tustin