COM13d. [4/5]V20 Connecting a Siemens PLC S7-1500 to an SQL Database [PLC Section]

Sdílet
Vložit
  • čas přidán 10. 09. 2024

Komentáře • 31

  • @electricalautomation
    @electricalautomation  Před 3 lety +2

    Siemens released V21 on Feb.21, 2021, which likely solved the problem of the programming for S7-1200 . "The parameter "data" must be interconnected with an "Array of Byte" when using a S7-1200. A structure is not permitted. " This is talking about the "SqlReceive".data at the interface of the “LSql_Microsift” FB

  • @hetanhawke2354
    @hetanhawke2354 Před 3 lety

    THANKS MR . YOU ARE THE BEST

  • @sergiodelpozobernier8259

    Has anyone solved the problem of receiving data from version 2.1? i have a s7-1200 plc and i can't execute commands like update or select.

  • @mateuszobirek9809
    @mateuszobirek9809 Před 3 lety +1

    I really like yours tutorial. But can you show also how to insert different data to two or more different tables in SQL database at the same time. I was trying to that but failed. I will be glad :) Thanks

    • @electricalautomation
      @electricalautomation  Před 3 lety

      I don't think using one command can send to different tables by using this example. But you can switch different command via [index number]. The protocol is TDS and and Send/Receive function blocks are based on the TCP/IP, the current version V20 cannot operating different tables within one command.

  • @vvk1398
    @vvk1398 Před 2 lety

    hi
    i have a S71200 PLC
    I insert value (both int and real) to sql that is oke but when i update value that is fail, it don't change value on sql.
    Can you help me to solve this problem. Thanks !

    • @electricalautomation
      @electricalautomation  Před 2 lety

      Sorry, I am on a business trip these weeks and I am not available to check the details because the laptop is not the workstation I use for youtube.

  • @luisserrano1245
    @luisserrano1245 Před 2 lety

    Hi, I'm getting an 8602 erro when using the lsql block, that means it is a tcon error, which is 80C6. I already configured everything, opened port 1433 on the server and added an inbound rule in the firewll, do you know what else i can do to troubleshoot my problem?

    • @electricalautomation
      @electricalautomation  Před 2 lety

      Use hardware PLC and a PC installed SQL for the test. Also check the PC firewall

    • @tiennguyenhuu8736
      @tiennguyenhuu8736 Před 5 měsíci

      Have you solved the problem yet? I am using plcsim advance to simulate and get the same error. If you solved this error, can you help me? Thank!

    • @tiennguyenhuu8736
      @tiennguyenhuu8736 Před 5 měsíci

      @@electricalautomation I did the following instruction but i get the 8602 error (for version 3.1 Tia V17). What is the reason for this? And if I use hardware s7 1200 for the test, are there any different steps compared to the steps above? Thanks!

  • @monikawisniewska1588
    @monikawisniewska1588 Před 3 lety +1

    Hello! first of all, thank for your videos, they really helped a lot!
    I am having a problem with receiving data.
    I use the version 21 of the code in Tia Portal V16, and I have s7 1200. In the LSqlMicrosoft function code I modified so the received data is an array (data.bytes) I can sucessfully send the insert comands and observe results in my SQL Database.
    What I cannot do is read the received data in tia . I can see the response using Wireshark though, watching the tds protocol but no data appears in tia and dataReceived is never true. I tried to modify the data type typeUseCaseSpecificData so the tokenColumnMetaData´s size matches the bytes I see in wireshark (as described in simenes manual).
    Do you have an idea, what could be a problem? I see in the video that you receive data without any modifications to the code V20 and it happens after sending every command.

    • @electricalautomation
      @electricalautomation  Před 3 lety +1

      Hello, I think s7-1200 still has issue on implementing this. In the video I used S7-1500 configuration and PLCSimAdv. According the the document of the V21, S7-1200 does not support the structure in its receive buffer and its length is 8K (S7-1500 64K). As you said, you modified the received data as the bytes of the array, but still can not get successfully, so probably try a simple data and table in the SQL to decrease the data telegram length. From my personal view, there would be something out of the S7-1200 abilities which cause us cannot make it successfully. If this is a test for you, then use S7-1500 or PLCSim Adv, as shown in the video, they are no problems. As Siemens did before, every couple of months, this example got upgrade and got problems solved. Maybe Siemens will update or upgrade this example to solve the glitches soon.

    • @monikawisniewska1588
      @monikawisniewska1588 Před 3 lety

      ​@@electricalautomation I investigated a little bit and I have realised that the response can be seen in tia but only in SqlReceive.data.bytes which is difficult to read. I suppose the program has got some part that takes care of this data and puts it to accordingly into header, tokenColumnMetaData and tokenRows so it is easier to read. Do you know where exactly does that happen so I can investigate and maybe fix my problem?
      I have written some code that writes the data in more approachable form into new data block but the problem is it must be modified depending on the length of the response (depends on token ColumnMetaData).

    • @electricalautomation
      @electricalautomation  Před 3 lety

      @@monikawisniewska1588 You could try to use a new created DB, set it as the received data and as bytes of the array. Then use this array as the RECV Buffer. Then transfer this buffer DB data to the receive buffer DB from the example program.

  • @SCADAExperts
    @SCADAExperts Před 2 měsíci

    Please share video on Updated code by Siemens.

  • @faridviko
    @faridviko Před 3 lety

    hi
    is that possible to use one laptop for SQExpress and TIA Portal?
    so there are 1 laptop has sqlexpress and tia portal in it and 1 s7-1200 PLC

    • @electricalautomation
      @electricalautomation  Před 3 lety

      As long as TIA Portal compatible with SQLExpress. But if you are using PLCSim to simulate PLC for this test, it won't work, because it is using TCP/IP.

    • @faridviko
      @faridviko Před 3 lety

      @@electricalautomation hi thank you for your explanation. I got another question, how do log data from DB to ms SQL using insert command?

    • @electricalautomation
      @electricalautomation  Před 3 lety

      @@faridviko Sorry, not quite understand your question. As you can see at 12:00 in the video, the command is using ""Insert"

    • @faridviko
      @faridviko Před 3 lety

      @@electricalautomation I mean, I have a datablock DB at TIA portal that I want to put it at SQL command. how can we write that using "insert"?. let say "insert into PLCDB values (5,6). I want to to change values 5 and 6 with datablock values.

    • @electricalautomation
      @electricalautomation  Před 3 lety

      @@faridviko Please watch carefully about the videos on this topic COM13a. [1/5]Connecting a Siemens PLC(S7-1200/S7-1500) to an SQL Database [SQL Section]
      czcams.com/video/fRKTqoNKcXU/video.html
      COM13b. [2/5]V11 Connecting a Siemens PLC(S7-1200/S7-1500) to an SQL Database [PLC Section]
      czcams.com/video/2wpFREYnJPY/video.html
      COM13c. [3/5]Sending INT and Real from S7-1200 to an SQL Database [Programming Section]
      czcams.com/video/Y0bLIpnuTQM/video.html
      COM13d. [4/5]V20 Connecting a Siemens PLC S7-1500 to an SQL Database [PLC Section]
      czcams.com/video/jDf2kF2gDug/video.html
      COM13e. [5/5]V20 Connecting a Siemens PLC S7-1500 to an SQL Database [SELECT WHERE] (Wireshark)czcams.com/video/Z8etx2h_pYw/video.html

  • @cemresergenmumen543
    @cemresergenmumen543 Před 3 lety

    Hi ,
    Firslty thanks for your videos and I really like yours videos.I want to ask something you. I have a problem on V20. When I modify "SqlConfig".enableLSql
    =True, directly diagnostics.status
    give a error 16#8605.
    "InstLSql_Microsoft".diagnostics.status Hex 16#8605
    "InstLSql_Microsoft".diagnostics.subfunctionStatus Hex 16#8088
    "InstLSql_Microsoft".diagnostics.stateNumber DEC+/- 7
    How can i solve this problem? Can you help me on this topic?
    Thanks in advance.

    • @electricalautomation
      @electricalautomation  Před 3 lety

      Please check the COM13.b czcams.com/video/2wpFREYnJPY/video.html, I discussed #8088. You'd better use S7-1500. Likely this example does not fully compatible with S7-1200 evenif you are using V4.4.