MPIControlSubSampleMapObject

Declaration

typedef struct MPIControlSubSampleMapObject {
    int32_t subRate; /* valid values are:
                      1 (every sample),
                      2 (every other sample),
                      4 (every 4th sample) */
    int32_t sampleStartIndex;
} MPIControlSubSampleMapObject;

 

Required Header: mpithread.h

Change History: Added in 04.00.

Description

MPIControlSubSampleMapObject specifies the sub-sampling configuration for a single object on a motion controller.

SubRate
sampleStartIndex
Sample 0
Sample 1
Sample 2
Sample 3
1
0
2
0
-
-
2
1
-
-
4
0
-
-
-
4
1
-
-
-
4
2
-
-
-
4
3
-
-
-

subRate The sub-rate an object is evaluated at:
1 indicates an object is evaluated every sample.
2 indicates an object is evaluated every other sample.
4 indicates an object is evaluated every 4th sample.
sampleStartIndex The initial sample an object is evaluated on.
When Value of subrate is 1, valid values of sampleStartIndex is 0.
When Value of subrate is 2, valid values of sampleStartIndex is 0 and 1.
When Value of subrate is 4, valid values of sampleStartIndex is 0, 1, 2, and 3..

Sample Code

/* Configure Sub-Sampling Example 2

    Assume MS[2] is set up as a gantry to
     control axis[2] and axis[3].

    MS Evaluation Matrix:
    ---------------------
        Sample:     0   1   2   3
        MS 0:       X       X
        MS 1:           X       X
        MS 2:       X   X   X   X
    .............................
    Total objects
    Evaluated:      2   2   2   2 (even-weighted)

    Axis, Motor Evaluation Matrix:
    ------------------------------
        Sample:     0   1   2   3
        Object 0:   X       X
        Object 1:       X       X
        Object 2:   X   X   X   X
        Object 3:   X   X   X   X
    .............................
    Total objects
    Evaluated:      3   3   3   3 (even-weighted)
*/
void configureSubSampling2(MPIControl control)
{
    MPIControlSubSampleMap  motionMap =
        {{  /*  subRate,    sampleStartIndex */
            {   2,          0 }, /* MS 0: every other sample, start on sample 0 */
            {   2,          1 }, /* MS 1: every other sample, start on sample 1 */
            {   1,          0 }, /* MS 2: every sample, must start on sample 0 */
        }};
    MPIControlSubSampleMap  axisMap =
        {{  /*  subRate,    sampleStartIndex */
            {   2,          0 }, /* Axis 0: every other sample, start on sample 0 */
            {   2,          1 }, /* Axis 1: every other sample, start on sample 1 */
            {   1,          0 }, /* Axis 2: every sample, must start on sample 0 */
            {   1,          0 }, /* Axis 3: every sample, must start on sample 0 */
        }};
    MPIControlProcessMap    processMap =
        {
            &motionMap,
            &axisMap

            /* motorMap, mechaWareMap are
                default initialized to NULL.
                This means these maps will be
                indentical to axisMap.
            */

            /* motionOrder, axisOrder, motorOrder,
                mechaWareOrder are default
                initialized to NULL.
                This means deafult ordering applies
                to all objects
            */
        };

    MPIControlConfig        config;
    MPI_RESULT              returnValue;


    returnValue =
        mpiControlConfigGet(control, &config);
    msgCHECK(returnValue);

    config.processMap = processMap;

    returnValue =
        mpiControlConfigSet(control, &config);
    msgCHECK(returnValue);
}

See Also

MPIControlSubSampleMap