You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@plc4x.apache.org by Gunther Gruber <gu...@IDA-Analytics.de> on 2019/03/06 12:40:30 UTC

S7 read multiple variables

I try to read multiple variables synchronous from a S7-1500 and get a exception. I use the code from the hello world example. When i split up the variables into smaller units like 5-8 it works. any suggestion on this? Is there a limit to the number of variables?

Gunther


String vars = "%Q73:WORD,%Q75:WORD,%I73:WORD,%I75:WORD,%I74:WORD,%I77:WORD,%F81.1:BOOL,%Q82:REAL,%F86:INT,%F89:REAL,%I40:INT,%Q2.5:BOOL,%Q3:INT,%I66:WORD,%Q20:REAL,%I61:WORD,%Q25:WORD,%I58.0:BOOL,%F1:BYTE,%F1.0:BOOL,%F1.1:BOOL,%F1.2:BOOL,%F1.3:BOOL,%F28.0:BOOL,%I58:WORD,%F0.7:BOOL,%F0.6:BOOL,%F0.5:BOOL,%F0.4:BOOL,%F0.3:BOOL,%F0.2:BOOL,%F0.1:BOOL,%F0.0:BOOL,%F0:BYTE";

for (String item : splitVariables(vars)){
  variables.add(item);
}


460 [main] INFO com.ida.moira.collector.plc4j.PLCCollectorOperatorTest  - Synchronous request ...
487 [nioEventLoopGroup-2-1] WARN io.netty.channel.DefaultChannelPipeline  - An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
io.netty.handler.codec.DecoderException: java.lang.NullPointerException
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:98)
    at org.apache.plc4x.java.s7.netty.S7Protocol.channelRead(S7Protocol.java:410)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
    at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284)
    at io.netty.handler.codec.ByteToMessageCodec.channelRead(ByteToMessageCodec.java:103)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
    at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
    at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
    at org.apache.plc4x.java.s7.netty.S7Protocol.decodeVarPayload(S7Protocol.java:608)
    at org.apache.plc4x.java.s7.netty.S7Protocol.decodePayloads(S7Protocol.java:580)
    at org.apache.plc4x.java.s7.netty.S7Protocol.decode(S7Protocol.java:456)
    at org.apache.plc4x.java.s7.netty.S7Protocol$1.decode(S7Protocol.java:85)
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88)
    ... 31 more

Re: S7 read multiple variables

Posted by Julian Feinauer <j....@pragmaticminds.de>.
Hi,

short update (we just had a discussion offline).
This should be the Bug which will be fixed with release 0.3.1 as there are many 1 byte requests (Bool and Byte).

So 
tl; dr; for chris: stfu : )

Julian

