beautypg.com

Saving and compiling the project – Rockwell Automation FactoryTalk Historian Classic User Guide User Manual

Page 140

background image

Chapter 7 Creating RSBizWare Custom Analysis Tools

2. 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 the output Y value equal to the negative y input

' value for every X (timestamp) value that was passed in

' In case we are sampling, we will use the average of the

' min and max value that was passed in

Dim i As Integer

For i = 0 To UBound(yMinInArray)

xOutArray(i) = xInArray(i)

yOutArray(i) = -1# * (yMinInArray(i) + yMaxInArray(i)) / 2#

Next i

The -1# and 2# values are Visual Basic's default way of displaying
floating point numbers. The values were typed in as -1.0 and 2.0
respectively.

The full

Calculate()

function along with the entire sample project

is installed with RSBizWare in the \Program Files\Rockwell
Software\RSBizWare\RSBizWare Calculators\VB\NegativeCalc
directory. You should refer to this sample project to see the exact
form of the code in the

Calculate()

function.

Before you can try out the new custom analysis tool, you have to save
the Visual Basic project and compile the DLL as follows:

1. Select File > Save Project to save the project. If you haven't

saved the project yet, you will need to select a directory. Since
you already set the project properties when you created the

project, the name of the project already should be set to
MyDemo.

Saving and Compiling the
Project

140

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