Skip to content

Rockwell Logix 5000 can only read a small portion of tag data #101

@AlexYHZ

Description

@AlexYHZ

Can only read such "kalarm" and a few status tags,an error occurs when reading other tags.
com.digitalpetri.enip.cip.CipResponseException: status=0x04 [path segment error] , additional=[0x0000]
at com.digitalpetri.enip.logix.services.ReadTagService.decodeResponse(ReadTagService.java:59)
at com.digitalpetri.enip.logix.services.ReadTagService.decodeResponse(ReadTagService.java:12)
at com.digitalpetri.enip.cip.CipClient.lambda$invokeConnected$0(CipClient.java:71)
at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863)
at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
at com.digitalpetri.enip.cip.CipClient$ConnectedDataHandler.itemsReceived(CipClient.java:288)

public class PLCReader {

    public static void main(String[] args) {
        new PLCReader().readTag();
    }

    public void readTag() {
        try {
            EtherNetIpClientConfig config = EtherNetIpClientConfig.builder("10.19.64.102")
                    .setSerialNumber(0x00)
                    .setVendorId(0x00)
                    .setTimeout(Duration.ofSeconds(3))
                    .build();

// backplane, slot 0
            EPath.PaddedEPath connectionPath = new EPath.PaddedEPath(
                    new PortSegment(1, new byte[]{(byte) 0}));

            CipClient client = new CipClient(config, connectionPath);

            client.connect().get();

            CipConnectionPool pool = new CipConnectionPool(4, client, connectionPath, 500);
// the tag we'll use as an example
            EPath.PaddedEPath requestPath = new EPath.PaddedEPath(
                    new DataSegment.AnsiDataSegment("S01Cell.Safety.NoEStops"));
            ReadTagService service = new ReadTagService(requestPath);

            pool.acquire().whenComplete((connection, ex) -> {
                if (connection != null) {
                    CompletableFuture<ByteBuf> f = client.invokeConnected(connection.getO2tConnectionId(), service);

                    f.whenComplete((data, ex2) -> {

                        if (data != null) {
                            System.out.println(data.readBoolean()+"Tag data: " + ByteBufUtil.hexDump(data));
                        } else {
                            ex2.printStackTrace();
                        }
                        pool.release(connection);
                    });
                } else {
                    ex.printStackTrace();
                }
            });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions