EBSILON®Professional Online Documentation
EbsScript / EbsScript Expressions
In This Topic
    EbsScript Expressions
    In This Topic

    EbsScript Expressions

    There are many places in Ebsilon, where you can use so called expressions (very short EbsScripts) instead of simple text.

    This text may contain simple strings, which are displayed as they are, or else can contain expressions, which are evaluated. Such expressions must be written within braces "{ }”.

    Expressions may e. g. be used in

    You can find examples here.

    If faulty expressions (i. e. cannot be compiled) are used in specification or model option values, they are displayed with a light red background.

     

    The syntax for these expressions is the as the syntax used in EbsScript. An overview of the available functions is given in the EbsScript-Documentation.

    Within these brackets, one can use numbers, arithmetic expressions (+,-,*,/), variables (e.g. ComponentName.SpecName or LineName.ValueName or @model.VariableName) and certain string functions (e.g. getFileName ()) and mathematical functions (e.g. log()) and user-defined functions that are included in a Standard-Unit.

    It is even possible to use a format specification within the expression. It must be added to the expression with a semicolon (”;”).

    The syntax for floating point numbers is ”;%n.mf”, where n is the minimal field width and m is the number of decimal digits.

    You can also use anonymous functions. An anonymous function is a function without a name, which is called just after its definition.

    An example:

    {uses @fluid;
    function():string
    var fluidData:FluidData;
    begin
    fluidGetAnalysis( NameOfAnOilMeltPipe, fluidData);
    if fluidData.fluidExtension <> nil and fluidData.fluidExtension^.fluidExtensionType = fluidExtensionTypeThermoLiquid then
      result:=enumtostring(fluidData.fluidExtension^.fluidExtensionThermoLiquid.thermoLiquidType)
    else
      result:="no thermo-liquid defined"; 
    
    end();}
    
    

    This example can also be used with the text field of a value cross of type Text-Field connected to a pipe. "NameOfAnOilMeltPipe" can be replaced by $. $ is a link to the object the value cross is connected to.