MOSS – Motion smart sensor

Block SymbolLicensing group: ADVANCED
PIC

Function Description
The MOSS block implements a precise position filter for a quadrature (incremental) encoder. The implementation requires special hardware that produce not only pulse count, but also the exact timestamp of last pulse, the direction of last pulse and the timestamp of the block start execution time (or similar reference time). Both timestamps must be from the same (or synchronized) source. The output of the MOSS block is not only the filtered position, but also the filtered velocity and acceleration. The filtering level is set by the alpha parameter. The setting is a compromise between noise reduction and signal delay (averaging).

Note 1: Some people think that a quadrature encoder will get a precise position value (accurate to 1 pulse) and the exact velocity could be obtained by dividing the pulse difference by the time difference. We believe that the MOSS block achieve better results. You can put both values into a graph (the TRND block) and check the differences.

Note 2: The filter is implemented as a Kalman filter for a second-order system (input is acceleration, output is position) discretized for a variable sampling period (current timestamp difference). Input and output noises are necessary parameters for Kalman filter design. If both noises are Gaussian, the only parameter is ratio of input and output noise that is the alpha parameter of the MOSS block.

Inputs

tsPulse

Last pulse timestamp

DWord (U32)

cntPulse

Last pulse count

DWord (U32)

tsSync

Timestamp of the Sync pulse. The Sync pulse is the time when the filtered outputs are valid.

DWord (U32)

flags

Input status flags (1: POS, 2: NEG, 4: RUN)

DWord (U32)

R1

Block reset

DWord (U32)

Parameters

freq

Source timestamp tick frequency [Hz]   0.0 100000000.0

Double (F64)

stall

Stalled time [s]. If no pulse is received in the stalled time interval, sensor is considered stopped and the outputs (pos, vel,acc) are set to 0.   0.0 0.08

Double (F64)

alpha

Kalman filter design parameter. A lower value means smoother (less noise) outputs, but more delayed in dynamic situation (when acceleration is changing).   0.0  200.0 26.0

Double (F64)

maxpos

Kalman filter rounding optimization. If pos is greater then maxpos, the internal position processed by the Kalman filter is decremented by an integer multiple of maxpos and incremented back for output. This causes the filter algorithm to calculate small enough numbers and not reduce accuracy due to rounding errors. The default value should not normally be changed.   0.0 1e+10

Double (F64)

mindivert

Predictor minimal divert time [s]. If no pulse is received for a long time, the predictor output will drift. To overcome this drift, if no pulse is detected for longer then mindivert time, the output position is clamped to +-1 pulse from input (mesured) position.   0.0 0.003

Double (F64)

Outputs

pos

Filtered position

Double (F64)

vel

Filtered velocity

Double (F64)

acc

Filtered acceleration

Double (F64)

status

Output status flags (1: POS, 2: NEG, 4: RUN, 8: INIT, 16: PULSE, 32: STALLED, 64: DIVERT)

Long (I32)

iE

Error code

Error

i ....

REXYGEN general error

2023 © REX Controls s.r.o., www.rexygen.com