Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Click TransformFunction variable in the menu.

  2. Enter a function Name for the new function variable, for example: Temperature-Average.

  3. Enter a Title. If there is a title the function name is displayed as: Function Name - Title. 

  4. Enter a Unit, for example: deg. C. 

  5. Select the appropriate Output type: Numeric or Symbolic.

  6. Select Language for the script. Options: JavaScript, Common Lisp , R or Python. 

  7. Enter a function Script and add variable from the list as required (Item selection) and click on the Arrow to put them in the script area. 

    The standard Script is executed for each row, the result is the last evaluated expression.

  8. Click on Template and select from the list of template functions. On the left part of the window, you can see the function. Then click Insert  and the script example will be written on the script area. The templates are only available in Javascript

  9. Click Save.

...

Expand
titleStandard script with initializer
Code Block
// Example: The function initializer defines the function offset2 that returns the square of x. 
It is executed only once and it is intended to put some calculations available for each row, such as global counter. 
The standard script (value of variables power - offset2) is executed for each row. 
The result is the last evaluated expression.

val("power") - offset2() 

with initializer written as

def offset2(x=0):
   return x * 2

R language

Function variables can be written in R in the editor. For more information on R, see R.

Expand
titleTemplate to return the value of a variable
Code Block
val("power")
Info

Note: val (& valEx) method are available in the 3 languages and return the specified variable value of the current row

Expand
titleTemplate to searche which type of product the plant is manufacturing.
Code Block
// check if product A
if (val("Tag1") !== "OK" && val("Tag2") !== "KO"){
"product A"}

External libraries 

In order to compute function variables, several external libraries are included in DATAmaestro Analytics. IF97 is used to compute steam/water properties and CoolProp library is used to computes properties of fluid and humid air.

...