EBSILON®Professional Online Documentation
EbsScript / EbsScript Functions / Specification Value Functions
In This Topic
    Specification Value Functions
    In This Topic

    Specification Value Functions


    EbsScript offers a direct access to all quantities in the cycle. This can be:

    For the EbsScript compiler, this access is realized by a special data type called EBSVAR. The expressions mentioned above are EBSVAR constants. In your script code, you do not need quotation marks (" ") to access an EBSVAR constant. Note the difference between

     print (Steam_generator.P2N);   // EBSVAR constant, output: 120
    
     print ("Steam_generator.P2N"); // STRING constant, output: Steam_generator.P2N
    

    In the Ebsilon Performance Optimization System (EPOS), this type EBSVAR can be used as a basic data type in several operations, especially to perform what-if simulations and optimizations. Before an EBSVAR variable can be used, it must be assigned ("attached") to a quantity in the cycle.

    Example: In our demo cycle "block750.ebs" (available on the Ebsilon CD), we want to change the isentropic efficiency of the MP turbines, called MDT_1,&, MDT_6, to 0.87. Using an EBSVAR variable, this can be done with such a script:

    var
    i:integer;
    s:string;
    ev:ebsvar;
    begin
    for i:=1 to 6 do begin
    s:=printToString ("MDT_",i,".ETAIN");
    getEbsvar(ev, s);
    ev:=0.87;
    end;
    end;

    In the function calls, you can use variables instead of constants. In this case, the value of the variable remains unchanged. But it is not possible to use a constant instead of a variable, because there will be an error if the function tries to modify the constant.

    Exactly as one can enter an expression in the properties window for a specification value, which is then evaluated before the calculation, one can assign an expression as string to an EBSVAR variable in EbsScript too. However, one must be aware of what is evaluated when:

    The instruction

    NDT_2B.ETAIN:=NDT_2A.ETAIN;

    enters a numeric value for NDT_2B.ETAIN, namely the same value, which stood for NDT_2A.ETAIN during the execution of the EbsScript line. If one changes NDT_2A.ETAIN later, it does not affect NDT_2B.ETAIN.

    The instruction

    NDT_2B.ETAIN:="NDT_2A.ETAIN";

    enters a text for NDT_2B.ETAIN, namely "NDT_2A.ETAIN". Whatever stood for NDT_2A.ETAIN stand during the execution of the EbsScript line, is not important here at all, because the expression is evaluated before the Ebsilon calculation kernel is called. If one changes NDT_2A.ETAIN, NDT_2B is also calculated with the changed value.

    Specification Value Functions:

    Name

    Purpose

    Arguments

    Return value

    Example

    Attach

     

    Attaches an EBSVAR variable to a quantity in the cycle, specified by an EBSVAR constant

    1: EBSVAR Variable
    2: EBSVAR constant

    None

    attach (ev, Steam_generator.P2N );

    buToUnit

    Converts a value from British units to the specified unit

    1: REAL: value

    2: STRING: Unit of Output value

    REAL: Input-value converted to value of Output-unit

    var

      rBu,rUnit:real;

      strBu,strUnit:string;

    begin

      strBu:="psia";

      strUnit:="mbar";

      rBu:=100.0;

      rUnit:=buToUnit(100.00,
               strUnit);

      println (rBu," ",strBu,
         " = ",rUnit," ",strUnit);

    end.

    CalcNCV

    Calculates the net calorific value according to the composition of the specified object

    1: STRING constant: Object name (pipe or component 1/33)

    2: REAL Variable: calculated calorific value

    BOOLEAN:
    true, if OK
    false, if NCV cannot be calculated (e.g. for a water pipe)

    b:=calcNCV ("Coal",  r );

    Clear

    Delete the value for the specified quantity. In the design profile, the value is empty after "clear". In a sub-profile, the value inherited by the parent profile is restored

    1: EBSVAR constant

    None

    clear (Boundary_value.M);

    ClearInSubprofiles

    Release 11:Delete the value for the specified quantity in all (real) sub-profiles.

    1: EBSVAR constant

    None

    clearInSubprofiles (Boundary_value.M);

    Detach

     

    The connection between the EBSVAR variable and the object in the cycle is detached.

    1: EBSVAR: The EBSVAR variable to be detached

    An EBSVAR variable assigned to the object, which was assigned earlier to other EBSVAR variables.

    attach (ev, Steam_generator.P2N ); ev1:=detach (ev);

    thereafter, ev1 is assigned to the Steam_generator.P2N

    fromObjectSessionId

    (see note below)

    Release 11: inverse function to getObjectID 1: INTEGER: ID EBSOBJECT: Object reference identified by ID see component example "Component_93.ebs" in the component "Kernel_Scripting_9")   

    GetAdaption Polynomial

    Retrieves the adaptation polynomial for an object

    1: STRING: Name of the component

    STRING: the found polynomial

    strPolynomial:= getAdaptionPolynomial ("Turbine_1");

    GetAlias

    Release 11:Returns the alias of the specification value 1: EBSVAR: The EBSVAR variable STRING: the alias to the EBSVAR variable strAlias:=getAlias(evar);

    GetEbsVarDescription

    Returns the description of the specification value 1: EBSVAR: The EBSVAR variable STRING: the description text of the EBSVAR variable strDesc:=getEbsVarDescription(evar);

    GetEbsVarIdentifier

    Returns the name of the specification value 1: EBSVAR: The EBSVAR variable STRING: the name of the EBSVAR variable strName:=getEbsVarIdentifier(evar);

    GetEbsVarValueAsText

    Returns the text description to the flag value assigned to the specification value 1: EBSVAR: The EBSVAR variable STRING: the text description to the flag value assigned to the EBSVAR variable strFlagText:=getEbsVarValueAsText(evar);

    GetObjectSessionID

    (see note below)

    Release 11: unambiguous integer-Id for component/line 1: EBSOBJECT:Objectname  INTEGER: Id;this is an internal value that is intended to be used in fromObjectSessionId only see component example "Component_93.ebs" in the component "Kernel_Scripting_9")              

    GetCompAtPipe

    Returns the components attached to a pipe end.

    1: EBSPIPE: Pipe

    2: INTEGER: connection
     1= Inlet
     2= Outlet

    EBSCOMP: the found component

    getCompAtPipe( ePipe, 1 )

    GetCompViaLink

    Returns the components attached at the other end of the line, connected to the specified connection of the component.

    1: EBSCOMP: components

    2: INTEGER: number of the connection

    EBSCOMP: the found component

    getCompViaLink ( eSteamGenerator, i )

    GetDescription

    Returns a descriptive text for an object.

    1: STRING: Name of the object

    2: INTEGER: Type of the descriptive text:
     1: Description
     2: Identification for control
         system
     3: Application area
     4: Identification

    STRING: found descriptive text

    var
    str:string;

    begin
    str:=getDescription( "3RA21T007", 1 );
    print (str);
    end.

    getEbsObjValue

    This function can be used to determine the value of an object directly from its name. Optionally, a string can be specified that shall be returned when the object does not exist. If the object exists but is empty, the function returns an empty string.

    This function is mainly useful in text fields and filters.

    1: STRING: Object-Descriptor

    2: STRING: String, returned in case of Error

    STRING: Name or value depending on object descriptor

    For example "Block750.ebs":

    println( getEbsObjValue ( "Steam_generator.T4", "Error"));
    returns:
    "600" (Hot RH temp.)

    println( getEbsObjValue ( "Steam_generator._3", "Error"));
    returns:
    "H2O_DAMPF_3" (Name of line connected to connection point 3)

    println( getEbsObjValue ( "Steam_generator._0", "Error"));
    returns:
    "Error" (case of error)

    GetEbsvar

     

    Assigns the object identified by the string (2. parameter) to an ebsclass variable (1. parameter) - consider the context!

    1: EBSCLASS: Variable
    2: STRING: Constant

    BOOLEAN:
    true, if OK
    false, if error

    getEbsvar (ev,"Boundary_value.M");

    getEbsvar (ec,"Boundary_value");

    GetEbsvarDescription

     

    Release 11: gives description text for the specification/result value
    (used in the properties dialog)

    1: EBSCLASS: variable 

    STRING:

    Wanted description text

     

     

    // component 6 named turbine in model println (getEbsVarDescription (Turbine.FP1N)); 

    Output : Inlet pressure handling

    GetEbsvarIdentifier

     

    Release 11: : name of the object (name of the specification/result value, e.g. ”FMODE“)
    (used in the properties dialog)

    1: EBSCLASS: variable (Name  of Object) 

    STRING:

    Wanted description text

    // component 6 named turbine in model println (getEbsVarIdentifier (Turbine.FP1N));

    Output: FP1N

    GetEbsvarValueAsText

     

    Release 11: texts for flags
    (as used in the properties dialog in combo boxes )

     

    1: EBSCLASS: variable  

    STRING:

    Wanted description text flag

     

    // Component 6 named turbine in model // Turbine.FP1N has value 0 ("P1 calculated by P1NSET (from Stodola law)")
    println (getEbsVarValueAsText (Turbine.FP1N));

    Output : P1 calculated from P1NSET (by Stodola law)

    GetExpression

    If there is an expression for a specification value, this function retrieves this expression as a string

    1: EBSVAR: specification value under consideration

    2: STRING: requested expression

    BOOLEAN:

    var

      str:string;

    begin

      if (getExpression (Start_value.M,
                                str)) then

      begin

        println (str);

      end;

    end.

    GetLinetypeAtLink

    Returns the link type (pipe type) of a specific link of a component

    Components of type 33, 45, 46, 105 and 147: if the component docks on a line and the value 1 is specified for "linkNo", the type of line is returned

    1: EBSCOMP: component under consideration

    2: INTEGER: Number of requested pin (link)

    LINETYPEENUM

    var

      lt:linetypeenum;

    begin

      lt:=getLinetypeAtLink
          (Turbine, 1);

      println (lt);

    end.

    GetLogicObj

    Returns an object placed on a pipe (measurement point, start value, value cross). The object returned is determined by the index.

    1: EPSPIPE: pipe under consideration

    2: INTEGER:  Index

    EBSOBJECT

    eObject:=getLogicObj (ePipe, i );

    GetLogicObjCount

    Returns the number of objects placed on a pipe (measurement points, start values, value crosses).

    1: EBSPIPE: pipe under consideration

    INTEGER

    n:=getLogicObjCount (ePipe);

    GetNameAbsolute

     

    provides the complete name of the objects including path and leading ”::“. For example: “::Macro_object::Turbine_1.ETAI“

    1: 1: EBSCLASS: Variable (Name of Object)

     

     

    GetName

     

    Returns the name of the object assigned to the specified EBSVAR variable.

    1: EBSVAR: Constant

    2: STRING: Variable
     Object-Descriptor

    BOOLEAN:
    true, if OK.
    false, if error

    getName (ev, s);
    getName (Boundary_value.M, s);

    GetPipeAtLink

    Returns the pipe connected to the specified connection of a component.

    1: EBSCOMP:

    2: INTEGER: Number of the connection   

    EBSPIPE

    ePipe:= getPipeAtLink(eComp, i );

    GetPipeAtLogpipe

    Returns the pipe connected to the end of a logic pipe.

    1: EBSPIPE:

    2: INTEGER: Connection
     1: Inlet
     2: Outlet

    EBSPIPE

    ePipe:= getPipeAtLogpipe (eLogPipe,1);

    GetRuntimeClass

    Returns the data type of an object as text

    1: EBSCLASS:

    STRING

    print (eObject," is an ", getruntimeclass (eObject)');

    GetSpecs

    For a component, this function returns either the specification values or the result values.

    For a pipe, this function returns either the main pipe data or the composition data.

    1: ebsData: Ebsilon object (component or pipe) to be considered

    2: array of EBSVAR: array with the requested value

    3: INTEGER: length of the array

    4: BOOLEAN:
    true=specification values (for a component) or main pipe data (for a pipe)
    false=result values (for a component) or composition data (for a pipe)

    INTEGER: number of delivered values

    var

      i,n:integer;

      are:array[1..30] of ebsvar;

      strName:string;

    begin

      n:=getSpecs(Turbine, are, 30, false );

      for i:=1 to n do

      begin

        if (getName (are[i], strName)) then

        begin

          println (strName," ",are[i]);

        end;

      end;

    end.

    GetSpecsResults

    Like getSpecs, but using dynamical arrays.

    1: ebsData: Ebsilon object (component or pipe) to be considered

    2: BOOLEAN:
    true=specification values (for a component) or main pipe data (for a pipe)
    false=result values (for a component) or composition data (for a pipe)

    array of EBSVAR

    var

      i,n:integer;

      are:array of ebsvar;

      strName:string;

    begin

      are:=getSpecsResults(Turbine, false);

      n:=length(are);

      for i:=0 to n-1 do

      begin

        if (getName (are[i], strName)) then

        begin

          println (strName," ",are[i]);

        end;

      end;

    end.

    HasExpression

    Checks whether a specification value is an expression

    1: EBSVAR: Specification value to be considered

    BOOLEAN:
    true, if the specification value is an expression

    var

      str:string;

    begin

      if (hasExpression(Start_value.M)) then

      begin

        if (getExpression(Start_value.M, str))  
                                                    then

        begin

          println (str);

        end;

      end;

    end.

    ImperialToUnit

    Converts the specified value from imperial unit to the specified unit

    1: REAL: the value to be recomputed

    2: STRING: the unit to be converted to

    REAL: converted value r := imperialToUnit(2.0 , "bar");

    IsAttached

     

    Checks, whether an EBSCLASS variable is attached to an object in the cycle.

    1: EBSCLASS: Constant

    BOOLEAN:
    true, if EBSCLASS is attached.

    b = isAttached (ev);

    b:= isAttached (Boundary_value.M); is always "true"

    isClear

    Returns true if the specified object does not overwrite the data in the current profile 1: EBSPROFILED: Constant object of type derived from EBSPROFILED type (e.g. EBSVAR)

    BOOLEAN: true, if the object does not overwrite the data in the actual profile

    var evar:ebsvar;
          b:boolean;
    begin 
          getebsvar(evar,"Turbine.ETAIN");
          b:=isClear( evar );
    end;

    isEmpty

    Checks, whether a value is empty.

    1: EBSVAR: Constant

    BOOLEAN:
    true, if EBSVAR is empty.

    b:= isEmpty (Boundary_value.M);

    isKindOf

    Checks whether an object belongs to a specific class

    1: EBSCLASS: the object to be considered

    2: STRING: name of the class where the object should belong to

    BOOLEAN:

    var

      obj:ebsobject;

    begin

      obj:=Turbine;

      if (isKindOf(obj, "ebscomp6")) then

      begin

        println (obj, " is a turbine");

      end;

    end;

    isNull

    Checks, whether a reference is not attached to any object

    1: EBSCLASS: the object to be considered

    BOOLEAN:
    true, if the reference is empty

    b:= isNull (eComp);

    loadLibValues

    Replaces all specification values of the specified component within the current profile by the data from the standard value database.

    1: STRING: Component name

    2: STRING: (optional): Type name of the line of the component table within the database. The default value is "standard".

    3: BOOLEAN:
    true=values are set to "empty" if they are not found in the library
    false=values remain unchanged if they are not found in the library

    BOOLEAN:
    true,

    false

    loadLibValues ("Steam_generator");

    loadLibValues ("Boundary_value","Anthrazit-Ruhr");

    refsEqual

    Checks, whether two references point to the same object.

    1: EBSCLASS: 1. Reference

    2: EBSCLASS: 2. Reference

    true, if both the references point to the same object

    b:= refsequal (eTurbine, eComp);

    setAdaption Polynomial

    Sets the adaptation polynomial of a component

    1: STRING: Name of the component

    2: STRING: Polynomial

    BOOLEAN:
    true,

    false

    The function  now returns an empty string if the specified compname cannot be found (instead of terminating the running EbsScript)

    setAdaptionPolynomial ("Turbine_1", "1+0.0001*M1")

    setDescription

    Sets a descriptive text for an object.

    1: STRING: Name of the object

    2: INTEGER: Type of the descriptive text:
     1: Description
     2: Identification for control
         system
     3: Application area
     4: Identification

    3: STRING: description text to be set

    -

    setDescription( "3RA21T007", 1, "New Description" );

    setEmpty

    Sets the value for the specified object to "empty". In the design profile, this is equivalent to "clear". In sub-profiles, the value in the sub-profile will be "empty" even if there is a value in the parent profile.

    1: EBSVAR Constant

    -

    setEmpty (Boundary_value.M);

    siToUnit

    converts a value from Ebsilon standard units (SI units) to the specified unit

    1: REAL: Input-value

    2: STRING: Unit of output-value

    REAL: EBSILON standard unit converted to value of output unit

    var

    rsi,rUnit:real;

    strsi,strUnit:string;

    begin

    strsi:="bar";

    strUnit:="mbar";

    rsi:=100.0;

    rUnit:=siToUnit(100.00, strUnit);

    println (rsi," ",strsi," = ",rUnit," ",strUnit);

    end.

    transferAllResults

    Transfers all results (component and pipe values) from the specified profile to the actual profile. This may be used to give result values to EposArchive that are calculated in a sub-profile. Now (since Release 10) this function really copies all the results (components and lines, also empty fields).

    1: INTEGER: ID of the profile, from which the values are to be taken

    BOOLEAN:
    true, if OK.
    false, if error

    transferAllResults (4);

    transferValResults

    Transfers the RESULT values of all measurement points from the specified profile and enters these as MEASM values in the actual profile. This is helpful to perform a what-if simulation with validated values.

    1: INTEGER: ID of the profile, from which the values are to be taken

    BOOLEAN:
    true, if OK.
    false, if error

    transferValResults (4);

    unitToBu

    converts a value from specified Units to British units

     

    1: REAL: Input-value

    2: STRING: Unit of input-value

    REAL: Input value converted to "British-Units"

    var

    rBu,rUnit:real;

    strBu,strUnit:string;

    begin

    strBu:="psia";

    strUnit:="mbar";

    rUnit:=100.0;

    rBu:=unitToBu(100.00, strUnit);

    println (rUnit," ",strUnit," = ",rBu," ",strBu);

    end.

    unitToImperial

    converts a value from specified units to imperial standard units

    1: REAL: Input-value

    2: STRING: Unit of input-value

    REAL: Input value converted to imperial standard unit

    r:=unitToImperial(1.0,"bar");

    unitToSi

    converts a value from specified units to Ebsilon standard units (SI units)

    1: REAL: Input-value

    2: STRING: Unit of input-value

    REAL: Input value converted to EBSILON standard unit

    uses @units;

    var

    rsi,rUnit:real;

    strsi,strUnit:string;

    u,uDef:UNIT_Enum;

    d:DIM_Enum;

    begin

    strUnit:="mbar";

    rUnit:=100.0;

    rsi:=unitToSi(100.00, strUnit);

    u:=unitsGetUnitFromText (strUnit);

    d:=unitsGetDimFromUnit (u);

    uDef:=unitsGetDefaultUnit (d);

    strsi:=unitsGetTextFromUnit (uDef);

    println (rUnit," ",strUnit," = ",rsi," ",strsi);

    end.

    unitToUSC

    converts a value from specified units to US cust. standard units

    1: REAL: Input-value

    2: STRING: Unit of input-value

    REAL: Input value converted to imperial standard unit

    r:=unitToUSC(1.0,"bar");

    uscToUnit

    Converts the specified value from US cust. standard unit to the specified unit

    1: REAL: the value to be recomputed

    2: STRING: the unit to be converted to

    REAL: converted value

     

    r:=uscToUnit(1.0,"bar");

     

    Note:

    The following two functions

    are required in the context of the call “propertyCallId“ when providing equations in Component 93 (see component example ”Component_93.ebs“ in Component ”Kernel_Scrpting_9“)