OPC read/write not working

Hi I have a similar issue with Designer V 8.1.30.

I have a full script to do write values but was not working so I tried to read values and it isn't either.

I did the most basic script to read values to a test tag that I also added to the tag browser so I could monitor it and still get the

[null, Bad("Bad_NodeIdUnknown: The node id refers to a node that does not exist in the server address space.")


I have tried different tags in different scopes but nothing is working.

Your tag name may be incorrect.

According to the manual, it would just be: [BP2_CZ1]TestOPCWrite

Edit: I just confirmed by looking at some scripting I'd done using system.opc.readValues and you don't prefix it with 'ns=1;s=' and I passed multiples in, but passed them as an array/list of tags. So it may not hurt to just put brackets around your path variable.

I tried with both ns1;s= and without it still the same result.

Are you getting any other errors in the logger? It definitely shouldn't have 'ns=1;s=' prefixed, and ideally should be passed as a list, but not sure that's required.

I looked at the gateway logs on both the front end and back end (Tag gateway) and neither had errors related to the script. If I add the brackets to make them a list then I get an error for arg can't be coerced to String

edit: to clarify I have 2 gateways, the front end (HMI) and back end (tag and journals)

The server should be a string, only the path should be made into a list.

Same error but now it describes for the 2nd arg

You should be running this script from the backend server would be my guess unless you're remotely connecting to the OPC server on the backend with the frontend gateway.

We have the remote providers set up correctly. I can browse the tags on the tag browser from the Designer but just the script doesn't want to work.

I'm sorry, you're right. There are 2 functions, one for reading multiple values and one for reading a single value (readValue vs readValues).

Remote providers are different than talking OPC directly. To use providers you'd have to use the system.tag.readBlocking() function instead of system.opc.readValue()

Edit: Keep in mind this will require the tag path inside the provider, not the tag path in the PLC using OPC. So if a tag is in a folder, you'll have to include the full path to the tag on the remote tag provider.

Yeah I just tried it on the tag gateway, just created a dummy project to test the scrip and it works there. I'll play with the system.Tag.readBlocking

Seems like you figured it out, but just to clarify: the system.opc functions only work against OPC servers defined on the local gateway.

It sounds like the tags in your screenshot are from a remote provider, so you don't actually have a PLC hooked up to the local OPC server that the function is operating against.

Hi Kevin, so wild thought can I connect the OPC from the gateway I have the PLCs at to my HMI gateway? I'm trying to understand the best way to go forward since I have several projects that have a similar architecture.

Yes, you can make an OPC connection from one gateway to another (with some configuration changes to the OPC server on the other to allow it).

But since you already have gateway network and remote tag providers set up there's not really a good reason to go down that path.

So if I understand correctly your recommendation would be to add the tags to the remote provider and do a system.tag.writeblocking instead connecting the OPC and do a system.opc.write?

Yeah, might end up being easier since you already have it set up.

It's a little awkward to have to create a tag on the remote gateway just because you need it on the local. It would be nicer if the tag was used on both.