PSO Window Functions

The PSO Window module lets you configure a range of position values called a window. Each window includes a counter and two comparison values: a lower bound and an upper bound. The window counter tracks one feedback source and changes in real time to respond to the tracked feedback source. In most cases, the output of the PSO Window module is active when the window counter value is greater than or equal to the lower bound and also less than or equal to the upper bound. You can use the output of the PSO Window module to mask events from other modules.

The PSO Window module lets you configure and use two windows at the same time. If you want only one window, use Window 0. If you want two windows, use Window 0 and Window 1. With two windows, the output of each window is combined into one PSO Window module output. This means that the PSO Window module output is active when each window output is active (both window counters are within their respective window bounds).

Optional Purchase Necessary: PSO Window 1 is available only on drives that support two and three dimensional PSO distance tracking, which is a paid option on some drives. Review your ordering information to see the number of dimensions that your drive supports.

The PSO Window module also lets you use the drive array to specify a sequence of window ranges (array mode). The module has many advanced features, such as letting you generate events when entering or exiting a window range.

Configuring the Window 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 PsoWindowConfigureInput() function to specify the source of the position feedback signals you want the PSO window counter to track. If you want the window counter to count in the opposite direction of the selected position feedback signals, you can use the $reverseDirection argument. Once you specify a valid input for the window counter, it immediately starts to track the feedback signals. The PSO Window module can track input speeds up to 100 MHz (100,000,000 counts/second).

function PsoWindowConfigureInput($axis as axis, $windowNumber as integer, $input as PsoWindowInput, $reverseDirection as integer)

Selects the source of the specified window counter.

Arguments

$axis  The axis on which to select the window counter input source.

$windowNumber  The window number for which to select the counter input source.

$input  The window counter input source.

$reverseDirection  Configures the window counter to count in the opposite direction of its input source.

Use the PsoWindowInput enumeration to select the PSO window tracking input for your drive.

Configuring the Window Ranges

Each PSO window operates by comparing the window counter against a lower bound value and an upper bound value, together known as a range. The PSO Window module activates the output of each window when the corresponding counter is greater than or equal to the lower bound and also less than or equal to the upper bound. You can configure the module to use a single, fixed pair of range values, or an array of window range values from the drive array. To specify a fixed window range, use the PsoWindowConfigureFixedRange() function. The PSO Window module uses the values that you specify in the $lowerBound and $upperBound arguments as the lower and upper bounds of the window range, respectively. The specified window bounds must each be an integer number of counts. If you try to specify a non-integer number of counts, Automation1 Studio reports an error. You can use the Trunc() function to make sure that you specify valid integer window bounds, but this can change your expected window range by very small values.

function PsoWindowConfigureFixedRange($axis as axis, $windowNumber as integer, $lowerBound as integer, $upperBound as integer)

Configures a fixed window range consisting of a lower bound and an upper bound for the specified window.

Arguments

$axis  The axis on which to configure the window range.

$windowNumber  The number of the window on which to configure the range.

$lowerBound  The value for the window range lower bound.

$upperBound  The value for the window range upper bound.

To specify an array of window ranges, use the PsoWindowConfigureArrayRanges() function. Before you use this function, make sure that you write the number of range pair values specified by the $numberOfRanges argument, in counts, to the drive array starting with the location that you specify with the $driveArrayStartAddress argument. You must write the range pairs to the drive array in sequence, lower bound followed by upper bound. To write values to the drive array to be used as window range pairs, use the DriveArrayWrite() function and specify DriveArrayType.PsoWindowRanges 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 window ranges from the drive array, the PSO Window module uses the first specified pair of range values as the active window. When the PSO window counter exits the active window, the module loads the next pair of values from the drive array and uses the pair as the next window range. The module continues to use the values in the drive array in this way until the configured number of ranges is reached. You can use the $enableRepeat argument to tell the module to use an infinite number of drive array values. In this mode, the module returns to the value at the $driveArrayStartAddress and uses the same set of values again after the module uses the last pair of range values in the drive array.

