PSO Example 1
The following example demonstrates a position synchronous output function using the LessThan comparison type.
The parameters are set as follows.
ComparisonType = LessThan
Point 0 = 1000
Point 1 = 2000
Point 2 = 3000
After setting the above parameters, the axis is moved from position 0 to position 4000 using a position command. The output and active index during this motion are shown in the following figure.

The active index remains 2 during the segment from 3000 to 4000, when the output is inactive. When the comparison yields false for all data points, the active index still contains the index of the data point that last yielded true for the comparison.
The following is the code for this example.
EventControl::ComparatorSource src;
EventControl::PSOOutput out;
double point[3];
Motion::PosCommand pos;
src.axis = 0;
src.sourceType = EventControl::ComparatorSourceType::PosCommand;
out.outputType = EventControl::PSOOutputType::IOOutput;
out.byteAddress = 0;
out.bitAddress = 0;
out.invert = 0;
point[0] = 1000;
point[1] = 2000;
point[2] = 3000;
pos.axis = 0;
pos.profile.type = ProfileType::Trapezoidal;
pos.profile.velocity = 500;
pos.profile.acc = 500;
pos.profile.dec = 500;
pos.target = 4000;
wmxlib_EventControl->SetPSOConfig(0, EventControl::ComparisonType::LessThan, &src, &out, 0);
wmxlib_EventControl->SetPSOMultipleData(0, 3, point);
wmxlib_EventControl->StartPSO(0);
wmxlib_CoreMotion->motion->StartPos(&pos);