Product: | Elvis |
Version: | 2.4.324 |
Booth: | 2005-07-07 |
Summary
For calculations of the process server, a default value can be specified for a data point property. This default value is used only if there is no valid value for the property of the data point. The IfNull function(data point, property, default value) can be used to specify a default value for the specified property of the data point, which will be used at this point in the calculation if the actual value is undefined. However, the actual value of the property is not changed!
Examples:
CODE:vb:’ without default value:
x = Database.Datapoint(“Light”). ActualValue
‘ with default value:
x = IfNull(Database.Datapoint(“Light”), “ActualValue”, 0)//CODE
or if the data point also starts the calculation:
CODE:vb:’ without default value:
x = @(light). ActualValue
‘ with default value:
IfNull(@(light). ActualValue, 0)//CODE
Attention, please do not insert additional spaces!
The IfNull function is implemented in the process server as of version 2.4.324. For versions from 2.4.296 to 2.4.323, the process server can be downloaded from the download area (only as long as this function is not available in the official setup).
Details
All dynamic data point properties, including ActualValue and NominalValue, can contain an undefined value. Only after a value for an ActualValue (= current value of the data point in the asset) has been received from the attachment is this property set to a defined value. Likewise, the NominalValue (= setpoint) is only set to a valid value when the user has made an input.
This behavior is correct in order to visualize the actual state of the plant and not to show some wishful thinking of the plant that does not actually exist.
However, this behavior can cause problems in calculations. The undefined value of a data point can cause a calculation to fail to complete because a value is not defined. For example, the OR combination of A, B, and C (i.e., A OR B OR C) only gives a result if A, B, and C have a valid value. If only one value is not present, the result remains indeterminate, even if one of the defined values is On (True) and therefore the result should be On (True). About other methods (On Error… or If… then instead of OR ) this problem could be circumvented (not very elegantly) in the past.
Attention: We are still of the opinion that setting the missing value to a valid value is not a solution because it would falsify the process image.
The solution is achieved by a special function that can use a default value for the calculation, but this does not affect the actual data point value. The function is called “IfNull” and has three parameters:
- The name of the data point
- The property
- The default value
There are two ways to specify the data point (first parameter): as a passive data point with Database.Datapoint(“Name of the data point”) or as a data point that starts the calculation with the well-known @ sign. See examples in the summary above.