Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Cannot map tag if array notation is used in-between elements of an ADS tag address #1785

Open
2 of 16 tasks
vladbogun1 opened this issue Sep 24, 2024 · 1 comment
Open
2 of 16 tasks
Labels
ADS https://plc4x.apache.org/users/protocols/ads.html bug java Pull requests that update Java code

Comments

@vladbogun1
Copy link

What happened?

I have tag Mod1.FDPRT.PAP2.Axis[3].Drive.NcToPlc.ActTorque
"Axis[3]" its not an array, its name of plc tag, so i expext that everything works okay, but seems like it is not parsed in AdsDataTypeTableEntry during connecting, so it throws exception PlcRuntimeException: Couldn't find child with name 'Axis[2]' for type 'FB_PAP2_FDPRT'

in this piece of code, when it succesfully come to "Axis[3]" in remainingAddressParts.get(0), in adsDataTypeTableEntry.getChildren() there is no such child, so i made conclusion that it is missed during connection fetching of dataTypeTable

 // Go through all children looking for a matching one.
        for (AdsDataTypeTableChildEntry child : adsDataTypeTableEntry.getChildren()) {
            if (child.getPropertyName().equals(remainingAddressParts.get(0))) {
                AdsDataTypeTableEntry childAdsDataTypeTableEntry = dataTypeTable.get(child.getDataTypeName());
                return resolveDirectAdsTagForSymbolicNameFromDataType(
                    remainingAddressParts.subList(1, remainingAddressParts.size()),
                    currentGroup, currentOffset + child.getOffset(), childAdsDataTypeTableEntry);
            }
        }

i made an app that will just do browse request and read all children in a tree
and as soon as i can see that it contains many similar tags defined on my plc

var browseRequest = plcConnection.browseRequestBuilder()
                .addQuery("browse", "")
                .build();

var browseResponse = browseRequest.execute().get();
var browseItems = browseResponse.getValues("browse");

image

and as soon as my plc return this tag, i expect that read request will succeed, but seems readSymbolTableAndDatatypeTable acts strange

P.S. or actually that can be a mistake of plcBrowserequest, why it returns me Axis[*] structure in root of request
as i can see it also contains
| +-- Mod1.TSHLN.PAP2.Axis: [List]
debugged a little, here is content of it
image
Why list does not contain definition of structure?
and some of array content structure just thrown in root of Browse items list?

maybe thats why i just thought that its not an array but static tag name defined by our plc developers

Version

v0.12.0

Programming Languages

  • plc4j
  • plc4go
  • plc4c
  • plc4net

Protocols

  • AB-Ethernet
  • ADS /AMS
  • BACnet/IP
  • CANopen
  • DeltaV
  • DF1
  • EtherNet/IP
  • Firmata
  • KNXnet/IP
  • Modbus
  • OPC-UA
  • S7
@vladbogun1 vladbogun1 added the bug label Sep 24, 2024
@chrisdutz
Copy link
Contributor

Yeah ... I noticed this some time ago and am planning on working on it ... arrays in combination with UDTs does make things a LOT more complicated. But yeah ... I'm aware of the issue. However it's probably going to take a while to implement as I have only limited time and will be traveling to he US next Friday to Community over Code NA in Denver and will be returning 8 days later. So it's just this Friday 4h and then 3 weeks later the next ones.

If you need this sooner, feel free to leave a donation here: https://buymeacoffee.com/christoferu or my github sponsors account https://github.com/chrisdutz/ I would be willing to invest more time into this and therefore get it done sooner.

@ottlukas ottlukas added java Pull requests that update Java code ADS https://plc4x.apache.org/users/protocols/ads.html labels Sep 25, 2024
@chrisdutz chrisdutz changed the title [Bug]: Cannot map tag if it looks like array in AdsDataTypeTableEntry [Bug]: Cannot map tag if array notation is used in-between elements of an ADS tag address Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADS https://plc4x.apache.org/users/protocols/ads.html bug java Pull requests that update Java code
Projects
None yet
Development

No branches or pull requests

3 participants