OPC tag

Guys, i’m new to the Ignition SDK, and i’m having some difficulties. (Yes i read the guide, but unfortunately i did not succeed in understanding it)

Right now i need to read (every second) an OPC tag value into a java program, the tag path is
“[GenericSim]_Meta:Ramp/Ramp1”, do some processing, and then place the ouput in another tag.

I know that for subscribing i need to use the OPCManager, however this is an interface, and i really don’t know how to implement some of its methods.

Code Samples would be much appreciated.

Thanks in advance

Hi,

First off, you say you want to bring an opc value “into a java program”. Is this a program that already exists? Or, do you mean that you intend to write the logic code in Java? The SDK is only used for writing pieces that run inside of Ignition, not for writing other Java applications. If you need to interface to an outside program, the most direct thing to do would be to find a Java SDK made for writing OPC-UA clients (such as this one). Beyond that, if it’s easier for you to work with databases, you could use External SQLTags, but I can explain that more later if you need it.

If you’re sure you want to write an actual module that runs in Ignition, you won’t be implementing any particular interface, besides the GatewayModuleHook at some point. That is the entry point for the module, and is given a GatewayContext, which you can use to access all the parts of the system, including the OPCManager, which can be used to subscribe, read, or write.

Regards,

Hi Colby.Clegg thanks for the reply,

Actually it could be something inside the simpletagprovider sample code that comes along with the ignition sdk. Inside we have a SimpleProviderGatewayHook.java where some memory tags are created and their values updated randomly with an updateValues() method.

I was wondering if i could read the values from an OPC tag, make an algebric operation for example and then update the tags with the result obtained.