1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 <2023> 2024 2025 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 <2023> 2024 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: [EXTERNAL] Re: opc ua |
From: | "Sinclair, John via Tech-talk" <tech-talk at aps.anl.gov> |
To: | tech-talk <tech-talk at aps.anl.gov> |
Date: | Fri, 26 May 2023 15:58:51 +0000 |
I have previously installed the python opcua (actually opcua-asyncio) for the server simulation. The server creates the object MyObject with a member variable MyVariable.
The opcua-asyncio python client reads this as follows:
# Get the variable node for read / write
var = await client.nodes.root.get_child(
["0:Objects", f"{nsidx}:MyObject", f"{nsidx}:MyVariable"]
)
value = await var.read_value()
As suggested below, I tried
field( INP, "@opcua1 str:123,\"MyObject\".\"MyVariable\"" )
I also tried
field( INP, "@opcua1 str:123,\"MyObject.MyVariable\"" )
field( INP, "@opcua1 str:123,\'MyObject\'.\'MyVariable\'" )
field( INP, "@opcua1 str:123,\'MyObject.MyVariable\'" )
In every case, I get the error message from the IOC:
Error reading from node: BadNodeIdUnknown
-----
In the server code, I can print the namespace index and node id which, for the above is 123 and 2 respectively.
Doing
field( INP, "@opcua1 num:123,2" )
does work and gets the correct value.
Thanks,
John
From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Jörn Dreyer via Tech-talk <tech-talk at aps.anl.gov>
Sent: Friday, May 26, 2023 1:54 AM To: tech-talk at aps.anl.gov <tech-talk at aps.anl.gov> Subject: [EXTERNAL] Re: opc ua Am Freitag, 26. Mai 2023, 06:18:51 CEST schrieb Blomley, Edmund (IBPT) via
Tech-talk: > Hey, > > > Saying: > > field( INP, "@opcua1 str:123,MyObject.MyVariable" ) > > > > does not work but I could find nothing in the documentation that describes > > the syntax for this case. > I think you are missing quotation marks around the strings. For your case I > would try: > > field( INP, "@opcua1 str:123,\"MyObject\".\"MyVariable\"" ) > > In general I find it helpful to use a OPC UA client to connect to the OPC > server and look up the proper names of the relevant channels. For example > this one: https://urldefense.us/v2/url?u=https-3A__www.unified-2Dautomation.com_downloads_opc-2Dua-2Dclients.html&d=DwIFaQ&c=v4IIwRuZAmwupIjowmMWUmLasxPEgYsgNI-O7C4ViYc&r=y1ySv2e6R1vXjM6-S-0q8nP52didqNXa2-iA6BX9G3w&m=jo1RgfpgortAIJVWuXWuI8DHNQ8N-IytVG--U3aloVKHHB650IhQAhzS0kLB_xzj&s=Apx5AxvkpcpVpVguN0iATlc-zoHyzlgDH5fRnexGdzk&e= > There is also a Python program called opcua-client that you can install via pip. Regards Jörn |