EBSILON®Professional Online Documentation
EbsScript / EbsScript Functions / Model Functions
In This Topic
    Model Functions
    In This Topic

    Model Functions

    These functions help in printing, saving and updating a model.

    An automatic printing from EbsScript can especially be useful for creating a series of documents for the different states.

     

    Name

    Purpose

    Arguments

    Return values

    Example

    changeObjectName

    With the function changeObjectName you can redefine the names of objects. Here you can control by means of a flag how to proceed if the desired name exists already. Example:

    strNew:="Throttle_5";

    changeObjectName("Throttle_3", strNew);

    renames “Throttle_3“ to “Throttle_5“, but only if there is no object named “Throttle_5“ in the model yet. You can see by the return code of changeObjectName whether the renaming has been successful. Alternatively, you can also use the flag “allowModify“ (the third argument of changeObjectName):

    strNew:="Throttle_5";

    changeObjectName("Throttle_3", strNew, true);

    In this case, after the call strNew contains the name of the component named  ”Throttle_3“ before, i.e. ”Throttle_5“, if the renaming could be effected; otherwise ”Throttle_3“.

    A fourth parameter ”checkOnly“ makes it possible to just check if a renaming would be possible, without actually renaming the object:

    strNew:="Throttle_5";

    changeObjectName("Throttle_3", strNew, false, true);

    yields true if the renaming would be possible but does not change the name of the object.

    1: STRING: actual name

    2: STRING: new name

    3: BOOLEAN: allowModify-Flag (see purpose)

    4: BOOLEAN: checkOnly-Flag (see purpose)

    BOOLEAN:
    true=
    false=

    see purpose

    getAllCompNames

    Like getCompNames, but even those components are returned, which are deactivated for the calculation.

    1: INTEGER: Component Number

    2: ARRAY OF STRING: Field for the component names

    3: INTEGER: Size of the field handed over

    4: BOOLEAN: Flag for the handling of macros:

    true: objects of lower-level contexts are included

    false (default): only the current context is considered

    INTEGER: Total number of the components found (of these only that many are shown, which fit in the fields)

    nCount:=getAllCompNames( 46, arstrMeasmNames, 1000);

    getAllPipeNames

    Like getPipeNames, but even those components are returned, which are deactivated for the calculation.

    1: INTEGER: Pipe type (see below)

    2: ARRAY OF STRING: Field for the pipe names

    3: INTEGER: Size of the field handed over

    4: BOOLEAN: Flag for the handling of macros:

    true: objects of lower-level contexts are included

    false (default): only the current context is considered

    INTEGER: Total number of the pipes found (of these only that many are shown, which fit in the fields)

    nCount:=getAllPipeNames( 3, arstrNames, 100 );

    getCalcState

    returns the calculation status of a component i.e. whether a component is included for the calculation or else is used only as a passive graphics

    1: STRING
    Name of the component

    INTEGER:
    0: do not calculate
    1: calculate
    2: do not calculate, but print

    iStatus:=getCalcState( "Boundary value" );

    getCompNames

    With this function, it is possible to process the components one after the other in a loop. It returns an array with the names of all components of a type. The array must be created beforehand with the suitable size.

    1: INTEGER: Component Number

    2: ARRAY OF STRING: Field for the component names

    3: INTEGER: Size of the field handed over

    4: BOOLEAN: Flag for the handling of macros:

    true: objects of lower-level contexts are included

    false (default): only the current context is considered

    INTEGER: Total number of the components found (of these only that many are shown, which fit in the fields)

    nCount:=getCompNames( 46, arstrMeasmNames, 200);

    getEbscriptOutpufilename

    Returns the path of the EbsScript output file.

    -

    STRING:
    File name

    var
      str:string;

    begin

        str:=getEbsScriptOutputfilename;

        println (str);

        setEbsScriptOutputfilename
               ("D:\\temp\\ebsscript.txt", true );

        str:=getEbsScriptOutputfilename;

        println (str);

     

        if (getEbsScriptOutputfilenameAddTimestamp)
         then

        begin

          println ("Timestamp will be added");

        end;

    end;

    getEbscriptOutpufilename
    AddTimestamp

    Returns, whether a timestamp is attached to the EbsScript output file.

    -

    BOOLEAN:
    "true" if timestamp is set, else "false"

    getModelEbsScriptOutputfilename

    Returns the path of the model specific EbsScript output file.

    -

    STRING:
    File name

    getModelEbsScriptOutputfilename();

    getObjects

    Returns all objects of the model of a specific type

    1: STRING: type (class) of the requested objects

    2: BOOLEAN:
    true: include objects within macros

    false: restrict to objects in the current context (default setting)

    3: BOOLEAN:
    true: active objects only

    false: all objects (default setting)

    ARRAY of EBSOBJECT: array of requested objects

    var

      are:array of ebsobject;

      i,n:integer;

      strName:string;

    begin

      are:=getObjects("ebscomp1");

      n:=length(are);

      for i:=0 to n-1 do

      begin

        println (are[i]);

      end;

    end;

    getPipeNames

    With this function, it is possible to process the pipes one after the other in a loop. It returns an array with the names of all pipes of a type (see below for type numbers). The array must be created beforehand with the suitable size.

    1: INTEGER: Pipe type (see below)

    2: ARRAY OF STRING: Field for the pipe names

    3: INTEGER: Size of the field handed over

    4: BOOLEAN: Flag for the handling of macros:

    true: objects of lower-level contexts are included

    false (default): only the current context is considered

    INTEGER: Total number of the pipes found (of these only that many are shown, which fit in the fields)

    nCount:=getPipeNames( 3,
       arstrNames, 100 );

    getText

    returns the text entered in a text object

    1: STRING:
    Name of the text object

    STRING:
    stored text

    strText:=getText( "Text object" );

    getTextNames

    With this function, it is possible to process the text fields one after the other in a loop. It returns an array with the names of all text fields (including buttons and alarm fields). The array must be created beforehand with the suitable size.

    1: ARRAY OF STRING: Field for the text field names

    2: INTEGER: Size of the field handed over

    3: BOOLEAN: Flag for the handling of macros:

    true: objects of lower-level contexts are included

    false (default): only the current context is considered

    INTEGER: Total number of the text fields found (of these only that many are shown, which fit in the fields)

    var
      arstrNames:array[1..1000] of string;
      i,nSize,nCount:integer;

    begin
      nSize:=1000;
      nCount:=getTextNames(arstrNames,nSize);
      for i:=1 to nCount do
      begin
        print (arstrNames[i],"\n");
      end;
    end.

    getVisibleState

    returns the visibility status of an object i.e. whether an object is visible or invisible in the cycle

    1: STRING:
    Name of the object

    INTEGER:
    0: Object is invisible
    1: Object is visible

    iStatus:=getVisibleState( "Boundary Value" );

    printModel

    Prints the model with the default printer settings by using the specified layout.

    1: STRING: Name of the layout used for printing (see Print Preview, Layouts)

    2: STRING: name of the printer (optional; default printer is used when this entry is empty)

    3: STRING: in case of printing to a file: name of the file (optional)

    BOOLEAN:
    true: ok
    false: error

    printModel ("SmallFrameLandscape");

    restoreModelVariables

    see saveModelVariables and saveProfileVariables

    1: INTEGER: index, which of the stored sets shall be used

    2: BOOLEAN:
    true: keep the stored data for future restores

    false: remove stored data after restore

    BOOLEAN:
    true: ok
    false: error

     

    restoreProfileVariables

    1: INTEGER: index, which of the stored sets shall be used

    2: BOOLEAN:
    true: restore to active profile

    false: restore to original profile (default setting)

    3: BOOLEAN:  
    true: keep the stored data for future restores

    false: remove stored data after restore (default setting)

    BOOLEAN:
    true: ok
    false: error

     

    saveModel

    Saves the current state of the model on the hard disk.
    For this function another optional parameter “copy” has been implemented. If this parameter is “true“, the function will behave like the menu command “Save Copy As”, i.e. a copy is saved under a different name without changing to this file.

    1: STRING: file name including path (optional; if empty, the model is stored to the same file as before)

    2:BOOLEAN: true:
    (Optional parameter) becomes a copy of the model,
    if the parameter is not specified, the default value is false

    BOOLEAN:
    true: ok
    false: error

    saveModel;

    saveModelVariables

    With the functions saveModelVariables and saveProfileVariables one can store the current values of all the model and the profile variables internally in a buffer. With the functions restoreModelVariables or restoreProfileVariables one can then restore them at a later point of time.

    It is also possible to store several states in a buffer. For this purpose, the functions saveModelVariables and saveProfileVariables return an index as return value, which then must be specified with the Restore-functions.

    By default, the intermediate state is deleted after a restore. However, one can save the intermediate state (in case later a restoration is needed again) by setting the 2nd argument of the Restore-function “keepEntryForFurtherRestores” to “true”.

    -

    INTEGER: Index for restore

     

    saveProfileVariables

    -

    INTEGER: Index for restore

     

    setCalcState

    sets the calculation status of a component i.e. whether a component is included for the calculation or else is used only as a passive graphics

    1: STRING
    Name of the component

    2:INTEGER
    calculation status:
    0: only passive graphic
    1: active for calculation

    BOOLEAN:

    setCalcState( "Boundary Value", 1 );

    setColor

    This function makes it possible to set the colours of an object (component, line, text field). The third optional parameter "colorIndex" controls which of the four colours "colour 1" - "colour 4" is changed:

    colorIndex = 0: colour 1
    colorIndex = 1: colour 2
    colorIndex = 2: colour 3
    colorIndex = 3: colour 4

    If the "colorIndex" parameter is omitted, colour 1 is changed.

    The colour must be specified as an RGB value in the format $ 00bbggrr, whereby bb, gg, rr can each run from 0 to $ ff and indicate the blue, green or red component.

    Examples:

    $ 00ff0000 = 16711680 pure blue $ 0000ff00 = 65280 pure green
    $ 000000ff = 255 pure red
    $ 00ffffff = 16777215 white

    Alternatively, one of the colours of the standard palette can be specified. To do this, enter a value of $ 01000000 + pallet index. (These correspond to the values of the standard colours in the properties bar under Layout.)            

    1: STRING
    Name of the object

    2: INTEGER
    colour identification (see left)

    3: INTEGER:
    colour index

    -

    setColor ("Boundary Value", $ 000000ff);
    // changes the background colour of the component to red


    setColor ("heliostat field", $ 00ffffc0, 1); // changes colour of the heliostat to light turquoise


    setColor ("heliostat field", 01000000);
    // changes the background colour of the heliostats to pallet index 0 (black)

    setColor ("heliostat field", $ 01000001, 1);

    // changes colour of heliostats to pallet index 1 (white)

    setColor( "Boundary Value", 255 );

     

     

    setEbscriptOutputfilename

    Sets the path of the EbsScript output file to a specific path and determines, whether a timestamp is attached to the output file.

    1: STRING:
    Desired path

    2:BOOLEAN
    true: Attach timestamp
    false: No timestamp

     

    setEbscriptOutputfilename("C:\\Temp\\Test", false);

    setModelEbsScriptOutputfilename

    Redirects the EbsScript output for the current model to the specified file. The general setting for the other models is not changed.

    1: STRING: name (including path) of the requested EbsScript output file

    -

    setModelEbsScriptOutputfilename ("D:\\Temp\\EbsScript.txt");

    setModelTime

    This function sets the model time. This is normally set when data is received from EposInterface or EposArchive, but can also be modified explicitly, if needed.

    1: STRING:
    desired model time as text in the format
    Day.Month.Year
    Hour:Minute:Second

    -

    setModelTime( "01.12.2004 16:30:00" );

    setModelTime ForArchiveId

    This function sets the model time for a specific archive ID.

    1: INTEGER:
    ID of the archive

    2: STRING:
    desired model time as text in the format
    Day.Month.Year
    Hour:Minute:Second

    -

    setModelTimeForArchiveId(300, "01.12.2004 16:30:00" );

    setStandardColor

    This function resets the colour of the objects to the original state.

    1: STRING:
    Name of the object

    2: INTEGER:

    -

    setStandardColor ( "Boundary Value" );

    setText

    sets the text entered in a text object

    1: STRING:
    Name of the text object

    2: STRING:
    text to be entered

    -

    setText( "Text object",  "This is a test text" );

    setVisibleState

    sets the visibility status of an object i.e. hides the object or shows it.

    1: STRING:
    Name of the object

    2:INTEGER:
    Visibility status:
    0: Object is invisible
    1: Object is visible

    -

    setVisibleState( "Boundary Value", 1);

    switchShiftView

    With the function switchShiftView the control room view can be changed over t a specific view.

    1: INTEGER: index of the requested view

    BOOLEAN:

     

    updateModel

    Updates the display on the monitor screen.

    1: BOOLEAN:

    2: BOOLEAN:

    -

     

    Contrary to the "printModel", the functions "print" and "printToString" do not generate an output on the printer, but instead are used only internally. You will find these functions in the chapters Simple In/Output Functions and String-Functions respectively.

    The following IDs are defined for the pipe types:

    0

    All pipes

    1

    Air

    2

    Flue gas

    3

    Steam

    4

    Water

    5

    Scheduled value

    6

    Actual value

    7

    Crude gas

    8

    Oil

    9

    Electro

    10

    Mechanical shaft

    11

    Coal

    12

    Gas

    13

    Logic

    14

    User-defined

    15

    2-phase fluid gaseous

    16

    2-phase fluid liquid

    17

    Salt water

    18

    Universal fluid

    19

    Binary mixture

    20

    Thermo liquid (Oil/melt)

    21

    Humid air

    22

    NASA