Am 07.03.19, 16:26 schrieb "Christofer Dutz" <ch...@c-ware.de>:

    Hi Gunther,
    
    I was a little surprised about your finding as it seems all items have even byte-number types so the fill-byte problem shouldn't occur.
    
    And the splitting of requests should also work quite well for S7 ... In one POC we even read 2600 items in one logical request, which was automatically split up into 30 requests and correctly merged back together.
    
    How did you avoid the problem. I would assume you found a bug ... so we should fix it.
    
    Chris
    
    
    
    Am 07.03.19, 15:29 schrieb "Gunther Gruber" <gu...@IDA-Analytics.de>:
    
        Hi,
        
        with some small tweaks in my code i can read all the variables from a s7-1500 with the 0.3 version. I will switch to 0.3.1 after release.
        
        Thx for this awesome library.
        
        Below some proof :)
        
        
        timestamp       driveSetFreqInPercent   currentDrivePercent     currentSpeedInRpm
        
        1551966078526
        
        50
        
        50.0
        
        690.0
        
        
        1551966079540
        
        50
        
        50.0
        
        690.0
        
        On 3/6/19 1:51 PM, Tim Mitsch wrote:
        
        Hello Gunther
        
        This bug is known and we fixed it already in development branch.
        The problem is not the amount of variables rather than one-byte variables like BOOL,BYTE,USINT, ... - Simens uses a filling-byte when acquiring a single one-byte request
        Right now we have the bugfix-release 0.3.1 as RC1 in vote, so you can try using a checkout development-branch from GitHub or just wait a few days until vote is finished and the version is available on MavenCentral.
        Or you can use the staging-repository by integrating that in your pom and change plc4x-version to 0.3.1: https://repository.apache.org/content/repositories/orgapacheplc4x-1008
        
        Best
        Tim
        
        Am 06.03.19, 13:40 schrieb "Gunther Gruber" <gu...@IDA-Analytics.de>:
        
            I try to read multiple variables synchronous from a S7-1500 and get a exception. I use the code from the hello world example. When i split up the variables into smaller units like 5-8 it works. any suggestion on this? Is there a limit to the number of variables?
        
            Gunther
        
        
            String vars = "%Q73:WORD,%Q75:WORD,%I73:WORD,%I75:WORD,%I74:WORD,%I77:WORD,%F81.1:BOOL,%Q82:REAL,%F86:INT,%F89:REAL,%I40:INT,%Q2.5:BOOL,%Q3:INT,%I66:WORD,%Q20:REAL,%I61:WORD,%Q25:WORD,%I58.0:BOOL,%F1:BYTE,%F1.0:BOOL,%F1.1:BOOL,%F1.2:BOOL,%F1.3:BOOL,%F28.0:BOOL,%I58:WORD,%F0.7:BOOL,%F0.6:BOOL,%F0.5:BOOL,%F0.4:BOOL,%F0.3:BOOL,%F0.2:BOOL,%F0.1:BOOL,%F0.0:BOOL,%F0:BYTE";
        
            for (String item : splitVariables(vars)){
              variables.add(item);
            }
        
        
        
    
    


Re: S7 read multiple variables

Posted by Gunther Gruber <gu...@IDA-Analytics.de>.
I resolved it by doing multiple request instead of one big request, and i skipped a few boolean variables.

%F0.7:BOOL,%F0.6:BOOL,%F0.5:BOOL,%F0.4:BOOL,%F0.3:BOOL,%F0.2:BOOL,%F0.1:BOOL,%F0.0:BOOL,%F0:BYTE

%I40:UINT,%Q2.5:BOOL,%Q3:UINT

%I66:WORD,%Q20:REAL,%I61:WORD,%Q25:WORD,%I58.0:BOOL,%I58:WORD

%F1:BYTE

skipped (%F1.0-%1.3)
%F28.0:BOOL



%Q73:WORD,%Q75:WORD,%I73:WORD,%I75:WORD,%I74:WORD,%I77:WORD,%F81.1:BOOL,%Q82:REAL,%F86:INT,%F89:REAL

On 3/7/19 4:26 PM, Christofer Dutz wrote:

Hi Gunther,

I was a little surprised about your finding as it seems all items have even byte-number types so the fill-byte problem shouldn't occur.

And the splitting of requests should also work quite well for S7 ... In one POC we even read 2600 items in one logical request, which was automatically split up into 30 requests and correctly merged back together.

How did you avoid the problem. I would assume you found a bug ... so we should fix it.

Chris



