R Control Extension Functions and debug flags
This chapter contains a list of the R Control Extension functions. There are three types of R functions available.
-
Error status handling and logging functions
-
Functions for setting and returning R variables
-
Functions for calling R routines
You can find the functions in the table below. These functions are WinCC OA Control functions and can be used in CTRL.
-
Type Function Description Error Handling RGetLastErr() Retrieves the current error status and optionally resets it. Error Handling RSetLastErr() Sets current error status. Error Handling RClearErr() Clears the error status (value, description and context). Error Handling RSetErrLock() Sets the status of the error lock mechanism to true or false. Functions for setting and returning R variables RSetVar() Stores the content of the passed parameter as an R variable. Functions for setting and returning R variables RGetVar() Returns the value of an R variable. Functions for setting and returning R variables RSetVarSerialized() Serializes the content of the passed parameter into a blob variable. Functions for setting and returning R variables RGetVarSerialized() Retrieves the deserialized value of a variable. Functions for calling R routines REvalExp() Evaluates an R expression. Functions for calling R routines REvalExpVar() Evaluates an R expression and sets the result value for the R variable. Functions for calling R routines RLoadLibrary() Loads an R package. Functions for calling R routines RLoadModel() Loads an R model. Functions for calling R routines RPredict() Calls the function "predict" of a loaded model and returns the prediction result. Functions for calling R routines RGetACF() Calculates the auto correlation of an array of values. Functions for calling R routines RGetCCF() Calculates the cross-correlation of an array of values. Functions for calling R routines RKMeans() Calls the k-means algorithm and returns the cluster vector and cluster center matrix. Functions for calling R routines RCalcLabels() Determines the cluster label vector and the associated center distance vector based on a value matrix and a cluster center matrix. For more information on clusters, see chapter Classification Wizard - Clustering. Functions for calling R routines RRandomForest_Train() Trains a RandomForest model and returns an error rate value, a confusion matrix and an importance matrix. Functions for calling R routines RClusterNumberGap() Calls the function "clusGap" of a loaded model and returns the goodness of the clustering measure. Functions for calling R routines RTransform() Transforms an array of values with timestamps to an array of values with equidistant timestamps and optionally calculates transformation quality indicators. Functions for calling R routines RGetFrequency() Estimates the periodogram frequency of a signal.
Debug Flags
There are 3 debug flags for the R control extension:
-
DBG_RFCT - use when a R CTRL function was called
-
DBG_RQUERY - use for R queries between R Control extension and R
-
DBG_REVENT - use for internal events
These debug flags can be used for the Ctrl and UI managers.
For more information on Debug flags, see chapter General debug flags