Sie sind auf Seite 1von 4

Introduction to software units (S7-1500)

Introduction to software units

Programming with software units


With the help of software units, you can subdivide your user program into individual program units,
which you can edit and download independent of each other. For this purpose a new "Software Units"
folder is provided in the project tree in which you can create and program your software units.
The following figure shows the "Software units" folder in the project tree:

Each software unit contains the following main elements:


• Relations: By means of the relational table, you can set up access from your software unit to the
following objects:
o Published blocks and PLC data types of other software units
o Global data blocks outside of the software unit
o Technology objects
• "Program blocks" folder: You create the program blocks (organization blocks, function blocks, func‐
tions, data blocks) in this folder.
• "PLC tags" folder: You create the PLC tag tables, PLC tags and user constants in this folder.
• "PLC data types" folder: You create the PLC data types in this folder.
• PLC supervisions and alarms: Opens the alarm and supervision editor.
• PLC alarm text lists: Opens the text lists editor.

Creation of the user program inside software units represents an extension of the existing program‐
ming options. This means you are free to choose which program sections you want to create inside
software units and which you want to create outside of software units.

Note
Note the following information when using software units:
• You can use software units with all versions of the S7-1500 CPU with a firmware version V2.6
and higher.
• You can use up to 255 software units per CPU.
• The "Optimized block access" attribute is selected for all program blocks of a software unit and
cannot be disabled.
• If you have created an online backup for a device that supports software units, you cannot use
this backup for a device that does not support software units.

-1-
Introduction to software units (S7-1500)

• The program information contains information about all blocks, regardless as to whether or not
they were created in a software unit.
• The data blocks and tags from software units are also visible in a device proxy and can therefore
be exported and imported. It is irrelevant whether the data blocks are published or not.
• OPC UA client interface: Configuration data blocks that are generated from OPC UA client inter‐
faces by the system ("<Name of the client interface_Configuration>") are always created outside
of the software units. If you want to access them you can create a relation to these client interfa‐
ces. To do so, use the "Data block outside of the software unit" option as relation type.

Program structure
Regardless of whether you want to split an existing program into software units or start a new project,
you should plan the program structure at the start. A practical division of your user program into soft‐
ware units can be based on the following criteria, for example:
• Functional and technological units
In software units, you can create functional or technological units that you can edit and load inde‐
pendently of each other. If the blocks of an existing program have already been divided into groups,
these groups may result in useful software units.
• Expected frequency of changes
Another possibility for splitting is the expected change frequency of program sections. To create
units that can be loaded as independently of each other as possible, you should create your own
software units for program sections with different change intervals. In one software unit, you can
create blocks with basic functions that rarely need to be changed and include blocks that need to
be changed frequently for commissioning in other software units. This division can also facilitate
troubleshooting.
• Editor
Splitting your program based on editors can significantly reduce the work required for coordination.
In order to further optimize the cooperation of the project staff, you can use software units in con‐
junction with multiuser engineering.
• Widest possible encapsulation of the software units
To enable you to edit and load the software units independently of one another, there should be no
cross-relationships between the software units. Therefore, only use published program elements
and relations if this is really necessary. Try to encapsulate the individual software units as far as
possible.
You can also mix the individual criteria or create your own criteria for the division. However, you
should consider the encapsulation of the software units as a main criterion in order to derive the
greatest possible benefit from the software units.
See also: Possible program structures with software units

Using software units for shared commissioning


By structuring your user program into software units, you also simplify the commissioning of the user
program on a PLC by several users. Such structuring and the division into different areas of responsi‐
bility enables changes to different software units to be loaded into the PLC independently. The TIA
Portal ensures that changes made by other users are not overwritten. In most cases, this eliminates
the need to synchronize the user program via the PLC and accelerates the loading process to the
PLC. Note the requirements for loading software units.
You can find additional information in the following sections.
• Downloading software units

• Introduction to Multiuser Commissioning

-2-
Introduction to software units (S7-1500)

Data access
You can create the following program elements in software units:
• Blocks (OBs, FBs, FCs and DBs)
• PLC tag tables and PLC tags
• PLC data types

To allow these program elements to be accessed outside the respective software unit, they need to
be published. However, this is not possible for organization blocks and PLC tags. They can only be
accessed in the software unit in which they are defined.
In observation and force tables, you can access all PLC data, regardless of its position or publication
status.
To access the FBs, FCs, global DBs and PLC data types of other software units, these must be pub‐
lished and there must also be a relation to the respective software unit. You can also use relations to
access global data blocks and technology objects that are located outside of software units.
The following figure shows the possible data accesses between programs inside and outside software
units:

-3-
Introduction to software units (S7-1500)

See also
Creating a PLC program in software units (S7-1500)

-4-

Das könnte Ihnen auch gefallen