EBSILON®Professional Online Documentation
EbsScript / EbsScript Interface Units / InterfaceUnit-Units (of measurements)
In This Topic
    InterfaceUnit-Units (of measurements)
    In This Topic

    InterfaceUnit - Units

     

    Name

    Purpose

    Arguments

    Return value

    Example

    unitsConvert

    converts a value given in a specific unit into another unit

    1: REAL: value in the original unit

    2: UNIT_Enum: original unit

    3: REAL: calculated value in the requested unit

    4: UNIT_Enum: requested unit

    UnitsErrorEnum: error state

    uses @units;

    var

    r, rSource, rDest:REAL;

    u, uSource, uDest:UNIT_Enum;

    str,strSource, strDest:string;

    d:DIM_Enum;

    v:variant;

    begin

    rSource:=7200;

    uSource:=UNIT_kg_h;

    uDest:=UNIT_t_h;

    if (unitsConvert(rSource, uSource, rDest, uDest) = UnitsErrorOK) then

    begin

    strSource:=unitsGetTextFromUnit(uSource);

    strDest:=unitsGetTextFromUnit(uDest);

    println (rSource," ",strSource," are ",rDest," ",strDest);

    end;

     

    d:=unitsGetDim(Sun.DNI);

    u:=unitsGetDefaultUnit(d);

    str:=unitsGetTextFromUnit(u);

    println (str);

     

    d:=unitsGetDimFromUnit(UNIT_kg_h);

    u:=unitsGetDefaultUnit(d);

    str:=unitsGetTextFromUnit(u);

    println (str);

     

    u:=unitsGetUnitFromText("mbar");

    str:=unitsGetTextFromUnit(u);

    println (str);

     

    if (unitsGetValueWithUnit(SUN.DNI, v, UNIT_W_m2, false)=UnitsErrorOK) then

    begin

    str:=unitsGetTextFromUnit(u);

    println (v.rval);

    end;

    u:=unitsGetVisibleUnit(SUN.DNI, false);

    str:=unitsGetTextFromUnit(u);

    println (str);

     

    if (unitsSetValueWithUnit(50.0, UNIT_mbar, Start_value_2.P)=UnitsErrorOK) then

    begin

    println (Start_value_2.P);

    end;

    if (unitsSetVisibleUnit(Start_value_2.P, UNIT_mbar)=UnitsErrorOK) then

    begin

    u:=unitsGetVisibleUnit(Start_value_2.P, false);

    str:=unitsGetTextFromUnit(u);

    println (str);

    u:=unitsGetVisibleUnit(Start_value_2.P, true);

    str:=unitsGetTextFromUnit(u);

    println (str);

    end;

     

    end.

    unitsFromSI

    converts the value from Ebsilon standard SI unit to the requested unit

    1: REAL: value in the SI unit

    2: UNIT_Enum: destination unit

    3: REAL: return on error value (default value is -1000)

    REAL: calculated value in the requested unit

    unitsGetDefaultUnit

    retrieves the default unit to a dimension (quantity)

    1: DIM_Enum: specified dimension

    2: UnitSystemEnum: unit system to be used. This parameter is optional. If omitted, the Ebsilon default setting (UnitsSystemSI) will be used

    UNIT_Enum: requested unit

    unitsGetDim

    yields the dimension of an Ebsilon variable

    1: ebsVar: Ebsilon variable to be considered

    DIM_Enum: requested dimension

    unitsGetDimFromUnit

    retrieves the dimension to a specified unit

    1: UNIT_Enum: specified unit

    DIM_Enum: requested dimension

    unitsGetTextFromUnit

    retrieves the text (as string) for a specified unit

    1: UNIT_Enum: specified unit

    STRING: text

    unitsGetUnitFromText

    retrieves the unit for a specified text

    1: STRING: specified text

    UNIT_Enum: retrieved unit

    unitsGetValueWithUnit

    retrieves the value and the unit for a specified Ebsilon value

    1: ebsVar: Ebsilon variable under consideration

    2: variant: requested value

    3: UNIT_Enum: requested unit

    4: BOOLEAN: if the Ebsilon value is a flag, this parameter determines whether

    true: the flag is retrieved as text

    false: the flag is retrieved as number

    UnitsErrorEnum: error status

    unitsGetVisibleUnit

    retrieves the unit for a specified Ebsilon value

    1: ebsVar

    2: BOOLEAN:
    false: yields the unit that is stored in the component (independent of the display settings)

    true: yields the displayed unit

    UNIT_Enum:
    retrieved unit

    unitsSetValueWithUnit

    sets an Ebsilon variable to a specific value including unit

    1: REAL: value to be used

    2: UNIT_Enum: unit to be used

    3: ebsVar: Ebsilon variable that shall be modified

    UnitsErrorEnum: error status

    unitsSetVisibleUnit

    changes the unit that is stored at the component

    1: ebsVar: Ebsilon variable that shall be modified

    2: UNIT_Enum: unit to be used

    UnitsErrorEnum: error status

    unitsToSI

    converts the value from the specified unit to Ebsilon standard SI unit

    1: REAL: value in the specified unit

    2: UNIT_Enum: specified unit

    3: REAL: return on error value (default value is -1000)

    REAL: calculated value in the SI standard unit