Condition: Difference between revisions

From SweepMe! Wiki
Jump to navigation Jump to search
Line 12: Line 12:
More complex conditions are possible in conjunction with the module [[Calc]] where you create first a variable that is True or False based on multiple values. Then, the module Conditions simply checks whether the return value of Calc is True or False.
More complex conditions are possible in conjunction with the module [[Calc]] where you create first a variable that is True or False based on multiple values. Then, the module Conditions simply checks whether the return value of Calc is True or False.


[[File:Condition Module.png|thumb|alt=GUI of the Condition module|GUI of the Condition module]]
[[File:Condition Module.png|none|right|alt=GUI of the Condition module|GUI of the Condition module]]


== Operators ==
== Operators ==

Revision as of 14:05, 8 May 2024

Condition is a Module that can perform a certain action based on a condition that must be fulfilled. For example, a measurement point can be skipped or you can leave the current branch of the sequence and proceed with the next one.

Usage

The condition must be either True or False. Every conditions consists of four parts:

  1. a SweepMe! value (e.g. a measurement value or a Sweep value of another module)
  2. an operator
  3. a value to be compared with
  4. an action that should be performed in case the condition is True

More complex conditions are possible in conjunction with the module Calc where you create first a variable that is True or False based on multiple values. Then, the module Conditions simply checks whether the return value of Calc is True or False.

GUI of the Condition module

Operators

The following operators can be used:

  • == (equal)
  • != (unequal)
  • > (greater than)
  • < (less than)
  • >= (greater or equal)
  • <= (less or equal)

Actions

SkipPoint

skips a single measurement point. Only works well if the condition is related to at least one SweepValue of a certain module in the branch, because the condition is evaluatefd before the measurement point will be measured.

SkipSweepsBelow

All variations of modules that are below the Condition module in the sequencer are skipped and the procedure continues with the next variation of a module above the Condition module.

SkipCurrentBranch

All variations that have to be done in the current branch of the sequencer are skipped and the procedure continues with the first variation of the next branch.

Stop

stops the measurement, same as pressing the button 'Stop'

Pause

pauses the measurement, same as pressing the button 'Pause'

Execution

The parameter 'Execution' defines when the Condition is checked:

  • Always: At every possible step (see below).
  • Before branch (in 'configure'): Before the branch is entered and before configure() of child items is called. Can be used to stop a sweep or to skip a branch at the most early possibility.
  • Before each point (in 'start'): At the beginning of a measurement point in the start() phase.
    In module versions before 2024-04-16 this option was called "At the beginning".
  • Before branch and each point (in 'configure' + in 'start'): Combines both of the above.
    In module versions before 2024-04-16 this option was called "Before point".
  • After each point (in 'finish'): After the measurement point is finished in the finish() phase.
    In module versions before 2024-04-16 this option was called "At the end".
  • Never: No execution will be done. Can be used to switch off this condition.

Applications

  • Stop a measurement after a certain time
  • Skip a measurement point for certain Sweep values which can be helpful to do conditional sweeps
  • Skip the operation of the current branch which can be helpful to reach a certain condition and proceed with the next measurement