beautypg.com

Developing analysis tools with visual basic – Rockwell Automation FactoryTalk Historian Classic User Guide User Manual

Page 136

background image

Chapter 7 Creating RSBizWare Custom Analysis Tools

The

RSBizWare::IRSBizWareCalculator

interface requires you to

implement a function called

Calculate()

. COM uses the Interface

Definition Language (IDL) to describe the syntax of functions in a
language independent manner. The IDL for the

Calculate()

function follows:

[id(1), helpstring("method Calculate")]

HRESULT Calculate([in] VARIANT xInArray,

[in] VARIANT yMinInArray,

[in] VARIANT yMaxInArray,

[in] VARIANT CountInArray,

[in, out] VARIANT* xOutArray,

[in, out] VARIANT* yOutArray);

The parameters used in the

Calculate()

function are those

described in "Interpreting the Parameters Passed into the
Calculate() Function". You will notice that the data types of all

parameters are VARIANTs. A VARIANT data type can hold many
types of values, including strings, integers, and arrays. In this case,
each of the parameters are

arrays of numbers, but the VARIANT data type was still used
because it allows the exchange of data between Visual Basic and
C++, and it allows for dynamic data types when the output of an
analysis tool is a single value.

Note that the last two parameters are marked as [in, out]. They
actually are output only parameters but Visual Basic needs the [in,
out] designator in order to work properly.

Visual Basic is the easiest tool to use when developing a custom
analysis tool. Visual Basic does a good job of handling the
VARIANT data type used by the custom analysis tool interface.

Developing Analysis Tools
with Visual Basic

136

Rockwell Automation Publication HIST-UM001K-EN-E-June 2014