Is used to do this – Rockwell Automation FactoryTalk Historian Classic User Guide User Manual
Page 150

Chapter 7 Creating RSBizWare Custom Analysis Tools
double *yMaxIn = new double[yMaxSize];
double *countIn = new double[countInSize];
// Integer to hold data values
int actualNum;
// Convert VARIANT arrays to non-VARIANT arrays
bool xInRet = ExtractVariantDoubleArray(&xInArray, xIn,
xInSize, &actualNum);
bool yMinRet = ExtractVariantDoubleArray(&yMinInArray, yMinIn,
yMinInSize, &actualNum);
bool yMaxRet = ExtractVariantDoubleArray(&yMaxInArray, yMaxIn,
yMaxSize, &actualNum);
bool countInRet = ExtractVariantDoubleArray(&CountInArray,
countIn, countInSize, &actualNum);
3. Create the output arrays. Since an output value is needed for
each input value, the size of the output arrays will be the same
size as the input arrays:
// Create temp double arrays, which can be destroyed after
// they are converted to VARIANT arrays by
// CreateVariantDoubleArray()
double *xOut = new double[xInSize];
double *yOut = new double[xInSize];
4. Change the Y values to negative values. This task would be
simple if you were dealing with single data points; however,
you have to take sampling into consideration because the
passed in data set may be sampled. If it is, the program must
contain an algorithm to determine the value to make negative.
In this program, you negate the average of the minimum and
maximum value passed in for each sample:
// Set first point of horizontal line in output arrays
for (int i = 0; i < xInSize; i++)
{
xOut[i] = xIn[i];
yOut[i] = -1.0 * (yMinIn[i] + yMaxIn[i]) / 2.0;
}
5. Convert the output variables (xOut and yOut) into
VARIANTs so that they can be passed back to the
Configuration Console. Another VARIANT utility function
(
CreateVariantDoubleArray()
) is used to do this:
// Convert the temp double arrays to VARIANT arrays to return
150
Rockwell Automation Publication HIST-UM001K-EN-E-June 2014