◆ StreamingOutputsEnableSet()

virtual void StreamingOutputsEnableSet ( bool  enable)
pure virtual

Sets whether Streaming Output is enabled (true) or disabled (false).

ℹ This function is avaliable in RapidCode and RapidSequencer

Part of the Streaming Motion method group.

Description:
The Streaming Output List is maintained as an array and index and must be initialized before use. This function will set whether Streaming Output is enabled. Setting to false resets the current index to 0, but does not free the array backing.
Note
This function must be set appropriately or streaming motion calls (MovePT, MovePCT, etc) will fail. If set to true and no outputs are added, the move will throw an exception. If set to false and moves are added, the outputs will not trigger
Parameters
enableEnable (true) or Disable (false) Streaming Output behavior.
Sample Code:
SingleAxisSyncOutputs
// Constants
const int TOTAL_POINTS = 4; // total number of points
const int EMPTY_CT = -1; // Number of points that remains in the buffer before an e-stop
const int OUTPUT_INDEX = 0; // This is the index of the digital output that will go active when the user limit triggers.
const int NODE_INDEX = 0; // The EtherCAT Node we will be communicating with
double[] positions = { 1.0, 2.0, 3.0, 4.0 }; // These will be the streaming motion 5 positions.
double[] times = { 0.5, 0.1, 0.2, 0.4 }; // These will be the streaming motion 5 positions' time.
int outputEnableID = 2; // The motion element ID at which to set the output
int outputDisableID = 3; // The motion element ID at which to set the output
// Set up the inputs
//IOPoint output0 = IOPoint.CreateDigitalOutput(axis, RSIMotorGeneralIo.RSIMotorGeneralIo16); // Retrieve DOUT 1, Method 1: requires you know the io adress in memory, slightly faster
IOPoint output0 = IOPoint.CreateDigitalOutput(controller.IOGet(NODE_INDEX), OUTPUT_INDEX); // Retrieve DOUT 1 Method 2: only need to know node index
output0.Set(false); // Set the output low
// Set up Sync Outputs
axis.StreamingOutputsEnableSet(true); // Enable streaming output.
// ENABLE the Sync Output(s)
axis.StreamingOutputAdd(output0, true, outputEnableID); // This will turn DOUT1 High when the streaming motion reaches its 3rd motion point.
axis.StreamingOutputAdd(output0, false, outputDisableID); // This will turn DOUT1 Low when the streaming motion reaches its 4th motion point.
// DISABLE the Sync Output(s)
//axis.StreamingOutputAdd(output0, false, outPutEnableID);
axis.MovePT(RSIMotionType.RSIMotionTypePT, positions, times, TOTAL_POINTS, EMPTY_CT, false, true); // Start Streaming Motion
while (!axis.MotionDoneGet())
{
if (axis.MotionIdExecutingGet()>outputEnableID && axis.CommandPositionGet()<outputEnableID)
{
Assert.AreEqual(output0.Get(), true, "The output should be triggered");
}
else
{
Assert.AreEqual(output0.Get(), false, "The output should NOT be triggered");
}
}
axis.StreamingOutputsEnableSet(false); // Disable Sync Outputs.
axis.AmpEnableSet(false); // Disable the motor.
See also
StreamingOutputsEnableSet, StreamingOutputsClear, StreamingOutputAdd
Examples
SingleAxisSyncOutputs.cpp, and SyncOutputWithMotion.cpp.