beautypg.com

BUCHI NIRWare User Manual

Page 158

background image

152

NIRWare Suite

NIRWare 1.5 Software Manual

//Othwerwise if a value larger than 100 is predicted then set the

calculatedValue to 100

else

if

(

ApProperty

[

"Moisture"

].

Value

>

100

)

{

CalculatedValue

=

100

;

}

//Othwerwise use the predicted value

else

{

CalculatedValue

=

ApProperty

[

"Moisture"

].

Value

;

}

}

Example 3: Two properties and local variables

The results from two or more properties can be combined. Here a result present if the residuals of both
Fat and Moisture are OK.



CalculatedValue

=

-

999

;

if

(

ApProperty

[

"Moisture"

].

ResidualOK

&&

ApProperty

[

"Fat"

].

ResidualOK

)

{

CalculatedValue

=

100

-

ApProperty

[

"Moisture"

].

Value

;

}

Adding to the complexity local variables can be defined which can be used to store intermediate results.
The following example reports the fat content at a different moisture level than what is measured. E.g. if
there is 20% fat at 50% moisture then the fat of the dry matter (0% moisture) or any other %moisture can
be calculated.

The variable m is used to define the reported moisture level, here 0%.



Double m

=

0

;

//The reported moisture level

Double dm

=

0

;

// Fat content at 0% moisture


// Calculate the %Fat at 0% moisture

dm

=

(

100

*

ApProperty

[

"Fat"

].

Value

)

/

(

100

-

ApProperty

[

"Moisture"

].

Value

);


// Calculate the %Fat at m% moisture

CalculatedValue

=

(

100

-

m

)/

100

*

dm

;

Using other application properties

In the previous examples the application properties were used: Value, Residual, ResidualOK and
AllowedResidual. A complete list of available properties is found by pressing Variables (see below)