The tag value is retrieved from the browser's client cache. GetVal returns the tag value as the return value. As long as the tag name is correct, the return value is guaranteed to be valid.
If there is an error in communication with the PLC or server for an external tag, the last successfully retrieved value will be returned.
To know more about the communication status, refer to the quality flag (GOOD/BAD/UNCERTAIN). The quality flag can be obtained using the following method.
For example, use the quality flag if you want to switch processing depending on the communication status.
For external tags, if no communication has been made yet, "N/A" (UNCERTAIN) will be returned.
Immediately after AddTag, no communication has been performed yet, so the state will be UNCERTAIN for a few seconds. To perform communication immediately after AddTag, call the ReadRefresh method immediately after AddTag.
var vVal = this.GetVal("U01.F01.T01");
::IsQualityGood(vVal); // Communication is going well (GOOD), TRUE
::IsQualityBad(vVal); // Communication is unsuccessful (BAD), TRUE
::IsQualityUncertain(vVal); // Communication has never taken place (UNCERTAIN), TRUE
::GetQuality(vVal); //"GOOD" or "BAD" or "UNCERTAIN"
GetVal can be used on objects for which tags have been registered using AddTag.
|