Macro command While ... End

<< Click to Display Table of Contents >>

Navigation:  Macros > Macro commands and parameters > Macro loop commands >

Macro command While ... End

Purpose:

To keep executing part of a macro as long as a particular condition is met. First, fulfilment of the condition is determined; depending on the outcome, the relevant part of the macro is executed or skipped. Following execution, fulfilment of the condition is determined again.

 

The While command is always used together with an End command. The While and End lines enclose the part of the macro whose execution depends on fulfilment of the condition. General notation:

While ( value1 , collation character , value2 )

End

 

The collation character may be:

= (equals),

<> (does not equal),

< (less than),

<= (less than or equal to),

> (more than),

>= (more than or equal to).

 

Example:

The next macro commands are executed for a simultaneousness varying from 1 through 0.2:

 Set( MySimultaneousness, 1 )

 While(MySimultaneousness, > , 0.1 )

         SetSelection( Node( 'MV-network' ).Simultaneousness, MySimultaneousness )

         Loadflow( 0, , true )

         Subtract(MySimultaneousness, 0.1 )

 End