DegradationRule

ou can use the DegradationRule function to retrieve the degradation constant for a specified analysis parameter based on a degradation rule.

When to use

You can use this function in the Analysis forms and is used in Formula equations.

When not to use

You cannot use this function outside Analysis forms, as the function requires an equation context.

Syntax

double DegradationRule(string Param, string DegradationRuleCode);

Parameters

Parameter Type Required Description
Param string Optional Name of the analysis parameter whose degradation constant is to be returned.
Note: Use empty string ("") to reference the current parameter in equation context.
DegradationRuleCode string Optional The code of the Degradation Rule whose constant is to be returned.
Note: If omitted or empty, the function uses the degradation rule of the current analysis object.

Return Value

The application returns the degradation constant for a given degradation rule and parameter as double.

Prerequisites

The function must be used in an Analysis or Formula equation context.

Examples

Example 1
Get the degradation constant for the current parameter.
double degConstant = DegradationRule("", "DR1_SS");
Description
The degradation constant for the current parameter using degradation rule "DR1_SS" (possibly representing first-order degradation under standard storage) is returned.
Example 2
Compute Vitamin C degraded concentration from averaged value using degradation constant and shelf-life.
// Retrieve averaged value and compute degraded concentration for VITC
object aoObj = RowTag(1, _OBJECTKEY, "AVERAGED");
double ao = aoObj != null ? Convert.ToDouble(aoObj) : 0.0;

// Degradation constant (k) multiplied by shelf-life dimension (t) => exponent argument (kt)
double kt = DegradationRule("", "") * _ANALYSISHELFLIFEDIM;

// If parameter is VITC, multiply ao by e^(kt). Otherwise keep ao.
double val = (_ANALYSISPARAM == "VITC") ? ao * Math.Exp(kt) : ao;
return val;
Description
The degradation constant and shelf life values are used to calculate the degraded concentration of a parameter for vitamin C from the average.