Conditional execution

You can control when and whether Embed executes a compound block by using an external Boolean trigger on the compound block. The trigger appears as a red ball attached to the input side of the compound block. When the input to the trigger is greater than or equal to 1, the trigger is enabled and the blocks within the compound block are executed. Conversely, when the input to the trigger is less than 1, the trigger is disabled and the blocks within the compound block are not executed. When there is no input to the trigger, the blocks within the compound block are not executed.

As a simple example, suppose you want to control when Embed executes a divide operation. You can set up a diagram like the one shown below:

.

When a value of 1 is fed into the trigger, the divide operation is performed. Output from the compound block shows the quotient. If, however, the trigger input is 0.2, the divide operation is not performed, and the output from the compound block is 0.

With triggered compound blocks, you can speed up your simulation by encapsulating those portions of the diagram that are used infrequently in the compound block. You can then trigger the execution of the compound block under specific conditions.

Conditional execution in the boot function: For a $firstPass-enabled compound block to run in the boot function, it cannot have any input pins. If there are input pins, Embed expects the inputs to be evaluated in the control routine.

To enable a Boolean trigger

1.    CTRL+right-click the compound block, or choose Edit > Block Properties and click the compound block.

2.    In the Compound Properties dialog, activate Enabled Execution.

3.    Click OK, or press ENTER.