TrackingErrorCalculation¶
The TrackingErrorCalculation block is used to calculate the tracking error in a position control loop. The block is designed to interact with several PMP components. The main functionality is to:
Open or close the control loop;
Apply homing offsets;
Allow bumpless switching between multiple sensor systems in closed loop;
Compensate for propagation delay in the control system; and
Interact with other PMP components for its correct operation.
Typically, a control loop will use one sensor. This is also the default setting. When multiple sensors are used, several inputs and outputs are added to the TrackingErrorCalculation block.
Implementation¶
Single-sensor operation¶
For single-sensor operation, the PMP homing interface can be used to start a homing procedure and determine a homing offset.
This is an offset that is applied to the sensor position to obtain a ‘homed’ position, i.e., the ActualPosition
.
The actual position is calculated by ActualPosition = SensorValue + HomeOffset
.
Note
When the homing offset is set to NaN, the last valid value is used instead.
Multi-sensor operation¶
Multi-sensor support can be enabled by setting the Enable multi-sensor support
checkbox in the block mask.
After applying the changes, several extra inputs and outputs are generated.
An input is generated for each sensor.
The active sensor is selected with the SensorSelect
.
The TrackingErrorCalculation block stores the HomeOffset
, HomePosition
and IsHomed
for each sensor and applies the correct homing offset based on the value of SensorSelect
.
When SensorSelect
points to a non-existing sensor (SensorSelect
≥ NrOfSensors
), several functions of the TrackingErrorCalculation block are disabled.
All homing inputs are ignored and the DemandPositionOffset
, ActualPosition
and TrackingError
outputs are set to zero.
The IsClosedLoop
output behavior remains unchanged.
When transitioning from an invalid SensorSelect
value to a valid value, the demand position is shifted to prevent a bump in tracking error.
By default, the homing state of the block is hidden.
To access the homing state, the homing outputs can be enabled via the block mask.
After applying the change, HomeOffsetValues
, HomePositionValues
and IsHomedValues
outputs are generated (arrays with a length of the number of sensors).
Demand position delay¶
In high-performance control system, it can be useful to consider propagation delay when designing the feedforward and feedback controllers.
Feedforward control directly uses the reference trajectory and does not depend on any measurement data.
However, the feedback controller uses (delayed) measured position data.
Due to propagation delay in the control system (caused by the controller, actuator or sensor), it can take multiple cycles for the effect of feedforward control to be observed in the measured position.
In the meantime, the feedback control is already seeing a tracking error and is compensating for it.
Essentially, the result of the feedforward action arrives too late, resulting in possible overcompensation by the feedback control.
When the propagation delay in the control system is known, it can be compensated for by applying this same delay to the demand position in the tracking error calculation.
The demand position delay can be configured as a non-negative delay time.
The MaxDelay
parameter is used to allocate the delay buffer and cannot be changed during simulation.
The demand position delay can be changed during runtime. Internally, the delay time is converted to a number of samples.
When the delay time requires a non-integer number of samples, linear interpolation between samples is used to determine the delayed value.
If DemandPositionDelay
exceeds the value of MaxDelay
value, the actual delay will be limited by the amount of memory allocated for the delay buffer.
By setting the maximum delay to 0
, the delay function is disabled and the calculation time of the TrackingErrorCalculation block is reduced.
Parameters and Dialog Box¶
- Demand position delay [s]
Sets a delay time in the demand position, and must be non-negative. The actual delay is limited by the value given by the
MaxDelay
parameter. The demand position delay parameter can be updated at runtime.- Maximum delay [s]
Determines the size of the demand position delay buffer and must be non-negative. When the maximum delay is set to zero, the delay is disabled. This will decrease the calculation time of the TrackingErrorCalculation block. The maximum delay parameter cannot be updated at runtime.
- Enable multi-sensor support
If the box is checked and changes to the mask are applied, the settings related to multi-sensor support are shown in the mask. After unchecking the box, the number of sensors is set to one and multi-sensor support is disabled.
- Number of sensors
This parameter configures the number of sensors and is only visible when multi-sensor support is enabled. The parameter cannot be updated at runtime.
- Enable homing state outputs
When the checkbox is set and the mask changes are applied, outputs are generated that make the homing state of each sensor available. When clearing the checkbox, the outputs are removed.
Data Type Support¶
- Input ports
- The input port
CloseLoopRequest
accepts only signals of typeboolean
.The input portDemandPosition
accepts only signals of typedouble
.The input portHomeOffset
accepts only signals of typedouble
.The input portHomePosition
accepts only signals of typedouble
. TheHomePosition
input is only available when multi-sensor support is enabled.The input portIsHomed
accepts only signals of typeboolean
. TheIsHomed
input is only available when multi-sensor support is enabled.The input portSensorX
accepts only signals of typedouble
. In single-sensor mode, there is one input port namedSensor
. For multiple sensors, one input port is generated for each sensor, named asSensor0
,Sensor1
, …,SensorN-1
.The input portSensorSelect
accepts only signals of typedouble
. TheSensorSelect
input is only available when multi-sensor support is enabled. - Dialog parameters
- The
Demand position delay
dialog parameter can be of any real numeric data type and must be non-negative.TheMaximum delay
dialog parameter can be of any real numeric data type and must be non-negative.TheNumber of sensors
dialog parameter can be of any real numeric data type but is internally converted to an integer value. The value must be at least 1.
Integration¶
The PMP axis control initiates a transition to the ClosedLoop state by setting the CloseLoopRequest
flag.
The axis control then waits for the IsClosedLoop
signal to be set to complete its transition to ClosedLoop.
The tracking error calculation block directly propagates the CloseLoopRequest
input to the IsClosedLoop
output.
This is the expected behavior for most applications. In some cases, more control over the CloseLoop transition is needed.
It is possible to abort the CloseLoop transition in PMP by not responding to the CloseLoopRequest.
This could be useful to prevent the axis control from switching to closed loop when the system is not yet initialized.
Furthermore, some applications require the transition to be delayed. This can be achieved by placing a delay before the CloseLoopRequest
input of the tracking error calculation block.
An example is shown below.
The blue ports indicate connections to PMP components.
When the loop is opened (IsClosedLoop
= false), the tracking error is set to zero.
After closing the loop (IsClosedLoop
= true), the tracking error is calculated by TrackingError = InternalDemandPosition - ActualPosition
.
The InternalDemandPosition
is the position setpoint that is used for tracking error calculation, and the ActualPosition
is the sensor input corrected by a homing offset.
Note
A distinction is made between the position setpoint DemandPosition
that is typically supplied by the PMP trajectory interpolator, and the InternalDemandPosition
that is used for the calculation of the tracking error:
The internal demand position is delayed with a time specified by
DemandPositionDelay
. This is further explained at Demand position delay.The internal demand position is updated with the demand position offset, a sample before the
DemandPosition
is updated. Therefore, the trajectory is synchronized without delay.
The processing block containing the tracking error calculation block should be connected to several PMP components for correct operation. The figure below demonstrates how to connect the processing block to the rest of the system.
Note
Other configurations are possible depending on the use case.