beautypg.com

BUCHI NIRWare User Manual

Page 157

background image

NIRWare 1.5 Software Manual

NIRWare Suite

151

if

(

ApProperty

[

"Moisture"

].

ResidualOK

)

{

CalculatedValue

=

100

-

ApProperty

[

"Moisture"

].

Value

;

}

In the report this measurement then appears as -999 and can easily be interpreted as an invalid
measurement.

In case frequent error due to too high residuals occurs, the limits can be extended. Here the residual limit
is compared to the residual and the limit is multiplied with 1.20 to add 20% higher tolerance limit.


CalculatedValue

=

-

999

;


if

(

ApProperty

[

"Moisture"

].

Residual

<

ApProperty

[

"Moisture"

].

AllowedResidual*1.2

)

{

CalculatedValue

=

100

-

ApProperty

[

"Moisture"

].

Value

;

}

Example 2: Nested conditions

In this example nested conditions i.e. conditions within conditions are used. First check if the residual is
OK, if it is fullfiled, test if the predicted value is less than 0. If it is lower as 0, set the output to 0 (no
negative content), otherwise the output is set to the predicted value.

In this example comments are

also use. Comments are text after “//” and is shown in green. Comments

are not evaluated.


CalculatedValue

=

-

999

;

//Initialise to avoid problems in the Operator reports


//if the residual is less than the allowed residual (we could also have used the field
ResidualOK

if

(

ApProperty

[

"Moisture"

].

Residual

<

ApProperty

[

"Moisture"

].

AllowedResidual

)

{

//If a negative value is predicted then set the CalculatedValue to 0

if

(

ApProperty

[

"Moisture"

].

Value

<

0

)

{

CalculatedValue

=

0

;

}

//Othwerwise use the predicted value

else

{

CalculatedValue

=

ApProperty

[

"Moisture"

].

Value

;

}

}

The above example can be expand to test also if the value is above 100 and report 100 in case the
predicted value is above 100%.


CalculatedValue

=

-

999

;

//Initialise to avoid problems in the Operator reports

//if the residual is less than the allowed residual (we could also have used the field
ResidualOK

if

(

ApProperty

[

"Moisture"

].

Residual

<

ApProperty

[

"Moisture"

].

AllowedResidual

)

{

//If a negative value is predicted then set the CalculatedValue to 0

if

(

ApProperty

[

"Moisture"

].

Value

<

0

)

{

CalculatedValue

=

0

;

}