Am 07.03.19, 15:29 schrieb "Gunther Gruber" <gu...@IDA-Analytics.de>:

    Hi,

    with some small tweaks in my code i can read all the variables from a s7-1500 with the 0.3 version. I will switch to 0.3.1 after release.

    Thx for this awesome library.

    Below some proof :)


    timestamp       driveSetFreqInPercent   currentDrivePercent     currentSpeedInRpm

    1551966078526

    50

    50.0

    690.0


    1551966079540

    50

    50.0

    690.0

    On 3/6/19 1:51 PM, Tim Mitsch wrote:

    Hello Gunther

    This bug is known and we fixed it already in development branch.
    The problem is not the amount of variables rather than one-byte variables like BOOL,BYTE,USINT, ... - Simens uses a filling-byte when acquiring a single one-byte request
    Right now we have the bugfix-release 0.3.1 as RC1 in vote, so you can try using a checkout development-branch from GitHub or just wait a few days until vote is finished and the version is available on MavenCentral.
    Or you can use the staging-repository by integrating that in your pom and change plc4x-version to 0.3.1: https://repository.apache.org/content/repositories/orgapacheplc4x-1008

    Best
    Tim

    Am 06.03.19, 13:40 schrieb "Gunther Gruber" <gu...@IDA-Analytics.de>:

        I try to read multiple variables synchronous from a S7-1500 and get a exception. I use the code from the hello world example. When i split up the variables into smaller units like 5-8 it works. any suggestion on this? Is there a limit to the number of variables?

        Gunther


        String vars = "%Q73:WORD,%Q75:WORD,%I73:WORD,%I75:WORD,%I74:WORD,%I77:WORD,%F81.1:BOOL,%Q82:REAL,%F86:INT,%F89:REAL,%I40:INT,%Q2.5:BOOL,%Q3:INT,%I66:WORD,%Q20:REAL,%I61:WORD,%Q25:WORD,%I58.0:BOOL,%F1:BYTE,%F1.0:BOOL,%F1.1:BOOL,%F1.2:BOOL,%F1.3:BOOL,%F28.0:BOOL,%I58:WORD,%F0.7:BOOL,%F0.6:BOOL,%F0.5:BOOL,%F0.4:BOOL,%F0.3:BOOL,%F0.2:BOOL,%F0.1:BOOL,%F0.0:BOOL,%F0:BYTE";

        for (String item : splitVariables(vars)){
          variables.add(item);
        }






--

Gunther Gruber

Software Developer

[cid:part1.87523B61.F2715364@ida-analytics.de]


Intelligent Data Analytics GmbH & Co. KG



c/o TechQuartier

Platz der Einheit 2

60327 Frankfurt

Telefon: +49 6421/4805274

Telefax: +49 6421/4805275

E-Mail: gunther.gruber@ida-analytics.de

Internet: www.ida-analytics.de<http://www.ida-analytics.de/>



Unternehmenssitz: Frankfurt am Main | Handelsregister beim Amtsgericht: Frankfurt am Main, Registernummer: HRA 49357 | USt. ID-Nr.: DE310205810 | Finanzamt: Frankfurt am Main

Persönlich haftende Gesellschafterin: IDA Intelligent Data Analytics GmbH | Sitz: Frankfurt am Main | Handelsregister beim Amtsgericht: Frankfurt am Main | Handelsregister-Nummer: HRB 106805 | Geschäftsführer: Mohamed Ayadi, Nils Björn Krugmann, Matthias Leinweber, Marc Seidemann

If you are not the addressee, please inform us immediately that you have received this e-mail by mistake, and delete it. We thank you for your support.

Re: S7 read multiple variables

Posted by Christofer Dutz <ch...@c-ware.de>.
Hi Gunther,

I was a little surprised about your finding as it seems all items have even byte-number types so the fill-byte problem shouldn't occur.

And the splitting of requests should also work quite well for S7 ... In one POC we even read 2600 items in one logical request, which was automatically split up into 30 requests and correctly merged back together.

How did you avoid the problem. I would assume you found a bug ... so we should fix it.

Chris



