Documentation Home Page HYPERSIM Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

TestView Command | General | If (expression)

If Dialog Box

This command calls the ScopeView solver to evaluate the expression (same as “Eval” and “Expression”). Therefore, it is possible to use the functions available with its calculation engine. Each 'if' expression in a loop is evaluated prior to the beginning of a loop. However, it does not execute the content at the beginning of a loop (no matter if the result is true or false).

Example: Suppose you want to do: if( max( breaker current phase A > 500)) inside a loop where the breaker is Di1. The script cannot access directly the signals from the signal key of the Processing command. Therefore, you need first to assign a variable to this signal in the processing (it can be a whole signal, in opposition to post-processing that can only accept scalar values).

The 'if' expression would then be

In this case, if the variable is not initialized, it will cause an error and terminate de test sequence because it tries to evaluate if a string is bigger than 500 (“NotFound > 500”). 

Thus, you need to initialize the variable before the loop using the command Assign:

The initial value does not matter if the Processing command is executed before the if expression (HypProc will overwrite the variable). 

Note: Initialization is not always necessary. For instance, will not terminate the test sequence even if the variables are not defined because it is a “!=” operator (comparing strings does not cause an error with this operator).

Some accepted operators

<, <=LT, LTE
>, >=GT, GTE
/, *Div., multi.
+, -Plus, minus

OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | | +1 514-935-2323