Declare sections of conditionally executed statements/equations

Syntax


if(<logical condition 1>)

   <list of equations/statements>

else if(<logical condition 2>)

   <list of equations/statements>

else if(<logical condition 3>)

   <list of equations/statements>

<additional branches…>

else

   <optional default branch list of equations/statements>

end

Description


IF/ELSE statements are used to denote sections of code which should be conditionally executed depending on the value of one or more logical “predicate” expressions.  The ELSE branches are optional, meaning the simplest IF section may have only one predicate expression and a corresponding END statement surrounding the statements to be conditionally executed.


For purposes of sorting, the input and output quantities of an IF/ELSE section are determined by the collection of statements inside the loop; however, statements inside the loop are not sorted.  Rather, the entire IF/ELSE section is sorted as a single statement.  If the default sorting of the statement does not yield the intended model behavior, the statement can be enclosed in a PROCEDURAL section to force the intended sorting.

Example


if (t < 1.0)

   x = t^2

else if ( t < 1.35)

   x = exp(t)

else if (t < 7.29)

   x = sin(t)

else

   x = sqrt(t)

end