function PsoWindowConfigureArrayRanges($axis as axis, $windowNumber as integer, $driveArrayStartAddress as integer, $numberOfRanges as integer, $enableRepeat as integer)

Configures an array of window range pairs each consisting of a lower bound followed by an upper bound.

Arguments

$axis  The axis on which to configure the window ranges.

$windowNumber  The number of the window on which to configure the ranges.

$driveArrayStartAddress  The byte-addressable index of the drive array where the lower bound of the first range pair is stored.

$numberOfRanges  The number of range value pairs to be read from the drive array.

$enableRepeat  Configures PSO to continue to use range pairs after the last range pair in the array is used, starting over at the first range pair.

By default, when you use the window ranges from the drive array, the PSO Window module loads the next window range when the counter exits the active window in either direction. If you want the module to load a new window range only when the counter exits the active window in a specific direction, use the PsoWindowConfigureArrayUpdateDirection() function. The $windowUpdateDirection argument specifies the exit directions that cause the module to load a new window range. Use the PsoWindowUpdateDirection enumeration to specify the value of the $windowUpdateDirection argument.

IMPORTANT: The PsoWindowConfigureArrayUpdateDirection() function applies only when you use a single PSO window.

function PsoWindowConfigureArrayUpdateDirection($axis as axis, $windowNumber as integer, $windowUpdateDirection as PsoWindowUpdateDirection)

Configures the array of window range pairs to update when exiting the active window range in specific directions.

Arguments

$axis  The axis on which to configure the window array update direction.

$windowNumber  The number of the window on which to configure the array update direction.

$windowUpdateDirection  Mode selection to select the active window range exit directions on which to update the window range.

Use the PsoWindowUpdateDirection enumeration to specify the value of the $windowUpdateDirection argument.

The window update direction and the window counter are relative to the encoder direction. The ReverseMotionDirection parameter does not have an effect on them. If the window update direction is negative, then the window is updated when the lower bound is exited. If the window update direction is positive, then the window is updated when the upper bound is exited.

Controlling the Window Counter

You can specify conditions under which the counter will reset to zero by using the PsoWindowConfigureCounterReset() 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 PsoWindowCounterResetMask enumeration.

function PsoWindowConfigureCounterReset($axis as axis, $optionsMask as integer)

Configures the conditions which will reset the PSO window counters.

Arguments

$axis  The axis on which to configure the window counter reset conditions.

$optionsMask  A bitmask of PSO window counter reset options. Use the values from the PsoWindowCounterResetMask enum.

You can directly set the PSO window counter to a specified value by using the PsoWindowCounterSetValue() function. Specify the desired value in counts as the $value argument.

function PsoWindowCounterSetValue($axis as axis, $windowNumber as integer, $value as integer)

Sets the specified window counter to the specified value.

Arguments

$axis  The axis on which to set the window counter.

$windowNumber  The number of the window on which to set the counter.

$value  The new counter value.

Controlling the Window Events

By default, the PSO Window module does not generate events to send to the PSO event module. Optionally, you can use the PsoWindowConfigureEvents() function to configure the module to output events when entering or exiting the active window range. Specify the desired behavior for the $eventMode argument by using the PsoWindowEventMode enumeration.

function PsoWindowConfigureEvents($axis as axis, $eventMode as PsoWindowEventMode)

Configures the conditions which will generate PSO window events.

Arguments

$axis  The axis on which to configure the window event conditions.

$eventMode  The specified window event mode.

Controlling the Window Output

By default, the PSO window output is disabled and is not active when the counter is within the active range. To enable the output, use the PsoWindowOutputOn() function. Once enabled, the output of the window module will be active when the counter is within the active range.

function PsoWindowOutputOn($axis as axis, $windowNumber as integer)

Enables the specified window output.

Arguments

$axis  The axis on which to enable the window output.

$windowNumber  The number of the window on which to enable the output.

To return the output to its default disabled state, use the PsoWindowOutputOff() function.

function PsoWindowOutputOff($axis as axis, $windowNumber as integer)

Disables the specified window output.

Arguments

$axis  The axis on which to disable the window output.

$windowNumber  The number of the window on which to disable the output.