Am 07.03.19, 15:29 schrieb "Gunther Gruber" <gu...@IDA-Analytics.de>:

    Hi,
    
    with some small tweaks in my code i can read all the variables from a s7-1500 with the 0.3 version. I will switch to 0.3.1 after release.
    
    Thx for this awesome library.
    
    Below some proof :)
    
    
    timestamp       driveSetFreqInPercent   currentDrivePercent     currentSpeedInRpm
    
    1551966078526
    
    50
    
    50.0
    
    690.0
    
    
    1551966079540
    
    50
    
    50.0
    
    690.0
    
    On 3/6/19 1:51 PM, Tim Mitsch wrote:
    
    Hello Gunther
    
    This bug is known and we fixed it already in development branch.
    The problem is not the amount of variables rather than one-byte variables like BOOL,BYTE,USINT, ... - Simens uses a filling-byte when acquiring a single one-byte request
    Right now we have the bugfix-release 0.3.1 as RC1 in vote, so you can try using a checkout development-branch from GitHub or just wait a few days until vote is finished and the version is available on MavenCentral.
    Or you can use the staging-repository by integrating that in your pom and change plc4x-version to 0.3.1: https://repository.apache.org/content/repositories/orgapacheplc4x-1008
    
    Best
    Tim
    
    Am 06.03.19, 13:40 schrieb "Gunther Gruber" <gu...@IDA-Analytics.de>:
    
        I try to read multiple variables synchronous from a S7-1500 and get a exception. I use the code from the hello world example. When i split up the variables into smaller units like 5-8 it works. any suggestion on this? Is there a limit to the number of variables?
    
        Gunther
    
    
        String vars = "%Q73:WORD,%Q75:WORD,%I73:WORD,%I75:WORD,%I74:WORD,%I77:WORD,%F81.1:BOOL,%Q82:REAL,%F86:INT,%F89:REAL,%I40:INT,%Q2.5:BOOL,%Q3:INT,%I66:WORD,%Q20:REAL,%I61:WORD,%Q25:WORD,%I58.0:BOOL,%F1:BYTE,%F1.0:BOOL,%F1.1:BOOL,%F1.2:BOOL,%F1.3:BOOL,%F28.0:BOOL,%I58:WORD,%F0.7:BOOL,%F0.6:BOOL,%F0.5:BOOL,%F0.4:BOOL,%F0.3:BOOL,%F0.2:BOOL,%F0.1:BOOL,%F0.0:BOOL,%F0:BYTE";
    
        for (String item : splitVariables(vars)){
          variables.add(item);
        }
    
    
    


Re: S7 read multiple variables

Posted by Gunther Gruber <gu...@IDA-Analytics.de>.
Hi,

with some small tweaks in my code i can read all the variables from a s7-1500 with the 0.3 version. I will switch to 0.3.1 after release.

Thx for this awesome library.

Below some proof :)


timestamp       driveSetFreqInPercent   currentDrivePercent     currentSpeedInRpm

1551966078526

50

50.0

690.0


1551966079540

50

50.0

690.0

On 3/6/19 1:51 PM, Tim Mitsch wrote:

Hello Gunther

This bug is known and we fixed it already in development branch.
The problem is not the amount of variables rather than one-byte variables like BOOL,BYTE,USINT, ... - Simens uses a filling-byte when acquiring a single one-byte request
Right now we have the bugfix-release 0.3.1 as RC1 in vote, so you can try using a checkout development-branch from GitHub or just wait a few days until vote is finished and the version is available on MavenCentral.
Or you can use the staging-repository by integrating that in your pom and change plc4x-version to 0.3.1: https://repository.apache.org/content/repositories/orgapacheplc4x-1008

Best
Tim

Am 06.03.19, 13:40 schrieb "Gunther Gruber" <gu...@IDA-Analytics.de>:

    I try to read multiple variables synchronous from a S7-1500 and get a exception. I use the code from the hello world example. When i split up the variables into smaller units like 5-8 it works. any suggestion on this? Is there a limit to the number of variables?

    Gunther


    String vars = "%Q73:WORD,%Q75:WORD,%I73:WORD,%I75:WORD,%I74:WORD,%I77:WORD,%F81.1:BOOL,%Q82:REAL,%F86:INT,%F89:REAL,%I40:INT,%Q2.5:BOOL,%Q3:INT,%I66:WORD,%Q20:REAL,%I61:WORD,%Q25:WORD,%I58.0:BOOL,%F1:BYTE,%F1.0:BOOL,%F1.1:BOOL,%F1.2:BOOL,%F1.3:BOOL,%F28.0:BOOL,%I58:WORD,%F0.7:BOOL,%F0.6:BOOL,%F0.5:BOOL,%F0.4:BOOL,%F0.3:BOOL,%F0.2:BOOL,%F0.1:BOOL,%F0.0:BOOL,%F0:BYTE";

    for (String item : splitVariables(vars)){
      variables.add(item);
    }



