Skip to main content

SFC Element: Branch

Symbol: _cds_img_sfc_element_branch.png

You use branches to program parallel or alternative sequences in the sequential function chart.

In the case of alternative branches, CODESYS processes just one of the branch lines at a time, depending on the preceding transition condition. Parallel branches are processed at the same time.

For more information, see: Programming in SFC and Processing Order in SFC

Parallel branches

In the case of parallel branches, the branch lines have to begin and end with steps. Parallel branch lines can contain more branches.

The horizontal line before and after the branch is a double line.

_cds_img_sfc_simultaneous_branch_example.png

Processing in online mode: If the preceding transition (t2 in the example) yields TRUE, then the first steps in all parallel branch lines are active (Step11 and Step21). CODESYS processes the individual branch lines at the same time and the subsequent transition is passed afterwards (t3).

A "Branch<n>" jump marker is automatically added to the horizontal line which indicates the beginning of a branch. You can define this marker as the jump destination.

Note that you can click Alternative to convert a parallel branch into an alternative branch.

Alternative branch

The horizontal line before and after the branch is a single line.

In the case of alternative branches, the branch lines have to begin and end with transitions. The branch lines can contain more branches.

_cds_img_sfc_alternative_branch.png

If the step before the branch is active, then CODESYS processes the first transition of each alternative branch line from left to right. For the first transition that yields TRUE, the associated branch line "opens", meaning the step following the transition is activated.

Note that you can click Parallel to convert an alternative branch into a parallel branch.