laitimes

Siemens Portal: Using PLC Data Type (UDT)

author:Jicheng PLC classroom

PLC data types (UDTs) are self-definable data structures that can be used multiple times in a program. This structure can contain multiple elements of different data types. During the declaration of PLC data types, you can define the data types for individual elements.

If assembly data logging of various data types is required, the PLC data type is frequently used and will be processed from different points in the program. For example, this data can be:

  • Data logging for material tracking
  • The set of parameters used for the motor setup
  • formulation

There are several advantages to using the PLC data type:

  • PLC data type elements can also be indirectly addressed, which means that the address is variable and will not be computed until runtime.
  • Variables based on the PLC data type inherit all the properties of the PLC data type. If a change is made to a PLC data type, all variables based on this PLC data type are automatically modified.
  • The use of uniform symbolic representations improves program readability because the names of the individual elements of the PLC data type are displayed in the program.
  • Get the best use of the S7-1500 CPU's high performance.
  • The PLC data type can be transferred as a complete structure for block calls.
  • Since fewer parameters need to be provided, the call interface is simplified.

STEP 7 V5.x 中的操作步骤

STEP 7 V5.x already allows users to create a data record as a structured variable using either the STRUCT data type or the PLC data type (UDT). However, due to the use of symbolic addressing, there is a slight impact on performance.

Most of the declarations in the block are implemented in an anonymous structure. The block itself is then programmed to transfer the value of the structure as an argument, and the calculated value is copied back to the structure. This makes it possible to pass the block number and use absolute addressing in the block. The number of parameters that need to be provided is usually large. The actual data is stored in data blocks, and the calculated values are transferred to other blocks. However, there is no symbolic representation available when transferring block variables.

STEP 7 TIA Portal 中的编程示例

You can assign parameters and arguments to PLC data types. This means that there is no need to declare each individual parameter. If the block has input parameters of a PLC data type, a variable with the same PLC data type must be passed as an argument.

The following example illustrates the invocation and parameter assignment of a function block (FB) using two parameters:

Siemens Portal: Using PLC Data Type (UDT)

In the global data block, the PLC data type is used. You can specify a PLC data type directly as a data type for a data block or as a variable in a data block.

To create a global block for this, follow these steps:

Siemens Portal: Using PLC Data Type (UDT)

In a function block call, the variable interconnects the shapes that participate in the global data-block "DB_MaterialBuffer".

Siemens Portal: Using PLC Data Type (UDT)
Siemens Portal: Using PLC Data Type (UDT)
Siemens Portal: Using PLC Data Type (UDT)

The material data was moved in the global block "DB_MaterialBuffer".

Disclaimer: This article is transferred from the Internet, the copyright belongs to the original author, if it involves the copyright of the work, please contact us to delete it in time, thank you!

How can I get more information about electrical hot topics?

Here's how to do it!

Siemens Portal: Using PLC Data Type (UDT)

Read on