Menu

Switching error reading from PLC 1200

Reyan
2015-12-18
2016-04-05
  • Reyan

    Reyan - 2015-12-18

    Davide
    First of all my respect for such beatiful work!! and share with community!!!, Thank you so much. By the way I developed & tested the S7 class and other few functions in C++, except the DateTime functions, but I am not sure how to send to you, in case like to use or modify. Please can you recommend best way.

    Well, I tested with the PLC 1200, SINAMICs, LOGO, PLC S7 400 and works pretty good, at least the first 20 minutes, but after 35 minutes - 1 hour, I have noticed the switching values between one variable and next one sometimes. I am using VM with Debian 8, and Qt. I have a vector of packages, that identify the source, start address, etc, as way to configure or organize the tags. Basically I have a loop that do the data reading (every 100 ms): doing read frame and parsing frame for each package (vector of structure), in cyclic or alternation way, only one package at a time, in a single thread.The read frame it reads in buffer based on area source using the different Cli functions for it (Cli_EBRead, Cli_MBRead, Cli_DBRead). In Parsing frame is using the S7 functions to do mapping of buffer. For example: I am reading in package#1: Inputs 0, total bytes=1, in the package#2 reading from the DB 100, 28 bytes from PLC 1200. Well, after 35 minutes, happenned that when reading the package #1- INPUTS, it returns in buffer corresponding value of the first tag belongs to the DB 100 which is read only in package #2. And viceversa, in package #2 buffer, that read only from DB 100, contains in first bytes the corresponding value of input, however the rest of the data read in DB are correct. It sound to me kind of lost sync between Cli function called and buffer returned.

    Please can you recommend some idea to help me troubleshooting this. I check already all packages and are fine, sometimes it works pretty good for a while and other after 35 minutes just happens.

    Thank you so much

     
    • Reyan

      Reyan - 2016-01-08

      Hi Davide
      Seems it is happening if for some reason we are getting an error from ReadData, the next time software call for ReadData, seems it is returning the data from previous job, and from this point every read starting to get data from the previous reading, and so on. I am not sure what it is happening, I have noticed in Sinamics and PLC 1200, but more on SINAMICs G120, specially after the ReadData return not null value, so we got an error.

      What I did two patching:

      1- if I see some error in reading data, I just close the connection and re-open again. It would be nice to have something to FLUSH all jobs pending or in queue, although I am using sync client reading.

      2- Use backup of buffer before reading, and compare buffer with backup after reading, to make sure the buffer was modified. This is a tricky but helps to make sure the buffer changed.

      Please any thought...

      Thanks
      Reyan

       
  • Davide Nardella

    Davide Nardella - 2015-12-20

    Hi,
    there is no buffer "memory" between consecutive readings and, if you are using synchronous functions in a single thread, they terminates when the protocol handshake is complete.

    Do you check the result of every call ? if there is a comm error, the buffer that you passed is not modified and could contain the data of a former function.

    Then, do you are experiencing this issue on a S71200 or for all PLCs?
    if yes, what's the firmware release ?

    Regards

     

    Last edit: Davide Nardella 2015-12-20
    • Reyan

      Reyan - 2015-12-23

      Hi,
      I have following firmware::

      G120: firmware 4.7

      PLC 1200: 214-1BG40-0XB0, firmware v4.1

      Thanks

       
  • Reyan

    Reyan - 2015-12-23

    Hi Davide
    Thank you for your support . Yes on every call I check for the result of Read before calling Parsing Frame. Please see the link below the screenshots and section of the code. I am positive the ParsingFrame is only called if the ReadFrame results was ok. Please see section of the code.

    I have seen this issue few times on 1200 and most of time in SINAMICs G120.

    Please see the screenshots and section of codes and driver base class, kind of base class for read data, that S7Profinet driver inherited. https://www.dropbox.com/sh/txbl6wcp16zdcol/AAA2ovAwTHUu2ujyGTyh12PNa?dl=0

    It is king of weird, sometimes it does after 35 min- 4 hours. As you can see in the error screenshot the content of the frame#1 actually is frame#3, but the ReadFrame is reading from DB=35, Start Address = 1024, 4 bytes. (G120 Motor temp), should be around 20 or greater. The Tag ID =1560, which has index 0 in the dic.

    Thank you so much and Merry Christmas

     
  • Bert Kortenbach

    Bert Kortenbach - 2016-04-05

    Can you reproduce the problem by using one of the examples that are supplied with snap7? If you can than that would geatly simplify the process of reproducing this problem...

     

Log in to post a comment.