PSO Distance Functions
You can use the PSO Distance module to generate events based on the distance traveled by one or more axes. Using three counters to track up to three position feedback sources, the module calculates the distance traveled in real time. Upon reaching the desired distance, the module generates an event to be used by other modules, most often to trigger the generation of a waveform.
In one dimensional mode, the PSO Distance module tracks a single feedback source. The PSO distance counters change in real time in response to the tracked feedback source. When the counters reach the specified distance, the module generates a distance event. The PSO distance module will generate events when the distance is reached in either the positive or negative direction. Upon generating an event, the PSO Distance module resets the distance counters to prepare for the next event.
In two or three dimensional mode, the distance counters independently track each individual feedback source. In real time, the PSO feature calculates the vector distance of the combined inputs, using the sum of squares of each PSO counter. When the vector distance meets or exceeds the desired distance, the PSO distance module generates an event and resets the counters to prepare for the next event.
In addition to generating events at a fixed distance, the PSO Distance module also supports the use of the drive array to specify a sequence of distances (array mode). The module contains a variety of advanced features, such as allowing you to specify additional reset conditions for the PSO counters.
Configuring the Tracking Inputs
HARDWARE: When you specify the input to PSO as primary or auxiliary feedback, the drive that you use with PSO will only support encoders that give you incremental feedback. This condition applies to the PsoDistanceConfigureInputs()
, PsoTransformationConfigure()
, and PsoWindowConfigureInput()
functions.
Table: Supported Feedback Types
Input (Enum Values) | Feedback Type | Encoder Multiplier Options |
---|---|---|
IncrementalEncoderSquareWave | Primary | Encoder multiplier options do not apply. |
Auxiliary | Encoder multiplier options do not apply. | |
IncrementalEncoderSineWave | Primary | -MX2, -MX3, and -MX4 (for XR3 drives only) |
Auxiliary | -MX4 (for XR3 drives only) | |
AbsoluteEncoderEnDatwithSineWaveIncremental | Primary | -MX2, -MX3, and -MX4 (for XR3 drives only) |
AbsoluteEncoderBiSSwithSineWaveIncremental | Primary | -MX2, -MX3, and -MX4 (for XR3 drives only) |
Use the PsoDistanceConfigureInputs() function to specify the number and source of the position feedback signals you want the PSO distance counters to track. The number of elements that you specify in the $inputs array argument determines the operating dimensions of the PSO distance module. If you specify a single element in the $inputs argument, the module operates in one dimensional mode. If you specify two or three elements in the $inputs array argument, the module operates in two or three dimensional mode. The PSO distance module can track input speeds up to 100 MHz (100,000,000 counts/second).
Optional Purchase Necessary: On some Aerotech drives, two and three dimensional PSO distance tracking is a paid option. Review your ordering information to see the number of dimensions that your drive supports.
function PsoDistanceConfigureInputs($axis as axis, $inputs[] as PsoDistanceInput)
Selects the source of each PSO distance counter.
Arguments
$axis The axis on which to configure the distance counter sources.
$inputs An array of one to three input sources, one for each distance counter.
Use the PsoDistanceInput enumeration to select the PSO distance tracking inputs for your drive. You must also configure the correct feedback parameters for the input you are using. These can include PrimaryFeedbackType Parameter, AuxiliaryFeedbackType Parameter, and the Primary Multiplier and Auxiliary Multiplier parameters.
enum PsoDistanceInput
GL4PrimaryFeedbackAxis1Encoder0 = 100 GL4PrimaryFeedbackAxis2Encoder0 = 101 GL4IfovFeedbackAxis1 = 102 GL4IfovFeedbackAxis2 = 103 GL4AuxiliaryFeedbackAxis1 = 104 GL4AuxiliaryFeedbackAxis2 = 105 GL4SyncPortA = 106 GL4SyncPortB = 107 GL4DrivePulseStreamAxis1 = 108 GL4DrivePulseStreamAxis2 = 109 XL4sPrimaryFeedback = 110 XL4sAuxiliaryFeedback = 111 XL4sSyncPortA = 112 XL4sSyncPortB = 113 XL4sDrivePulseStream = 114 XR3PrimaryFeedbackAxis1 = 115 XR3PrimaryFeedbackAxis2 = 116 XR3PrimaryFeedbackAxis3 = 117 XR3PrimaryFeedbackAxis4 = 118 XR3PrimaryFeedbackAxis5 = 119 XR3PrimaryFeedbackAxis6 = 120 XR3AuxiliaryFeedbackAxis1 = 121 XR3AuxiliaryFeedbackAxis2 = 122 XR3AuxiliaryFeedbackAxis3 = 123 XR3AuxiliaryFeedbackAxis4 = 124 XR3AuxiliaryFeedbackAxis5 = 125 XR3AuxiliaryFeedbackAxis6 = 126 XR3SyncPortA = 127 XR3SyncPortB = 128 XR3DrivePulseStream = 129 XC4PrimaryFeedback = 130 XC4AuxiliaryFeedback = 131 XC4SyncPortA = 132 XC4SyncPortB = 133 XC4DrivePulseStream = 134 XC4ePrimaryFeedback = 135 XC4eAuxiliaryFeedback = 136 XC4eSyncPortA = 137 XC4eSyncPortB = 138 XC4eDrivePulseStream = 139 XC6ePrimaryFeedback = 140 XC6eAuxiliaryFeedback = 141 XC6eSyncPortA = 142 XC6eSyncPortB = 143 XC6eDrivePulseStream = 144 XL5ePrimaryFeedback = 145 XL5eAuxiliaryFeedback = 146 XL5eSyncPortA = 147 XL5eSyncPortB = 148 XL5eDrivePulseStream = 149 XC2PrimaryFeedback = 150 XC2AuxiliaryFeedback = 151 XC2DrivePulseStream = 152 XC2ePrimaryFeedback = 153 XC2eAuxiliaryFeedback = 154 XC2eDrivePulseStream = 155 XL2ePrimaryFeedback = 156 XL2eAuxiliaryFeedback = 157 XL2eSyncPortA = 158 XL2eSyncPortB = 159 XL2eDrivePulseStream = 160 XI4PrimaryFeedbackAxis1 = 161 XI4PrimaryFeedbackAxis2 = 162 XI4PrimaryFeedbackAxis3 = 163 XI4PrimaryFeedbackAxis4 = 164 XI4AuxiliaryFeedbackAxis1 = 165 XI4AuxiliaryFeedbackAxis2 = 166 XI4AuxiliaryFeedbackAxis3 = 167 XI4AuxiliaryFeedbackAxis4 = 168 XI4SyncPortA = 169 XI4SyncPortB = 170 XI4DrivePulseStreamAxis1 = 171 XI4DrivePulseStreamAxis2 = 172 XI4DrivePulseStreamAxis3 = 173 XI4DrivePulseStreamAxis4 = 174 iXC4PrimaryFeedback = 175 iXC4AuxiliaryFeedback = 176 iXC4SyncPortA = 177 iXC4SyncPortB = 178 iXC4DrivePulseStream = 179 iXC4ePrimaryFeedback = 180 iXC4eAuxiliaryFeedback = 181 iXC4eSyncPortA = 182 iXC4eSyncPortB = 183 iXC4eDrivePulseStream = 184 iXC6ePrimaryFeedback = 185 iXC6eAuxiliaryFeedback = 186 iXC6eSyncPortA = 187 iXC6eSyncPortB = 188 iXC6eDrivePulseStream = 189 iXL5ePrimaryFeedback = 190 iXL5eAuxiliaryFeedback = 191 iXL5eSyncPortA = 192 iXL5eSyncPortB = 193 iXL5eDrivePulseStream = 194 iXR3PrimaryFeedbackAxis1 = 195 iXR3PrimaryFeedbackAxis2 = 196 iXR3PrimaryFeedbackAxis3 = 197 iXR3PrimaryFeedbackAxis4 = 198 iXR3PrimaryFeedbackAxis5 = 199 iXR3PrimaryFeedbackAxis6 = 200 iXR3AuxiliaryFeedbackAxis1 = 201 iXR3AuxiliaryFeedbackAxis2 = 202 iXR3AuxiliaryFeedbackAxis3 = 203 iXR3AuxiliaryFeedbackAxis4 = 204 iXR3AuxiliaryFeedbackAxis5 = 205 iXR3AuxiliaryFeedbackAxis6 = 206 iXR3SyncPortA = 207 iXR3SyncPortB = 208 iXR3DrivePulseStream = 209 GI4DrivePulseStreamAxis1 = 210 GI4DrivePulseStreamAxis2 = 211 GI4DrivePulseStreamAxis3 = 212 iXC2PrimaryFeedback = 213 iXC2AuxiliaryFeedback = 214 iXC2DrivePulseStream = 215 iXC2ePrimaryFeedback = 216 iXC2eAuxiliaryFeedback = 217 iXC2eDrivePulseStream = 218 iXL2ePrimaryFeedback = 219 iXL2eAuxiliaryFeedback = 220 iXL2eSyncPortA = 221 iXL2eSyncPortB = 222 iXL2eDrivePulseStream = 223 iXI4PrimaryFeedbackAxis1 = 224 iXI4PrimaryFeedbackAxis2 = 225 iXI4PrimaryFeedbackAxis3 = 226 iXI4PrimaryFeedbackAxis4 = 227 iXI4AuxiliaryFeedbackAxis1 = 228 iXI4AuxiliaryFeedbackAxis2 = 229 iXI4AuxiliaryFeedbackAxis3 = 230 iXI4AuxiliaryFeedbackAxis4 = 231 iXI4SyncPortA = 232 iXI4SyncPortB = 233 iXI4DrivePulseStreamAxis1 = 234 iXI4DrivePulseStreamAxis2 = 235 iXI4DrivePulseStreamAxis3 = 236 iXI4DrivePulseStreamAxis4 = 237 FLEXPrimaryFeedbackAxis1 = 238 FLEXPrimaryFeedbackAxis2 = 239 FLEXPrimaryFeedbackAxis3 = 240 FLEXPrimaryFeedbackAxis4 = 241 FLEXAuxiliaryFeedbackAxis1 = 242 FLEXAuxiliaryFeedbackAxis2 = 243 FLEXAuxiliaryFeedbackAxis3 = 244 FLEXAuxiliaryFeedbackAxis4 = 245 FLEXSyncPortA = 246 FLEXSyncPortB = 247 FLEXDrivePulseStreamAxis1 = 248 FLEXDrivePulseStreamAxis2 = 249 FLEXDrivePulseStreamAxis3 = 250 FLEXDrivePulseStreamAxis4 = 251 iFLEXPrimaryFeedbackAxis1 = 252 iFLEXPrimaryFeedbackAxis2 = 253 iFLEXPrimaryFeedbackAxis3 = 254 iFLEXPrimaryFeedbackAxis4 = 255 iFLEXAuxiliaryFeedbackAxis1 = 256 iFLEXAuxiliaryFeedbackAxis2 = 257 iFLEXAuxiliaryFeedbackAxis3 = 258 iFLEXAuxiliaryFeedbackAxis4 = 259 iFLEXSyncPortA = 260 iFLEXSyncPortB = 261 iFLEXDrivePulseStreamAxis1 = 262 iFLEXDrivePulseStreamAxis2 = 263 iFLEXDrivePulseStreamAxis3 = 264 iFLEXDrivePulseStreamAxis4 = 265 XA4PrimaryFeedbackAxis1 = 266 XA4PrimaryFeedbackAxis2 = 267 XA4DrivePulseStreamAxis1 = 268 XA4DrivePulseStreamAxis2 = 269 iXA4PrimaryFeedbackAxis1 = 270 iXA4PrimaryFeedbackAxis2 = 271 iXA4DrivePulseStreamAxis1 = 272 iXA4DrivePulseStreamAxis2 = 273 XA4PrimaryFeedbackAxis3 = 274 XA4PrimaryFeedbackAxis4 = 275 XA4DrivePulseStreamAxis3 = 276 XA4DrivePulseStreamAxis4 = 277 iXA4PrimaryFeedbackAxis3 = 278 iXA4PrimaryFeedbackAxis4 = 279 iXA4DrivePulseStreamAxis3 = 280 iXA4DrivePulseStreamAxis4 = 281 XA4SyncPortA = 282 XA4SyncPortB = 283 iXA4SyncPortA = 284 iXA4SyncPortB = 285 XA4AuxiliaryFeedback = 286 iXA4AuxiliaryFeedback = 287 PsoTransformationChannel0Output = 288 PsoTransformationChannel1Output = 289 PsoTransformationChannel2Output = 290 PsoTransformationChannel3Output = 291 GL4PrimaryFeedbackAxis1Encoder1 = 292 GL4PrimaryFeedbackAxis2Encoder1 = 293 end |
If you want to divide each input by an integer scale factor, you can use the PsoDistanceConfigureScaling() function. This can be useful if the resolution of the feedback signals is not the same for all configured tracking inputs. You must specify a number of elements for the $scaleFactors array argument equal to the operating dimensions of the PSO Distance module. If a divider is not necessary, use a scale factor of 1.
function PsoDistanceConfigureScaling($axis as axis, $scaleFactors[] as integer)
Configures the PSO distance counters to apply an integer scale factor for each tracking input.
Arguments
$axis The axis on which to configure the scale factors.
$scaleFactors An array of one to three integer scale factors, one per tracking input.
Configuring the Event Distance
The PSO distance module generates an event after the counters detect that a specified distance has been traveled. You can configure the module to generate events using a fixed distance value or using an array of distance values from the drive array. To specify a fixed event distance, use the PsoDistanceConfigureFixedDistance() function. When you use a fixed event distance, the PSO Distance module uses the value you specify in the $distance argument as the event distance. After the counters reach the event distance, the module resets the counters and continues using this value for the next event distance. The ReverseMotionDirection Parameter has no effect on PSO distances. The specified distance must be a positive integer number of counts. If you try to specify a non-integer number of counts, Automation1 Studio will report an error. You can use the Trunc() function to ensure that you specify a valid integer distance, but this can change your expected event distance.
The PSO Distance module requires a fixed quantity of time to respond to changes at the tracking inputs. As a result, a small latency occurs before the PSO Distance module generates an event. When the PSO Distance module is configured to track a single input, the latency is 40 nanoseconds. When the PSO Distance module is configured to track two or three inputs, the latency is 50 nanoseconds. Additional latency can occur because of the feedback type of the tracking input. Refer to the PrimaryEmulatedQuadratureDivider Parameter and AuxiliaryEmulatedQuadratureDivider Parameter topics for more information.
function PsoDistanceConfigureFixedDistance($axis as axis, $distance as integer)
Configures the distance in counts that the PSO counter or counters must travel for an event to occur.
Arguments
$axis The axis on which to configure the distance.
$distance The distance in counts.
To specify an array of distance values, use the PsoDistanceConfigureArrayDistances() function. Before you use this function, make sure that you have already written the desired distance values, in counts, to the drive array locations you specify with the $driveArrayStartIndex and $numberOfDistances arguments. To write values to the drive array to be used as distance values, use the DriveArrayWrite() function and specify DriveArrayType.PsoDistanceEventDistances as the $driveArrayType argument. For more information on writing values to the drive array, see the DriveArrayWrite() function in the Device Functions topic. When you use event distances from the drive array, the PSO Distance module uses the first specified drive array value as the first event distance. After the counters reach the first event distance, the module resets the counters and uses the next drive array value as the next event distance. The module continues using values in the drive array in this fashion until the configured number of event distances is reached. You can also use the $enableRepeat argument to instruct the module to use an infinite number of drive array values. In this mode, the module will return to the value at the $driveArrayStartIndex and use the same set of values again after the module uses the last event distance in the drive array.
function PsoDistanceConfigureArrayDistances($axis as axis, $driveArrayStartAddress as integer, $numberOfDistances as integer, $enableRepeat as integer)
Configures an array of distances in counts that the PSO counter or counters must travel for an event to occur.
Arguments
$axis The axis on which to configure the distances.
$driveArrayStartAddress The byte-addressable index of the drive array where the first distance is stored.
$numberOfDistances The number of distances to be read from the drive array.
$enableRepeat Configures PSO to continue to use distances after the last distance in the array is used, starting over at the first distance.
Controlling the Distance Counters
By default, the PSO Distance counters are disabled and will not track the configured inputs. In this default disabled state, the module holds the counters in reset. To enable the counters, use the PsoDistanceCounterOn() function. Once enabled, the counters will track the configured inputs and will generate an event upon reaching the specified event distance.
function PsoDistanceCounterOn($axis as axis)
Enables the PSO distance counters, allowing them to track their configured inputs.
Arguments
$axis The axis on which to enable the PSO distance counters.
To return the counters to their default reset state, use the PsoDistanceCounterOff() function.
function PsoDistanceCounterOff($axis as axis)
Disables the PSO distance counters, causing them to retain their values and ignore their configured inputs.
Arguments
$axis The axis on which to disable the PSO distance counters.
You can specify additional conditions under which the counters will reset by using the PsoDistanceConfigureCounterReset() function. You can specify multiple counter reset condition options simultaneously. To do this, set the $optionsMask argument to the bitwise OR of all desired option mask options, as defined in the PsoDistanceCounterResetMask enumeration.
function PsoDistanceConfigureCounterReset($axis as axis, $optionsMask as integer)
Configures the conditions which will reset the PSO distance counters.
Arguments
$axis The axis on which to configure the distance counter reset conditions.
$optionsMask A bitmask of PSO distance counter reset options. Use the values from the PsoDistanceCounterResetMask enum.
enum PsoDistanceCounterResetMask
ResetUntilMarker = 1 ResetOnMarker = 2 ResetOutsideWindow = 4 ResetWhenLaserOff = 8 ResetWhenOutputOff = 16 end |
Controlling the Distance Events
By default, the PSO Distance module will not output any generated events to the PSO Event module. To allow events to leave the PSO Distance module, use the PsoDistanceEventsOn() command.
function PsoDistanceEventsOn($axis as axis)
Enables PSO distance events.
Arguments
$axis The axis on which to enable distance events.
To prevent the PSO Distance module from outputting events to the PSO Event module, use the PsoDistanceEventsOff() command.
function PsoDistanceEventsOff($axis as axis)
Disables PSO distance events.
Arguments
$axis The axis on which to disable distance events.
When PSO distance events are enabled and you are operating in one-dimensional mode, the PSO Distance module generates events when the counters travel the specified distance in either the positive or negative direction. If you want to allow only a specific direction to generate events, you can use the PsoDistanceConfigureAllowedEventDirection() function. Specify the option for the $eventDirection argument by using the PsoDistanceAllowedEventDirection enumeration. This function has no effect in two or three dimensional mode because the module uses the sum of squares to calculate the distance.
function PsoDistanceConfigureAllowedEventDirection($axis as axis, $eventDirection as PsoDistanceAllowedEventDirection)
Configures the distance counter tracking directions that will cause PSO distance events.
Arguments
$axis The axis on which to configure the distance event directions.
$eventDirection The distance event directions to set.
enum PsoDistanceAllowedEventDirection
Both = 0 Positive = 1 Negative = 2 end |
*Go to the enum PsoDistanceInput drop-down on this page to see the inputs for your drive.