EBSILON®Professional Online Documentation
EbsScript / EbsScript Interface Units / InterfaceUnit-System
In This Topic
    InterfaceUnit-System
    In This Topic

    InterfaceUnit - System

    Also open the Interface unit itself in the EbsScript Editor (EbsScript-->Open Interface Unit-->System) for a lot more information

    Name

    Purpose

    Arguments

    Return value

    Example

    debugBreak

    A "breakpoint" is set in the script. This makes it possible to interrupt the execution of the script.

    -

    -

     

    diagramAsRasterGraphic

    Export of the diagram with a specified ID as a raster graphic to the external file with a specified path and extension (which in turn specifies the raster graphic format: BMP, PNG, JPG etc.)

    1: INTEGER: diagram configuration ID

    2: STRING: raster graphic file name including path

    3: INTEGER: maximal time delay in seconds allowed to wait until the execution completion. Must be >=1. If zero or negative the value is ignored and no time restriction is applied.

     BOOLEAN: true if the execution is successful

    var

    ID, maxTimeInSeconds : integer;
    path : string;
    bOK : boolean;

    begin

    ID:=0;

    path:="Picture.png";

    maxTimeInSeconds:=0;//no time restriction

    bOK:=diagramAsRasterGraphic(ID,path,maxTimeInSeconds);

    end;

     

    diagramDataAsText

    Export of the diagram data with a specified ID as plain text to the external file with a specified path

    1: INTEGER: diagram configuration ID

    2: STRING: external file name including path

    3: INTEGER: maximal time delay in seconds allowed to wait until the execution completion. Must be >= 1. If zero or negative the value is ignored and no time restriction is applied.

     

     BOOLEAN: true if the execution is successful

    var

    ID, maxTimeInSeconds : integer;
    path : string;
    bOK : boolean;

    begin

    ID:=0;

    path:="Data.csv";

    maxTimeInSeconds:=0;//no time restriction

    bOK:=diagramDataAsText(ID,path,maxTimeInSeconds);

    end;

     

    ebsHTML

    Creating an HTML file displaying the model (or the macro that is assigned to the current context) 

    1: STRING: HTML file name including path

    optional arguments initialized with default values:

    2:BOOLEAN: if true macros are exported recursively

    3: ARRAY * of INTEGER: array with the IDs of the profiles to be exported

    4: PictureTypeEnum: specification of the graphic file format (default=PictureTypePNG)

    5:BOOLEAN: if true separate image is exported for each profile (default = true)

    6:BOOLEAN: if true all values are included (default = false)

    7:BOOLEAN: if true expressions are shown (default = false)

    BOOLEAN:
    true: ok
    false: error

     ebsHTML ("C:\\Temp\\Test.htm");

    ebsilonComputationModes

    Returns the current calculation mode of EBSILON calculation kernels (simulation, validation, optimization, time series), e.g. be called in a KernelScripting.

    no arguments

     

                     

     

    EbsilonComputationModeEnum
    (see InterfaceUnit System)

     

    var iret:integer;

    begin

          iret := ebsilonComputationModes;

          println("iret: ",iret);

          case iret of                        EbsilonComputationModeNone :

                            begin

                                        println("EbsilonComputationModeNone");

                            end;                        EbsilonComputationModeSimulation :

                            begin

                                        println("EbsilonComputationModeSimulation");

                            end;                        EbsilonComputationModeValidation:

                            begin

                                        println("EbsilonComputationModeValidation");

                            end;                        EbsilonComputationModeTimeSeries:

                            begin

                                        println("EbsilonComputationModeTimeSeries");

                            end;                        EbsilonComputationModeOptimization:

                            begin

                                        println("EbsilonComputationModeOptimization");

                            end

                            otherwise

                            begin

                                       println("unknown ebsilonComputationMode");

                            end

                end;                

    end;

     

    ebsScriptMode

    Returns the current mode of EbsScript execution 

    no arguments               

     

     

    EbsScriptModeEnum (see InterfaceUnit System) 

     

    ebsXML

    Writes the data of the model to an XML file

    1: STRING: XML file name including path

    optional arguments initialized with default values:

    2:BOOLEAN: if true macros exported recursively

    3: ARRAY* of INTEGER: array with the IDs of the profiles to be exported

    4: BOOLEAN: if true all values are included (default = false)

    5:BOOLEAN: if true expressions are shown (default = false)

    BOOLEAN:
    true: ok
    false: error

     ebsXML("D:\\temp\\model.xml");

    enableActiveFilter

    Switches the active filter on or off. The active filter is set by means of the setActiveFilter function

    1: Boolean, if true - the active filter must be switched on, if false - off

     

                     

     

    Boolean: true if the active filter was successfully switched on / off, otherwise false 

     

    eval

    This function allows the evaluation of an EbsScript expression given as string

    1: STRING: the expression to be evaluated

    variant: the result of the evaluation

    or if v.vt=varerror:

    v.error =

    errorGeneral  or

    errorEvaluatingExpression

    var str:string; v:variant;
    begin
        inputBox("What shall be calculated?", str);
        v:=eval(str);
        str:=printToString ("The result is: ",
                                     v.rVal);
        messagebox (str);
    end.

    evaluateKernelExpression

    Determines the value of a Kernel-
    Expression in KernelScriptings

    1: CONST EBSVAR: value

    2: REAL: var result

    BOOLEAN:
    true: ok
    false: error

     

    evaluateKernelExpres sionWithEnvironment

    Determines also the numerical value of a Kernel expression in Kernel scriptings:

    In the 3rd argument - ARRAY* NAMEDVALUE - the interim results (for the current iteration step) are stored, which, in turn, are used as specifications in the Kernel expression. For example, this allows to develop a Component 93 (Kernel-Scripting) in which Kernel expressions are stored as specification values. In the script of Component 93 (Kernel-Scripting) these Kernel expressions are then evaluated. The Kernel expressions, in turn, may require some interim results (e.g. current mean logarithmic temperature difference in the case of a heat exchanger). These interim results are transferred to the function evaluateKernelExpressionWithEnvironment as Argument 3.

    1: CONST EBSVAR: value

    2: REAL: var result 

    3: ARRAY* NAMEDVALUE:
        const environment
        (Pair from STRING
        (name)

         and REAL (value))

     BOOLEAN:
    true: ok
    false: error

    var env:array of NAMEDVALUE;
    resl:real;
    begin 
      setlength( env, 1);
       env[0].name := "T_BWALL";
       env[0].value := 301.3;
      evaluateKernelExpressionWithEnvironment(
          BT126.ELAMOW, resl, env);
    end.

    getActiveFilterName Returns the name of the active filter no arguments   String: Returns the name of the active filter

    getActiveObjectDisplay

    On return provides display style (appearance details) for specified object

    1: const ebsobject - the object whose display style is searched
    2: objectdisplay (see InterfaceUnit System) - Structure in which the display details are stored on return

    Boolean: true, if the execution succeeds, otherwise false

     

    getActiveViewDisplay

    Returns all objects incl. their display style 

    no arguments  

    VIEWDISPLAY: (Structure containing an array of all objects and their display style (representation details), see InterfaceUnit System)

     

    getCalculationErrors returns the errors/warnings/comments of the last invoice on the current profile - array of calculationerror var aoc: array of calculationerror; ce:integer;
    begin
     aoc := getCalculationErrors ();
     for ce := low (aoc) to high (aoc) do begin 
      println (aoc[ce].description);
     end;
    end.

    getEbsObjValueAlternatives

    This function returns the array with pairs consisting of the numeric value for combo box entries

     

     

     

    1: EBSVAR: the variable to be analyzed ARRAY OF VALUEWITHTEXT

    var alternatives:array of VALUEWITHTEXT;
        evar: ebsvar;
        i:integer;
    begin
        getebsvar(evar,"Turbine.FCHR");
        alternatives:=getEbsObjValueAlternatives( evar );
        for i:=0 to length(alternatives)-1 do begin
            print(alternatives[i].value,": ");
            print(alternatives[i].text,"\n");
        end;
    end.
                   

    makeNamedIndex This function assigns values to a variable of type NAMEDINDEX.

    1: string: name

    2. integer: index

    NAMEDINDEX var n:NAMEDINDEX;
    begin
     n   := makeNamedIndex("Text", 7);
    end.
    makeNamedValue This function assigns values to a variable of type NAMEDVALUE.

    1: string: name

    2. real: value

    NAMEDVALUE var v:NAMEDVALUE;
    begin
      v   := makeNamedValue("Text", -88.1);
    end.
    makeValueWithText This function assigns values to a variable of type VALUEWITHTEXT.

    1: real: value

    2. string: text

    VALUEWITHTEXT vwt:VALUEWITHTEXT;
    begin
      vwt := makeValueWithText( -1234.1, "text");
    end.
    makeValueWithUnit This function assigns values to a variable of type VALUEWITHUNIT.

    1: real: value

    2. UNIT_Enum: unit

    VALUEWITHUNIT vwu:VALUEWITHUNIT;
    begin
      vwu := makeValueWithUnit(-77.7, UNIT_mbar);
    end.

    printModelEx

     

    1: array of PRINTCONTROL:

    2: STRING: printer name

    3: STRING: output file name

    BOOLEAN:
    true=printing successful
    false=otherwise

     

    printModelEx2

    further settings for printing: filtering, hidden objects

    1: array of PRINTCONTROL2:

    2: STRING: printer name

    3: STRING: output file name

    BOOLEAN:
    true=printing successful
    false=otherwise

    See example at the bottom of this page

    setActiveFilter

     

    1: array of PRINTCONTROL2:

    2: STRING: printer name

    3: STRING: output file name

    BOOLEAN:
    true=printing successful
    false=otherwise

     

    var brc: boolean;
    arcontrol : array of PRINTCONTROL2; // see Interface unit System
    control : PRINTCONTROL2;
    begin
    
        setlength (arcontrol, 1);
    
        control.layout      := "CM";              // name of a print layout
    control.context := "P6_Context"; // name of a context
    control.profile := "Design"; // name of a profile
    control.useFilter := filterTypeApp; // FILTERTYPEENUM
    control.filterIndex := 0; // first self defined APP-Filter (Inactive)
    control.showAll := true;
    control.printFrame := true;
    control.printUnconnectedLinks := true;
    control.markUnconnectedStreamEndings := true;
    control.resetToWholeModel := false;

    arcontrol[0] := control;
    println (printModelEx2 (arcontrol, "\\\\c47bra01\\HP Color Laserjet")); // prints "true" or "false"
    end.