Direct tags import from S7 PLC (Profinet)

The import routine of the driver permits to import S7 PLC tags from “.ap13” file.

To correctly configure the TIA Portal project, please refer to S7-1200/S7-1500 configuration

S7-1200/S7-1500 configuration

../../_images/8a341dc8edd171bb07183b09787513c6fb146550.png
  1. Select the PLC from the project tree using the right click.

  2. Click on Properties.

  3. In “General” tab, select Protection and select Full access (no protection). Make sure that Permit access with PUT/GET communication from remote partner is checked.

    ../../_images/34fd9da58cfda0129c8bf44d69a2db6b98ab086c.png
  4. Select the DB name from the Program blocks tree.

  5. Click on Properties.

  6. Select Attributes and check Optimized block access. image1

  7. Enter variables in Data_block[DB].

  8. Compile the project.

Import variables directly from Siemens TIA Portal projects

The driver can import the variables directly from a TIA Portal project, opening the “.ap13” file in the folder of the TIA Portal project.

If your project has multiple programs it is necessary to choose the program from which you want to import the variables.

The driver can import variables from the symbols file of the project (Merker, Input, Output) or variables defined in the Data Blocks (DB).

The importer will create variables in the supervisor with the same name defined in the TIA Portal project and will assign the physical address to the variable’s property “I/O physical address”.

There are some TIA Portal’s data types that are not supported by the driver, and therefore cannot be imported. Non-supported types are:

  • DATE

  • TIME_OF_DAY

  • DATE_AND_TIME

  • LDT

  • UDT

Notes:

  • Technology objects are not imported.

  • UDT within tag table is not imported.

  • IEC_UDCounter works when using its instance DB. It generates error if it is started on a normal DB.

  • Slice access is not supported

  • DTL is read only.

Array

Only one-dimensional arrays are managed. Multidimensional arrays are split in one-dimensional arrays. In this case the name of each one-dimensional array is formed by the name of the multidimensional array and a progressive index.

Structures and UDT (User Data Types)

For structures and UDT used in a DB, two cases must be distinguished: if they contain only members of basic data types (not strings, arrays, or other structures or UDT), they will be imported into the RealTimeDB of the supervisor as structure type variables, by creating their prototype structures; while for structures and UDTs containing complex data types such as arrays, strings or other structures or UDT, a variable structure will be created (along with its template) formed only by the contiguous simple data type elements. The rest of the structure or UDT will be split into individual variables.

For example, assuming we have a UDT composed as follows:

TYPE UDT 1
 STRUCT
     Var1 : BOOL;
     Var2 : WORD;
     Var3 : INT;
     Var4 : ARRAY  [0 .. 6 ] OF BYTE;
     Var5 : INT;
     Var6 : BYTE;
  END_STRUCT ;
END_TYPE

The importer will create a variable of type structure (and its prototype) composed by members Var1, Var2 and Var3, and then it will create three additional variables: the array UDT_1_Var4, the Sign Word UDT_1_Var5 and UDT_1_Var6 of type Byte.

When needing to decrease the number of variables to be imported, it would be a good rule of the thumb to create structures and UDT with composed data types (arry variable) in the last positions, after the simple data type (byte, word, etc.).