dotnetprojects / DotNetSiemensPLCToolBoxLibrary

Library to Access Siemens PLCs and Step5/Step7 Project Files
GNU Lesser General Public License v2.1
375 stars 194 forks source link

Could you privide some help about parsing DB block with UDT type? #175

Closed blair-long closed 2 months ago

blair-long commented 2 years ago

Hello,

Thank you for providing such a convenient tool to help us to deal with Siemens PLC related matters !!

I'm currently using the library to parse the Siemens DB Block, include S7 and newer TIA. I have few problem would like to ask you to help. Hope someone can give some help. Thanks in advance.

1)、Currently the library does not support the new types of S7-1200, S7-1500, such IEC, LWord, WString, Hardware type, etc.., Is there any plan to support these types?

2)、Looks at the document , The library should support the UDT type, But I didn't find any unit test case to parse DB block with UDT. Could you give me some guideline? My DB block looks like below, It exports from TIA, the "BlTestUDT" is my customized UDT type:

TYPE "BlTestUDT"
VERSION : 0.1
   STRUCT
      PT : Time;
      ET : Time;
      IN : Bool;
      Q : Bool;
   END_STRUCT;

END_TYPE

DATA_BLOCK "testUDT"
{ S7_Optimized_Access := 'FALSE' }
VERSION : 0.1
NON_RETAIN
   STRUCT 
      TestStructA : Struct
         TestIntA : Int;
         TestUDTA { S7_SetPoint := 'False'} : "BlTestUDT";
      END_STRUCT;
   END_STRUCT;

BEGIN
END_DATA_BLOCK
jogibear9988 commented 2 years ago

I've never tried to use the new types with absolut addressed block, so I don't know if this could work. I've also never tried to read/write blocks from a 1500plc with the old methods, don't know if this will work. So it could be supported if it works, but I've no time to work on this atm. So maybe you could work on a pull req?

I think in S7300/400 UDTs work

jogibear9988 commented 2 years ago

Problem is, the format for the new plc is completely closed (as the old one was), but it's more complex, and will need much time to decode(I don't have the time). In our company we use AgLink Library for 1500 plc