There is a significant distinction between “NAN” and the “out-of-range” value, specifically regarding this blog discussion. These two special values are reported via our I/O.
NAN is an analog value reported when the brain is unable to communicate to the analog module. NAN likely means the analog module has failed, the module is removed, the rack voltage is too low or is noisy (approximately 4.90 VDC or lower), or the module is not properly seated on the rack.
NAN is treated as a special value in certain software products. For example, NAN will trigger the OptoOPCServer or PAC Display to report the value as “bad.” If this is the case, the OptoOPCServer will not post values to the OPC Client. The client will only retain the last known value. In PAC Display, the last known value will “stick” in PAC Display Runtime (the event viewer will log the quality change of the tag as well).
An out-of-range value (the default of -32768.0) means the analog module is successfully reporting a value to the brain but due to some input condition, the module can not digitize the input because the analog input is beyond the module’s ability to convert it.
Out-of-range is indicative of excessive input. In some cases, the value may indicate permanent damage to the input of an analog module (but minor enough damage that permits the module to attempt to digitize an invalid analog input).
If you need to modify the out-of-range value, I would avoid using NAN due to the error exception of this value in certain software products. The common value between both conditions will confuse operators, maintenance staff, and the system integrator when the out of range value is forgotten.
For the out of range value, I would use a value outside the scaled range of all the inputs on the rack (or possibly for the entire control system). Keep in mind that changing this value affects all of the out-of-range values for the entire rack.
If you want to use NAN as an indicator, you may initialize a variable constant with the command Move32Bits.
i32Temp = 0x7fffffff;
“IsFloatValid” works for testing this analog input case.