Re: S7 read multiple variables

Posted by Gunther Gruber <gu...@IDA-Analytics.de>.
thx

On 3/6/19 1:51 PM, Tim Mitsch wrote:

Hello Gunther

This bug is known and we fixed it already in development branch.
The problem is not the amount of variables rather than one-byte variables like BOOL,BYTE,USINT, ... - Simens uses a filling-byte when acquiring a single one-byte request
Right now we have the bugfix-release 0.3.1 as RC1 in vote, so you can try using a checkout development-branch from GitHub or just wait a few days until vote is finished and the version is available on MavenCentral.
Or you can use the staging-repository by integrating that in your pom and change plc4x-version to 0.3.1: https://repository.apache.org/content/repositories/orgapacheplc4x-1008

Best
Tim

Am 06.03.19, 13:40 schrieb "Gunther Gruber" <gu...@IDA-Analytics.de>:

    I try to read multiple variables synchronous from a S7-1500 and get a exception. I use the code from the hello world example. When i split up the variables into smaller units like 5-8 it works. any suggestion on this? Is there a limit to the number of variables?

    Gunther


    String vars = "%Q73:WORD,%Q75:WORD,%I73:WORD,%I75:WORD,%I74:WORD,%I77:WORD,%F81.1:BOOL,%Q82:REAL,%F86:INT,%F89:REAL,%I40:INT,%Q2.5:BOOL,%Q3:INT,%I66:WORD,%Q20:REAL,%I61:WORD,%Q25:WORD,%I58.0:BOOL,%F1:BYTE,%F1.0:BOOL,%F1.1:BOOL,%F1.2:BOOL,%F1.3:BOOL,%F28.0:BOOL,%I58:WORD,%F0.7:BOOL,%F0.6:BOOL,%F0.5:BOOL,%F0.4:BOOL,%F0.3:BOOL,%F0.2:BOOL,%F0.1:BOOL,%F0.0:BOOL,%F0:BYTE";

    for (String item : splitVariables(vars)){
      variables.add(item);
    }


    460 [main] INFO com.ida.moira.collector.plc4j.PLCCollectorOperatorTest  - Synchronous request ...
    487 [nioEventLoopGroup-2-1] WARN io.netty.channel.DefaultChannelPipeline  - An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
    io.netty.handler.codec.DecoderException: java.lang.NullPointerException
        at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:98)
        at org.apache.plc4x.java.s7.netty.S7Protocol.channelRead(S7Protocol.java:410)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
        at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284)
        at io.netty.handler.codec.ByteToMessageCodec.channelRead(ByteToMessageCodec.java:103)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)
    Caused by: java.lang.NullPointerException
        at org.apache.plc4x.java.s7.netty.S7Protocol.decodeVarPayload(S7Protocol.java:608)
        at org.apache.plc4x.java.s7.netty.S7Protocol.decodePayloads(S7Protocol.java:580)
        at org.apache.plc4x.java.s7.netty.S7Protocol.decode(S7Protocol.java:456)
        at org.apache.plc4x.java.s7.netty.S7Protocol$1.decode(S7Protocol.java:85)
        at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88)
        ... 31 more




--

Gunther Gruber

Software Developer

[cid:part1.9E6E9A69.561C286F@ida-analytics.de]


Intelligent Data Analytics GmbH & Co. KG



c/o TechQuartier

Platz der Einheit 2

60327 Frankfurt

Telefon: +49 6421/4805274

Telefax: +49 6421/4805275

