An Industrial IOT Platform

OPScript - Parameters

Parameters


Open-Plant Analytics allows users to save certain values as 'Parameters'. Parameters are like Variables, except that they are saved in the Open-Plant Database. These Parameters can be used for many things, such as:
- The parameters can be used as an input to another analysis
- The parameters can be used in the same analysis for consecutive runs
- A parameter's current value can be seen in realtime in the Parameters List. This can be used as a monitoring mechanism for an executing script. 

The Parameters list can be found on the 'Parameters' tab in the Open-Plant Console. See the screenshot below. Clicking the Get or Set buttons next to the parameter will add the parameter into the currently selected analysis script.

OPScript

OP.SetParameter

This function sets a Parameter to a specified value. If the parameter doesn't exist, it will create the parameter (and add the parameter to the Parameter List accessible from the console)

The function has two input:

ParameterName: The name of the parameter. It can be a any name. The space character is allowd. Important to note that the names is case sensitive.

ParameterValue: The value of the parameter to be set. The value can only be of simple DataTypes (and not complex objects) e.g. int, double, string, DateTime, TimeSpan, etc.

Examples:
//This Parameter is saved as an Integer
OP.SetParameter("My Age", 39); 

//This Parameter is saved as a double
OP.SetParameter("Current Oil Price", 40.0);

//This Parameter is saved as a string
OP.SetParameter("My Email", "info@Open-Plant.com");

//This Parameter is assigned based on FIC101.Value
OP.SetParameter("Last Known Value", OP.Tag("FIC101.Value").Sample.Value);

//These parameters are saved as a DateTime Object
OP.SetParameter("Last Processed Time", OP.Tag("FIC101.Value").Sample.TSUTC);
OP.SetParameter("Cut Off Date", "2020-11-27 00:00:00".ToDateTime());

OPScript

OP.GetParameter

This function gets the value of a Parameter based on ParameterName

Examples:
int MyAge = OP.GetParameter("My Age"); 
double OilPrice = OP.GetParameter("Current Oil Price");
string MyEmail = OP.GetParameter("My Email");
var LastKnownValue = OP.GetParameter("Last Known Value");
DateTime LastProcessedTime = OP.GetParameter("Last Processed Time");
DateTime CutOffDate = OP.GetParameter("Cut Off Date");

OPScript

OP.ParameterExists

This function returns true if a parameter exists and false otherwise.

Examples:
if (OP.ParameterExists("Cut Off Date")) 
	OP.Log("Cut off Date = " + OP.GetParameter("Cut Off Date"));
else
	OP.Log("Parameter does not exist!");
OPScript

OP.DeleteParameter

This function deletes a parameter based on ParameterName.

Examples:
OP.DeleteParameter("Cut Off Date");

OPScript

OP.ParameterNames

This function returns a list Parameter Names in a List<String> object. The function has the following input:
SearchWildCard: Searches for Parameter Names that matches the wildcard. Use "*" to return all Parameter Names.
NumberOfParametersLimit: The number of Parameter Names to return limit. If not specified, it will return all Parameter Names.

Examples:
//This logs all the Parameter name and values to the console
List ParameterNames = OP.ParameterNames("*");
foreach (string ParameterName in ParameterNames)
{
	OP.Log(ParameterName + " = " + OP.GetParameter(ParameterName));
}

OPScript

OP.LogParameters

This function simply logs Parameter Names to the console. The function has the following input:
- SearchWildCard: Searches for Parameter Names that matches the wildcard. Use "*" to return log all Parameter Names.
- NumberOfParametersLimit: The number of Parameter Names to log limit. If not specified, it will log all Parameter Names.

Examples:
//This logs all parameter names
OP.LogParameters("*");

//This logs the first 100 parameter names
OP.LogParameters("*",100);

Open-Plant is a revolutionary Industrial IOT Platform software, used to create and deploy Industrial IT apps/solutions. It is an all-encompassing solution offering both back-end and front-end components i.e. the full stack. From our user's experience, creating and deploying Industrial IT apps became 10x faster and 10x less cost. We serve the mining, energy, oil & gas, construction and manufacturing industry. 

OPEN-PLANT PTY LTD

Perth, Australia

EMAIL

info@open-plant.com
homedownloadenvelope