Writing the calculate() function – Rockwell Automation FactoryTalk Historian Classic User Guide User Manual
Page 148
Chapter 7 Creating RSBizWare Custom Analysis Tools
VARIANT *varray);
You will use these utility functions when you write the Calculate()
function in the next section.
Writing the
Calculate()
function (contained in the
NegativeCalc.h file) in Visual C++ involves the same basic steps
described in the Visual Basic section:
1. Accessing the passed in data set from the Configuration
Console.
2. Computing the desired algorithm.
3. Returning an output data set to the Configuration Console.
The parameters passed into the
Calculate()
function match the
parameters listed in the IDL code you previously looked at :
STDMETHOD(Calculate)(VARIANT xInArray,
VARIANT yMinInArray,
VARIANT yMaxInArray,
VARIANT CountInArray,
VARIANT * xOutArray,
VARIANT * yOutArray)
...
The syntax that Visual C++ uses to implement the function may
look strange at first, but it is the standard way to declare methods in
COM classes when using the Active Template Library (ATL)–a
library that simplifies much of the boilerplate code necessary when
writing COM classes.
The purpose of the analysis tool is to compute the negative value of
each Y-axis value that was passed into the function. To do this, the
program needs to loop through each value passed in and create a
corresponding output value that is the same numeric value except
with the sign changed (for example, the program must turn the value
5.3 into -5.3).
Writing the Calculate()
Function
148
Rockwell Automation Publication HIST-UM001K-EN-E-June 2014