E-Mail: gunther.gruber@ida-analytics.de

Internet: www.ida-analytics.de<http://www.ida-analytics.de/>



Unternehmenssitz: Frankfurt am Main | Handelsregister beim Amtsgericht: Frankfurt am Main, Registernummer: HRA 49357 | USt. ID-Nr.: DE310205810 | Finanzamt: Frankfurt am Main

Persönlich haftende Gesellschafterin: IDA Intelligent Data Analytics GmbH | Sitz: Frankfurt am Main | Handelsregister beim Amtsgericht: Frankfurt am Main | Handelsregister-Nummer: HRB 106805 | Geschäftsführer: Mohamed Ayadi, Nils Björn Krugmann, Matthias Leinweber, Marc Seidemann

If you are not the addressee, please inform us immediately that you have received this e-mail by mistake, and delete it. We thank you for your support.

Re: S7 read multiple variables

Posted by Tim Mitsch <t....@pragmaticindustries.de>.
Hello Gunther

This bug is known and we fixed it already in development branch.
The problem is not the amount of variables rather than one-byte variables like BOOL,BYTE,USINT, ... - Simens uses a filling-byte when acquiring a single one-byte request
Right now we have the bugfix-release 0.3.1 as RC1 in vote, so you can try using a checkout development-branch from GitHub or just wait a few days until vote is finished and the version is available on MavenCentral.
Or you can use the staging-repository by integrating that in your pom and change plc4x-version to 0.3.1: https://repository.apache.org/content/repositories/orgapacheplc4x-1008

Best
Tim

Am 06.03.19, 13:40 schrieb "Gunther Gruber" <gu...@IDA-Analytics.de>:

    I try to read multiple variables synchronous from a S7-1500 and get a exception. I use the code from the hello world example. When i split up the variables into smaller units like 5-8 it works. any suggestion on this? Is there a limit to the number of variables?
    
    Gunther
    
    
    String vars = "%Q73:WORD,%Q75:WORD,%I73:WORD,%I75:WORD,%I74:WORD,%I77:WORD,%F81.1:BOOL,%Q82:REAL,%F86:INT,%F89:REAL,%I40:INT,%Q2.5:BOOL,%Q3:INT,%I66:WORD,%Q20:REAL,%I61:WORD,%Q25:WORD,%I58.0:BOOL,%F1:BYTE,%F1.0:BOOL,%F1.1:BOOL,%F1.2:BOOL,%F1.3:BOOL,%F28.0:BOOL,%I58:WORD,%F0.7:BOOL,%F0.6:BOOL,%F0.5:BOOL,%F0.4:BOOL,%F0.3:BOOL,%F0.2:BOOL,%F0.1:BOOL,%F0.0:BOOL,%F0:BYTE";
    
    for (String item : splitVariables(vars)){
      variables.add(item);
    }
    
    
    460 [main] INFO com.ida.moira.collector.plc4j.PLCCollectorOperatorTest  - Synchronous request ...
    487 [nioEventLoopGroup-2-1] WARN io.netty.channel.DefaultChannelPipeline  - An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
    io.netty.handler.codec.DecoderException: java.lang.NullPointerException
        at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:98)
        at org.apache.plc4x.java.s7.netty.S7Protocol.channelRead(S7Protocol.java:410)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
        at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284)
        at io.netty.handler.codec.ByteToMessageCodec.channelRead(ByteToMessageCodec.java:103)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)
    Caused by: java.lang.NullPointerException
        at org.apache.plc4x.java.s7.netty.S7Protocol.decodeVarPayload(S7Protocol.java:608)
        at org.apache.plc4x.java.s7.netty.S7Protocol.decodePayloads(S7Protocol.java:580)
        at org.apache.plc4x.java.s7.netty.S7Protocol.decode(S7Protocol.java:456)
        at org.apache.plc4x.java.s7.netty.S7Protocol$1.decode(S7Protocol.java:85)
        at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88)
        ... 31 more