beautypg.com

B&B Electronics VFG3000 - Manual User Manual

Page 338

background image

S

CALE

(

DATA

,

R

1,

R

2,

E

1,

E

2)

V

LINX

F

IELDBUS

G

ATEWAY

M

ANAGER

U

SER

M

ANUAL

P

AGE

322

S

CALE

(

DATA

,

R

1

,

R

2

,

E

1

,

E

2

)

A

RGUMENT

T

YPE

D

ESCRIPTION

data

int

The value to be scaled.

r1

int

The minimum raw value stored in data..

r2

int

The maximum raw value stored in data..

e1

int

The engineering value corresponding to r1.

e2

int

The engineering value corresponding to r2.

D

ESCRIPTION

This function linearly scales the

data

argument, assuming it to contain values between

r1

and

r2

, and producing a return value between

e1

and

e2

. The internal math is implemented

using 64-bit integers, thereby avoiding the overflows that might result if you attempted to
scale very large values using Fieldbus Gateway Manager’s own math operators.

F

UNCTION

T

YPE

This function is passive.

R

ETURN

T

YPE

int.

E

XAMPLE

Data := Scale([D100], 0, 4095, 0, 99999)