parallel
Short summary
Method to perform a given action on all objects inside the collection.
All objects are invoked with the applier each cycle until all are done.
If at any point the applier returns an error the foreach stops at the current object and returns an error.
Example:
You have a list of numbers: 1 2 3 and a ConcreteIncrementApplier that can take a number and increment it.
Calling list.forEach(TRUE, ConcreteIncrementApplier) will increment all numbers in the list, becoming: 2 3 4.
Return: SUCCESS: if applier returned SUCCESS on every object,
ABORTED: execute has a falling edge during iterate,
BUSY: When parallel had rising edge on execute and applier returned not SUCCESS for all objects,
IDLE: parallel wasn't started yet,
ERROR: error occured during execution
- Return type: CNM_ReturnTypes.SingleExecutionState
Parameters
| Name | Type | Comment | Kind |
|---|---|---|---|
| execute | BOOL | control bit to start or abort the execution | input |
| applier | IApplier | the applier to be used on all objects | input |
Code
Declaration
METHOD parallel :CNM_ReturnTypes.SingleExecutionState
VAR_INPUT
(*control bit to start or abort the execution*)
execute :BOOL;
(*the applier to be used on all objects*)
applier :IApplier;
END_VAR