Meta Data Source

The Meta data source gives you tools to extrapolate new information from existing data points.

June 1st, 2020


This data source enables data analysis to behave like yet another sensor. To utilize this data source, some knowledge of JavaScript is required. While there are some differences from JavaScript as it exists in web pages, like the absence of document and window objects, a full and complete implementation of ECMAScriptis available within this data source. Specifically, the Rhino implementation is used.

Meta Data Points

Meta points are configured by creating a “context” of existing points, which become available for access within the script when it executes. These context points can be any point saved in Mango at the time, including the current point being edited. The current point must be saved—i.e. cannot be “new”—before it will appear in the context point list.

Point Configuration

The Data type determines the type that will be expected to be returned from the script. The point attempts to convert the returned value to this type.

Settable is whether the point can be manually set or not.

The Script context defines the points that will be available to the script when it executes. Each point that is added must be given a Var, which is the variable name the point data will be assigned to in the script. These script var names must be valid ECMAScript variable names. They must start with either a letter or an underscore, and may not contain spaces. Other constraints may apply. You will receive validation or script execution exceptions if script var names are not correctly defined. To add a point to the context select it from the list and click the icon. To delete an existing point from the context click the icon associated with the point. Points that are not needed in the script should not be added to the context since some overhead is involved in preparing the data for the script. Also, unnecessary script vars may cause unintended script executions (see “Script execution” below. However, the contrary may also be true: it may be useful to include a script var in a context in order to cause script execution.

Scripts

See the Relevent Script Engine Help file link below. In addition to the general guide for Mango Javascript the Meta Data Points have the feature of allowing the user to set a custom timestamp for the value by setting a variable named TIMESTAMP to some timestamp. The timestamp is in ms since java epoch.

Generate History

When creating a new Meta Point sometimes it is helpful to backfill values for it. This can be done by the generate history link in the Data Points table.

The most recent saved value for all Context Points is found and that date is used for the Starting date for the simulation. (If any context point has no saved values the Generation will fail here)

The oldest saved value for the Meta Point is found and that is used as the Ending date for the simulation. (If no values exist the current time is used)

The simulation is run from Starting to Ending times and a values are created and saved according to the Meta Point settings.

This means that a history can only be generated for times before the earliest Meta Point value.

About Mango JavaScript

See here for detailed information on how to use Mango JavaScript

Copyright © 2024 Radix IoT, LLC.