Connections and Execution Flow
Use connections to determine the execution flow between steps.
Examples in this topic are based on the Minimal Execution (Direct) design-time execution mode.
Consider the following simple robot:
This robot consists of three steps: Step A, Step B, and Step C. Assuming that no errors occur, and that each step generates exactly one output robot state, the robot is executed as follows: An initial robot state is generated and used as input to Step A (being the first step). Step A produces an output robot state. This output robot state is the input robot state of Step B. Similarly, Step B produces a robot state, which is the input robot state of Step C. Once Step C has executed and produced an output robot state, execution completes. In short, the execution of steps is described as follows: "A, B, C."
Sometimes, a step generates no output robot state when executed. This happens when an error or a test step causes execution to continue somewhere else in the robot (see Conditions and Error Handling).
Steps containing a loop action may process the input state several times, each time outputting a distinct robot state. Consider the following robot where step B contains a loop action:
Assuming that there are no errors or test steps, that step B outputs three robot states, and that all other steps output exactly one robot state, the steps are executed in the following order: "A, B[1], C, D, B[2], C, D, B[3], C, D", where B[ N ] refers to the N th iteration of the loop action contained in step B. Note that the output robot states by step B are different robot states: each iteration will output a new robot state. Hence, step C will receive a new input robot state each time it is executed.
A step can connect to more than one step. This is called "branching". Consider the following robot:
In this robot, step A is followed by a branch point, where the connection splits out in two branches. One branch consists of step B and step C, and another consists of step D and step E. All branches coming out of a branch point are executed, one after another. Therefore, assuming that no errors or test steps change the control flow and that each step generates exactly one output robot state, the preceding robot is executed as follows: A, B, C, D, E. However, it is important to note that step B and step D each receives a copy of the same output robot state produced by step A.
Branches can merge, and in complicated ways. Consider the following robot:
This robot illustrates how connections can be explicitly ordered. In this robot, the branches of step D are executed in the order specified by the numbers: step E is executed before step C. If an order is not specified (by numbers), connections are executed top-down. Thus, assuming that there are no test steps, that no errors occur, and that each step generates exactly one output robot state, the robot is executed as follows: A, B, C, D, E, C. The first time step C is executed, it receives the output robot state produced by step B; the second time step C is executed, it receives the output robot state produced by step D.
Sometimes you want to select (execute) only one of several branches, depending on circumstances. The Conditions and Error Handling topic shows how to do this.