FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
Dear Community User! We are updating our platform to a new
system.
Read more: Important
information on the platform change.
01-17-2024 03:56 PM
Hi,
I try to read some system data layer.
If I try to read a type STRING or BOOL, I can read data in PLC with function DL_ReadNode without problem.
For exampIe: if declare Value as type Bool and I can read:
system/resources/network/interfaces/XF10/ipForwarding
if I declare Value as type STRING, I canb read:
system/resources/network/interfaces/XF10/mode
But If I try to read OBJECT:
system/resources/network/interfaces/XF10/addresses
DL_ReadNode return me always ACCES_ERROR(4).
In this example how I must declare Value to read:
system/resources/network/interfaces/XF10/addresses
with DL_ReadNode function?
Thanks.
Solved! Go to Solution.
01-17-2024 04:23 PM
For your question the answer is no, as you cannot read objects with this function.
You Will have to use the function DL_ReadNodeValue. Please check the example in CXA_DataLayer library or refer to to e.g. to topic "Read/Write DataLayer Structure for OPC UA Client from PLC" or "DL_ReadNode / DL_ReadNodeValue in CoDeSys using FUP language".
01-17-2024 05:10 PM
Thank you for the resoponse.
I understand your example but I have another question about.
For OPC Client I have CXA_OPCUAClient library, for Ethercat CXA_EtherCatMaster library.
For my case (system/resources/network/interfaces/XF10/addresses) which library CXA_XXXXXXX I must use?
Thank you.
01-17-2024 09:17 PM - edited 01-17-2024 09:24 PM
Hi @nova ,
I looked into this for awhile and I think we might be lacking the functionality or at least documentation to do this. First of all, it took me awhile to find the PLC library associated with the datalayer type definition "networkmanager_Address".
I only found it by browsing the documentation of each ctrlX library. I found some POUs in the CXA_DEVICEADMIN_FBS library that look like they are intended to handle these types of operations. There are not associated DUTs in the library.
There are not examples in the documentation on using the POUs. I haven't been successful in reading out the addresses. Here is my code for reference. I think this is close as the address string returns "<" when I have addresses configured and an empty string when I do not.
Declaration
PROGRAM PLC_PRG
VAR
m_fbReadNodeValue: DL_ReadNodeValue;
m_ExecuteReadNodeValue : BOOL;;
m_DataNodeValue : CXA_Datalayer.DL_NodeValue;
m_Type : CXA_Datalayer.DL_DATA_TYPE;
AddressData : CXA_DEVICEADMIN_FBS.networkmanager_Address;
AddressString : STRING;
END_VAR
Implementation
m_ExecuteReadNodeValue := TRUE;
m_fbReadNodeValue(Execute:=m_ExecuteReadNodeValue, NodeName:= 'system/resources/network/interfaces/XF50/addresses', NodeValue:= m_DataNodeValue);
IF (m_fbReadNodeValue.Done = TRUE) THEN
m_Type := m_DataNodeValue.GetType();
AddressData.getRootAsAddress(data := m_DataNodeValue.GetData(), size := m_DataNodeValue.GetSize());
AddressString := AddressData.getAddress();
END_IF
IF (m_fbReadNodeValue.Done = TRUE) OR (m_fbReadNodeValue.Error = TRUE) THEN
m_ExecuteReadNodeValue := FALSE;
m_fbReadNodeValue(Execute:=m_ExecuteReadNodeValue, NodeName:= 'system/resources/network/interfaces/XF50/addresses', NodeValue:= m_DataNodeValue);
END_IF
01-18-2024 08:35 AM
In general there is no library providing easy to use function blocks for the Network information currently, like CXA_OPCUAClient or CXA_EtherCatMaster. So you will have to directly use the CXA_DataLayer.DL_Read_NodeValue and read out the object (flatbuffer) and extract the information like in the examples mentioned above.
To get to know which flatbuffer you need to use check the ctrlX Data Layer viewer on your ctrlX CORE:
By clicking on reference you will be redirected to the corresponding reference area:
In the ctrlX PLC Engineering then use add library and insert the flatbuffer to find the library where it is included:
I will create an example how to read the complete object. Easy to use workaround would be to read all single nodes.
Beware that it seems only to available from version 2.02 on not in 1.20.