SCALE_W
Return to Introduction  Previous page  Next page

 

scale_w

 

This component allow you to scale a 16 bits unsigned value into another 16 bits unsigned value. The object allow you to define a fixed-point factor that could be 1,2 or three decimals deep. Using fixed point arithmetic allow you to increase overall performances and decrease computation time. Essentially this component scales the input value into the defined output range honouring the given number of fixed decimal digits

 

 

The following transformation is applied

 

Input Values

 

MultFactor = 10,100,1000

FinalDiv = 1,10,100,1000

 

inL = Input Low Limit

inH = Input High Limit

 

outL = Output Low Limit

outH = Output High Limit

 

Intermediate computed values

 

SpanIn = ( inH - inL )

SpanOut=( outH - outL )

 

Span = ( ( SpanOut * MultFactor ) / SpanIn )

 

Computed output value

 

Out = ( Span * ( Input - inLow  ) + inL ) / FinalDiv

 

 

Property settings

 

Parameter

Meaning

Description




REFERENCE

The REFERENCE field

Don't care

 

 

 

FACTOR

Fixed point factor

This parameter allow you to define the fixed point factor that can be one,two or three decimals. This parameter determine the "precision" used by the component to obtain the resulting output. This technique is also known as "Fixed Point Math".

 

 

 

FINALDIV

Final division

This is the divide factor applied as last operation before returning the output value.

 

 

 

INPUT_MIN

Input value (minimum)

This is the low-side input value

 

 

 

INPUT_MAX

Input value (maximum)

This is the high-side input value

 

 

 

OUTPUT_MIN

Output value (minimum)

The low side output value

 

 

 

OUTPUT_MAX

Output value (maximum)

The high side output value

 

 

 

       

Net plugs

 

Plug

Description



IN

The unsigned 16 bits input value

 

 

OUT

The unsigned 16 bits output value

 

 

Some Examples

 

Input Values

Result



 

MultFactor = 1000

FinalDiv = 1

 

inL = 0

inH = 10

 

outL = 0.000

outH = 100.000

 

Input value = 5

 

 

 

 

 

 

50

 

MultFactor = 1000

FinalDiv = 1

 

inL = 0.000

inH = 10.000

 

outL = 0.000

outH = 5.000

 

Input value = 5

 

 

 

 

 

 

 

2

(2.5 rounded to 2)

 

MultFactor = 1000

FinalDiv = 1

 

inL = 0.000

inH = 12.345

 

outL = 0.000

outH = 67.898

 

Input value = 5

 

 

 

 

 

27

(27.5 rounded to 27)