system.opc.readValue
Reads a single value directly from an OPC server connection. The address is specified as a string, for example, [MyDevice]N11/N11:0The object returned from this function has three attributes: value, quality, and timestamp. The value attribute represents the current value for the address specified.
The quality attribute is an OPC-UA status code. You can easily check a good quality vs a bad quality by calling the isGood()function on the quality object. The timestamp attribute is Date object that represents the time that the value was retrieved at.
system.opc. readValue( opcServer, itemPath )
-
Parameters
String opcServer - The name of the OPC server connection in which the item resides.
String itemPath - The item path, or address, to read from.
-
Returns
QualifiedValue - An object that contains the value, quality, and timestamp returned from the OPC server for the address specified.
-
Scope
All
server
=
"Ignition OPC-UA Server"
path
=
"[SLCSim]_Meta:N7/N7:0"
qualifiedValue
=
system.opc.readValue(server, path)
print
"Value: "
+
str
(qualifiedValue.getValue())
print
"Quality: "
+
qualifiedValue.getQuality().toString()
print
"Timestamp: "
+
qualifiedValue.getTimestamp().toString()