An expression in EASA is a mathematical or logical statement that involves a combination of:

- Numbers
- Object names
- Mathematical operators
- Logical operators
- Constants

An example of an expression: (5.0* **W**-**t**/2.0)^2

where first the object value of **W** will be multiplied by five, then one-half of the value **t** will be subtracted from the first term, and finally, the previous result will be raised to the power two.

The EASAP Builder allows the use of object names within expressions. When the name of an object is entered as part of an expression it becomes an object reference, the value of the object referred to will be substituted into the expression just before the expression is evaluated while the EASAP is running.

An object name must:

- Consist of only alphabetic letters (a-z) and numbers (0-9)
- Not be the same as an operator or constant name
- Not have digits anywhere except at the end
- Not contain the name of an operator or special constant

Valid object name examples:

**x****xx****aVariable****var1****var2**

Invalid object name examples:

**3x****my2variable**

Use of object names is case sensitive, be consistent in object names to minimize errors.

As a rule, it is a good idea to name all your objects using the rules for expression use because you will not always be able to anticipate when you’ll use an object in an expression.

Operators are used in expressions to perform mathematical or logical operations. For mathematical operations, operators exist to allow the basics, like addition, subtraction, multiplication, and division, but others exist for performing more advanced operations, like trigonometric functions, logarithmic functions, etc.

The table below contains the set of mathematical operators available for use in expressions.

Operators | Function |
---|---|

+ , - , * , /, ^ | Add, Subtract, Multiply, Divide, Raise to power of |

% | Modulo or remainder, e.g. 7%3 returns 1 |

sqrt(..) | Square root |

abs(..) | Return absolute value |

round(..) | Round to closest integer |

fpart(..) | Returns decimal value of argument, e.g. fpart(2.345) returns 0.345 |

ceil(..) | Returns next integer greater than or equal to argument |

floor(..) | Returns next integer less than or equal to argument |

sin(..), cos(..), tan(..), cotan(..) | Trigonometric functions: Arguments within parentheses have units of radians |

asin(..), acos(..), atan(..), acotan(..) | Trigonometric functions: Angles returned from function have units of radians |

sinh(..), cosh(..), tanh(..) | Hyperbolic functions |

ln(..), exp(..), [base]log(..) | Logarithmic functions |

fac(..) | Factorial of integer argument, n, i.e. n *(n-1)*(n-2)*…*1 |

sfac(..) | Semi-factorial of integer argument, n, i.e. n * (n -2)*(n-4)*…*4*2 if n is even, or n *(n-2)*(n-4)*…*3*1 if n is odd |

Logical operators can be used to create expressions that will produce different values depending on a logical condition. The result of an expression using a logical operator will be 0.0 for false or 1.0 for true. Complete logical expressions can be nested within a larger mathematical expression to allow the value of the overall expression to be a function of one or many logical conditions. The table below contains the set of logical operators available for use in expressions.

Operators | Function |
---|---|

== , != | Equal to, Not equal to |

&&, || | And, Or |

> , < | Greater than, Less than |

>= , <= | Greater than or equal to, Less than or equal to |

! | Not (Reverts true to false & false to true) |

Parentheses may be used to override the order of evaluation.

The following list shows the order in which operators are evaluated within an expression:

- !
- sin cos tan ln exp sqrt abs round … etc.
- * / %
- log
- + -
- > >= < <=
- == !=
- ||
- &&

EASA’s Expression Language also contains a few common constants for use in expressions. The constants are provided in the table below.

Constant | Value |
---|---|

pi | 3.14159265… |

euler | 2.7182818… |

true | 1.0 |

false | 0.0 |

Constants and object references in expressions are case-sensitive→ constants must be lower case.

Below are a number of mathematical expression examples using hypothetical SCALARs.

Consider the REALBOXs:

**A**= 1.0**B**= 2.0**C**= 3.0

Expression | Value |
---|---|

2*(A + B)^2 - C | 2*(9) - 3 = 15 |

cos(B*pi) | 1.0 |

(A>=2)*B + (A<2)*C | 0.0*2 + 1.0*3 = 3 |

10log(2*^{1)} | 1.0 (note: 10log is 'log base ten') |

A logical expression evaluates to a **true** or **false** value.
Below are some examples using hypothetical object references and initial values:

**A**= 2 (INTEGERBOX)**C**= “choice1” (CHOICE LIST)

Expression | Value |
---|---|

C==“choice2” | false (0.0) |

(C==“choice1”) && (A<3) | true (1.0) |

(A>3)||(A<1) | false (0.0) |

Many more examples can be found at the Diagramming and Coupling To Software Applications pages. When an expression is typed into a Parameter Value box, error checking is performed to ensure that the expression is valid. If the expression is deemed to be valid, it will be colored blue. If deemed invalid, it will be colored red. In some cases, the validity of an expression cannot be determined definitively, and in such cases, the expression will be colored black. In a comma separated list of expressions, only the invalid expressions in the list will be colored red, the rest will be blue or black.

Before saving an EASAP or checking an EASAP’s user interface using the Toggle to Preview button, all invalid expressions must be fixed or a pop-up error message will appear.

A typical mistake that can be made when entering an expression is to type in an incorrect object name. To help with this issue, the EASAP Builder will display a drop-down list of available object names that can be selected as you type in your expressions. The list of objects will be filtered by the characters you type. An example of the object name auto-completion dropdown is shown below.

The list of available objects shown in the auto-completion dropdown is derived from the global list of objects. It is therefore exhaustive and may contain objects that are not appropriate selections. For instance, it might contain LIST when only a SCALAR is valid.