Closed Kamforka closed 6 years ago
Minor thing: dbLoadRecords("db/opcuas7.db") to load from the database file install directory (not the source), but in your setup your line works, too.
Are you sure you are not missing a part of the name? On my 1500 (using TiA-Portal) the string id has a PLC part and a DB part before the variable name, e.g. field(INP, "@3,\\"PLC_1\\".\\"Data_block_1\\".\\"BoolOut1\\"")
According the minor thing you are right, but I leaved as it was, as I'm using the provided examples as a skeleton, so that should be fixed in the future.
Well I'm kinda sure the StringNodeId
is fine, as if I change Outputbit1
for example to Outputbit100
, then after restarting the IOC I get the following exception:
Add monitored items to subscription ...
0 Outputbit1 DevUaSubscription::createMonitoredItems failed for node: ns=3;s="Outputbit100" - Status BadNodeIdUnknown
And with Outputbit1
it was not the case.
Any thoughts?
Update:
When using the following syntax in Python:
client.get_node('ns=3;s="PLC_1"."Outputs"."Outputbit1"')
I can access the bit, but when I change the string in the EPICS db to:
field(OUT, "@3,\"PLC_1\".\"Outputs\".\"Outputbit1\"")
I get the Status BadNodeIdUnknown
exception as again.
Are you sure your Channel Access connection is working? (Often firewalls are causing CA to fail.)
What does cainfo Outputbit1
say?
It returns with the following:
evpuser@ubuntu:~$ cainfo Outputbit1
Outputbit1
State: connected
Host: 192.168.179.135:5064
Access: read, write
Native data type: DBF_ENUM
Request type: DBR_ENUM
Element count: 1
Good. So what do caput -n Outputbit1 1
and caget -n Outputbit1
do?
(You should use -n
= numeric since you did not specify strings for zero and one in your record.)
On the OPC-UA layer, you have to make sure you made the variable visible and writable on the 1500.
Okay, it looks fine with the -n
flag. Thanks!
BTW how should I specify enums in my record to skip the -n
flag?
In the bo record, that would be the ZNAM and ONAM fields. https://wiki-ext.aps.anl.gov/epics/index.php/RRM_3-14 is your friend. Yes, it applies to 3.14, but 90+% are still true.
Got it! Thanks once again for your help!
I'm using the Python package opcua to test OPC UA communication with an S7-1500 PLC.
I have an output bit called "Outputbit1" in my PLC, and I can successfully access it using the
opcua.Client.get_node()
method the following way:However I can't seem to achieve the same result using the opcUa package with EPICS.
I've set up a simple db file with the following contents:
and my
st.cmd
file looks like this:Then from the directory
testTop/testIocApp
I execute the command below:../bin/linux-x86_64/OPCUAIOC st.cmd.OPCUAIOC
After that the ioc shell starts without any errors:
But then from another terminal using
caget
,caput
orcamonitor
I cannot retrieve nor modify the value ofOutputbit1
, can you help me guide into the right way of doing this?