How to... create a user defined type (UDT) in TIA Portal

preview_player
Показать описание
This HowTo video shows how to create a user defined type (UDT) in TIA Portal. A basic Valve UDT will be made. An example and explanation of the usage and difference between constant, static and temporary variables are also given.

TIA Portal is a programming environment from Siemens and specially developed for programming the S7-1200/1500 PLC and the new HMI panels.
In TIA Portal it is possible to program in different languages, such as Ladder diagram (LAD), function block diagram (FBD), Statement List (STL), Graph and Structured Control Language (SCL).
In this video the blocks are programmed in Ladder (LAD).

In a series of short tutorials, MA-IT MyAutomation would like to help you get familiar with TIA Portal.

----- Transcription ---------------------------------------------------
This video will explain how to create a UDT and shows an example of Constant, Static and Temp variables.
Unfold the PLC data types folder and add a new data type.
This will be an example of a valve UDT.
First add a commands struct.
Valve commands will be declared inside this struct.
For example an open and close command.
Add other structs such as HMI commands, states and alarms.
The HMI commands will contain the same content as the normal Commands.
The content of the structs can be as extensive as you want.
Four states will be added to the states struct.
Two alarms will be added to the Alarms struct.
All the command, states and alarms of the valve are neatly sorted in a UDT.
Next, is an example of a Constant variable.
This function will multiply an input value times 6.
Constants are data with a fixed value, these cannot be changed during runtime.
Instead of using the value 6 directly into the multiply block, a contant with the value 6 can be used.
The constant times_6 now contains the value 6.
The function is called in OB1, so it can be tested.
6 x 6 = 36. The function still works using the constant.
Next are static and temp variables.
This example will show the difference between the two.
Notice that a function block has the ability to use a static and functions do not.
This is because statics keep their value from cycle to cycle, these values are stored in a corresponding DB.
Temps have to be initialized each cycle, their value is not stored.
The static value will be increased by 1, everytime the input is modified to true.
The temp value will remain 0.
The static value is stored in the DB.
Рекомендации по теме