11.1.2 QuadratureDecoder Module |
The RAYLASE.SPICE3QuadratureDecoderModule reads the pulse signals from an encoder attached to the conveyor belt (or other moving part) and converts them into a position value that the MOTF tracking system uses to follow the part's motion. This chapter describes the parameters that control how that conversion happens, and the two distinct modes the module can operate in:
Hardware mode — an external encoder is physically wired to the SP-ICE 3 Card, and the module decodes its quadrature signal.
Simulation mode — no physical encoder is required; the card generates a synthetic position signal in software.
The incoming raw encoder data (in counts) is scaled by QuadratureDecoderModuleDistancePerCount, mapping encoder counts to a linear distance. The result of this scaling is referred to as the belt position, and is the quantity used by the MOTF tracking system to follow the part's motion.
Note:QuadratureDecoderModuleDistancePerCount is also used when QuadratureDecoderModuleSimulateEncoder is true — see MOTF Encoder Simulation below for how it applies in that mode.
For tracking to trigger correctly when the belt position reaches a given distance from a reference position, the measured belt position must increase when the part moves towards the scanner.
Depending on how the encoder is wired to the SP-ICE 3 Card, it may instead report decreasing positions even though the belt is actually moving in the positive direction towards the scanner.
In this case, the decoder’s counting direction can be reversed by setting QuadratureDecoderModuleInvertDirection to true.
Many incremental encoders provide an additional Index signal (also known as the home
or reference
signal), which fires once per revolution (or once per traversal, for linear encoders). Because the position derived from quadrature counting can accumulate drift or error over time (e.g. from missed pulses), the Index signal offers a way to periodically re-establish an exact, repeatable reference position.
If the encoder provides an Index signal, the card can be instructed to make use of it by setting QuadratureDecoderModuleEnableIndex to true. When enabled, the card resets the decoder position each time its Index input is asserted.
Instead of connecting external encoder hardware to the SP-ICE 3 Card, the card's built-in encoder simulator can be activated. This lets you exercise or test the MOTF tracking system — including tuning and validating the parameters described above — without any physical encoder attached.
The simulated encoder is of particular interest either for debugging purposes, or for applications where the part's velocity is sufficiently constant that a hardware encoder is unnecessary.
The flag QuadratureDecoderModuleSimulateEncoder defines whether the module's position signal is fed from an external encoder (false) or from the built-in generator (true).
QuadratureDecoderModuleSimulationSpeed and QuadratureDecoderModuleSimulationAcceleration let you command the simulated encoder to a target velocity, either instantaneously or by ramping gradually to that target — the latter can be used, for instance, to simulate a conveyor belt's gradual acceleration to a new target velocity.
Note: Internally, the simulator generates encoder ticks at a frequency derived from QuadratureDecoderModuleSimulationSpeed divided by QuadratureDecoderModuleDistancePerCount. Those ticks are then scaled back into a distance through QuadratureDecoderModuleDistancePerCount, exactly as they would be for a real encoder. Because the same QuadratureDecoderModuleDistancePerCount value is used in both directions of this conversion, its specific value does not change the resulting simulated speed. We recommend leaving QuadratureDecoderModuleDistancePerCount at its default value when using the simulated encoder, to ensure a reasonable tick frequency.
If MOTF tracking is active and the card encounters an out-of-field exception, the QuadratureDecoder position is reset. For other abort causes — for example, an abort requested by the user — the QuadratureDecoder position is not reset.
This behavior applies regardless of whether the decoder is operating in hardware mode or simulation mode.