Home IoT & Hardware PLC and HMI Development with Siemens TIA Portal

PLC and HMI Development with Siemens TIA Portal

By Liam Bee
ai-assist-svg-icon Book + AI Assistant
eBook + AI Assistant $55.99 $38.99
Print $69.99
Subscription $15.99 $10 p/m for three months
ai-assist-svg-icon NEW: AI Assistant (beta) Available with eBook, Print, and Subscription.
ai-assist-svg-icon NEW: AI Assistant (beta) Available with eBook, Print, and Subscription. $10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime! ai-assist-svg-icon NEW: AI Assistant (beta) Available with eBook, Print, and Subscription.
What do you get with a Packt Subscription?
Gain access to our AI Assistant (beta) for an exclusive selection of 500 books, available during your subscription period. Enjoy a personalized, interactive, and narrative experience to engage with the book content on a deeper level.
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
Gain access to our AI Assistant (beta) for an exclusive selection of 500 books, available during your subscription period. Enjoy a personalized, interactive, and narrative experience to engage with the book content on a deeper level.
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Along with your eBook purchase, enjoy AI Assistant (beta) access in our online reader for a personalized, interactive reading experience.
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
ai-assist-svg-icon NEW: AI Assistant (beta) Available with eBook, Print, and Subscription. ai-assist-svg-icon NEW: AI Assistant (beta) Available with eBook, Print, and Subscription. BUY NOW $10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime! ai-assist-svg-icon NEW: AI Assistant (beta) Available with eBook, Print, and Subscription.
eBook + AI Assistant $55.99 $38.99
Print $69.99
Subscription $15.99 $10 p/m for three months
What do you get with a Packt Subscription?
Gain access to our AI Assistant (beta) for an exclusive selection of 500 books, available during your subscription period. Enjoy a personalized, interactive, and narrative experience to engage with the book content on a deeper level.
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
Gain access to our AI Assistant (beta) for an exclusive selection of 500 books, available during your subscription period. Enjoy a personalized, interactive, and narrative experience to engage with the book content on a deeper level.
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Along with your eBook purchase, enjoy AI Assistant (beta) access in our online reader for a personalized, interactive reading experience.
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
  1. Free Chapter
    Chapter 1: Starting a New Project with TIA Portal
About this book
With automation requirements on the rise, Siemens’ TIA Portal development environment is almost a necessity for any automation engineer. The Totally Integrated Automation (TIA) environment helps seamlessly integrate all things automation, from PLC hardware and software design to HMI development. This book helps you understand the tools available in the TIA toolbox and shows you how to write code effectively. The book begins by introducing you to the TIA environment, covering the layout and tools available. Once you’ve got to grips with the environment, you’ll find out how to create hardware to write programs against, including adding IO modules and assigning memory for input and output. Next, you'll develop logic in all of the languages that TIA Portal offers, such as Ladder, Function Block Diagram, and Structured Text (SCL) (note that Statement List is not covered as a deprecated language), as well as the newest language, Cause and Effect (CEM). You’ll also discover how to store standard code in libraries, creating a version control system that is easy to manage and aids standard design. Finally, following the PLC design chapters, you’ll learn how to develop HMI applications in TIA Portal’s latest unified hardware. By the end of the book, you'll be well equipped to use all of the features that TIA Portal V17 offers.
Publication date:
April 2022
Publisher
Packt
Pages
436
ISBN
9781801817226

 

Chapter 1: Starting a New Project with TIA Portal

This chapter covers the core requirements to get started with TIA Portal. This includes the physical layout of the environment and different viewpoints, available tools, adding/configuring devices, and library management. The differences between online and offline views are also covered.

After reading this chapter, programmers should feel comfortable with the basic navigation of TIA Portal and have enough knowledge to be confident about the following:

  • Adding devices to a new project
  • Knowing where instructions and other tools are located
  • Using the project library
  • Using a global library
  • Viewing online and offline views of connected devices

The following topics will be covered in this chapter:

  • Windows and panes – layout of the development environment
  • Getting started with a new project in theProject view
  • The Reference and Details views – tools to aid development
  • Instructions and libraries
  • Online testing environment
 

Windows and panes – layout of the development environment

Before jumping in and creating a project, let's get familiar with the development environment. In TIA Portal Version 17 (V17), there are two different ways to view and use the application, as outlined here:

  • Portal view
    • Allows for the quick setup of hardware
    • Easy navigation of all TIA areas of development
    • Easy access to diagnostic and other online tools
  • Project view
    • More familiar Block & Code view
    • Required for programmable logic controller (PLC) programming
    • Required for access to more advanced setting dialogs

Depending on the view that TIA is running in, this changes the look and feel of the development environment and also where/how objects are interacted with.

When opening TIA Portal for the first time, the Portal view will be presented, as illustrated in the following screenshot:

Figure 1.1 – Portal view

Figure 1.1 – Portal view

The Portal view is TIA's default setting and will be the mode that is in use every time TIA Portal V17 is opened (unless changed in the settings).

This view is best for quickly gaining access to different areas of a project.

When required, TIA will automatically switch from the Portal view to the Project view. The following screenshot shows the Project view:

Figure 1.2 – Project view

Figure 1.2 – Project view

Note

The Project view is required in order to actually program information in program blocks.

Portal view – windows and panes

The Portal view is much more simplistic than the Project view. This view is for high-level tasks such as adding equipment, and the layout of the view does not change much between different areas.

The windows in the Portal view can be split up into three different key areas, as illustrated in the following screenshot:

Figure 1.3 – Portal view key areas

Figure 1.3 – Portal view key areas

The three areas are described in more detail here:

  1. Main menu: These are the top-level areas of TIA Portal. Nearly all aspects of development fall into one of these categories.
  2. Submenu: These are the navigational items that relate to the main menu area. For example, switching between Start and PLC programming would change the options available in this menu.
  3. Activity area: This is the area in which interaction with selected processes occurs, such as creating a new project or navigating PLC programming blocks.

    Note

    Be careful in the submenu area of the Portal view! In some locations (such as PLC programming), a device must also be selected. It's very easy to accidentally leave the last selected item when returning. Make sure to check which device is active when in these types of menus!

Project view – windows and panes

The Project view is a little more involved than the Portal view. It is not as simplistic, and the menus and navigation can change depending on which area of the project is in view.

Note

The Project views shown in Figure 1.4 are shown with the default layout. In TIA Portal, windows/panes can be moved around in the Project view to create a custom environment.

You can select the default layout by navigating to Window | Default Window Layout. The screen should then look like this:

Figure 1.4 – Project view key areas

Figure 1.4 – Project view key areas

The four key areas are outlined here:

  1. Project tree: This is the pane in which navigation of devices and associated objects (such as function blocks) is done. The addition of new devices and objects is also started here.
  2. Main activity area: This area is where activities such as PLC programming and network configuration are completed.
  3. Supportive tools: This pane contains a collection of tabs that offer tools relative to the activity that is being undertaken. The tabs that are offered also depend on the current activity.
  4. Properties, Info, and Diagnostics pane: This pane changes often and has a multi-tab approach to display information in different categories. During development, this pane will most often be displaying information such as Compilation Status and Properties, which allow the setup of different objects. Details view pane—mini-project tree that only shows details of the object currently selected in the main project tree.
  5. Details view: This area lists child objects when an object is selected in the project tree. It is also a useful method of exploring variables within a data block or tag list without having to open the object itself.
 

Getting started with a new project in the Project view

The Project view is the view that most programmers will spend their time in. While the Portal view has its advantages in simplicity, the Project view is a necessity and offers methods to do almost everything that the Portal view can do.

With this in mind, creating a brand-new project in the Project view may be easier for people new to TIA Portal as it follows similar steps to other development platforms.

Note

Remember, on a clean install with default options, TIA Portal will open in the Portal view. In order to get into the Project view, click the text (Project view) in the bottom left of the screen to change modes.

This shows the view that will be switched to when clicked, not the current view.

Starting a new project

When in the Project view, TIA expects a project to be available in order to show anything project-related. At this point, though, no project is available, as none has been created.

A new project can be started by clicking the New project icon in the toolbar at the top of the window, as illustrated in the following screenshot:

Figure 1.5 – New project in the Project view

Figure 1.5 – New project in the Project view

Once the New project icon has been clicked, the following dialog box is presented:

Figure 1.6 – Create a new project dialog box

Figure 1.6 – Create a new project dialog box

This allows the setting of the project name, save path, and author, as well as some comments about the project.

Once the Create button has been clicked, TIA Portal will create (and save) the new project.

Changes to the project tree

Now that a project has been loaded into TIA (the one just created), the project tree is updated with additional objects that relate to the project, as shown in the following screenshot:

Figure 1.7 – Project tree differences when a device is added (left) compared to no device added (right)

Figure 1.7 – Project tree differences when a device is added (left) compared to no device added (right)

These objects relate only to this project and may affect any devices or further objects that are added to the project (Security Settings, for example).

Adding devices

In the Project view (once a project has been opened), a device such as a PLC can be added by double-clicking the Add new device option in the project tree.

By double-clicking the Add new device option, a new dialog box will open, allowing the selection of supported devices. This is illustrated in the following screenshot:

Figure 1.8 – Add new device

Figure 1.8 – Add new device

Once a suitable device has been selected and a name assigned, the OK button can be clicked, and the new PLC (or other hardware) will appear in the project tree, as illustrated in the following screenshot:

Figure 1.9 – Project tree with new device expanded

Figure 1.9 – Project tree with new device expanded

If the new device is expanded, all of the available child objects that are relative to the device are displayed.

Note

This is a necessary step to complete before software programming takes place.

The Programming Blocks object (where software such as ladder logic is written) is not available until a device has been added.

Configuration of devices

Every device that is added in TIA Portal will require some basic level of configuration, such as setting the network Internet Protocol (IP) address or adding slave modules.

This can be accessed by right-clicking the new device in the project tree. The Properties item will be available at the bottom of the context menu.

The Properties dialog will open—this is where the configuration of the device can take place, as illustrated in the following screenshot:

Figure 1.10 – Configuration dialog

Figure 1.10 – Configuration dialog

The same configuration settings can also be accessed by opening the device configuration from the project tree. Once the Device view opens, the properties are displayed in the Properties, Info, and Diagnostics pane, as illustrated in the following screenshot:

Figure 1.11 – Configuration dialog via the Device view

Figure 1.11 – Configuration dialog via the Device view

This pane then allows for the configuration of the device's properties and options.

 

The Reference and Details views – tools to aid development

TIA portal has some handy views that aren't immediately obvious as to their usefulness. Two views are particularly useful, as outlined here:

  • Reference project view
    • Allows TIA to open a second project in Read-Only mode, to be used as a reference or guide to the current project
    • Blocks and other objects can be copied from the reference project
  • Details view
    • Offers a quick-peek-style view of the selected object in the project tree
    • Allows the selection of internal object data for dragging and dropping into the programming view

Both of these views appear as panels on the left-hand side of the TIA Portal view.

Note

By default, TIA Portal has the Reference projects panel disabled. Both panels can be enabled (or disabled) by clicking View from the top menu and then checking the panels to be made visible.

Reference projects

Making use of a previous project as a template is a great way to maintain consistency between projects. Loading two instances of TIA Portal should be avoided if possible as TIA Portal can be resource-hungry; lighter development machines may lack the resources to maintain two or more instances of TIA Portal. You can see the Reference projects panel in the following screenshot:

Figure 1.12 – Reference projects panel

Figure 1.12 – Reference projects panel

With reference projects, multiple projects can be open at the same time in Read-Only mode.

Reference projects can be opened and closed via the buttons immediately below the title banner.

Once the project is expanded in the reference project view, it resembles exactly the same view as the project tree, with all objects available as they would be if the project were to be opened normally.

Once a reference project is open and expanded, items within it (such as program blocks) can be opened and read as normal; however, a gray hue will appear on the object icon to indicate it is a reference object, as illustrated in the following screenshot:

Figure 1.13 – Reference object indication example

Figure 1.13 – Reference object indication example

The difference is very subtle—ensure that the correct blocks are being worked with (although it is not possible to write to a reference block).

Uses of reference projects

There are many different reasons why a reference project may be used to aid development. In most cases, a reference project is used to serve as a guide; however, the following functionalities are also available:

  • Copying information between the reference project and main project: Objects from the reference view can be copied and pasted into the main project tree or dragged and dropped. This is a useful way to move blocks quickly between two projects.
  • Comparison of objects: Objects can be compared between the reference project and the main project.mp file. This is a useful feature that allows programmers to quickly check the differences between two offline projects.

    Note

    To compare the reference project with the main project, right-click on an object and select Quick compare | Select as left object. Then, select the object to compare with and right-click, and then select Quick compare | Compare with <previously selected left object>.

    TIA Portal will then compare the objects and display any differences.

Details view

The Details view pane is best described as a mini-project tree that shows only the child objects of the currently selected object in the project tree.

This is particularly useful when programmers want to drag and drop objects into the main activity area, as in the following screenshot example:

Figure 1.14 – Example of Project tree and Details view displaying the same child objects

Figure 1.14 – Example of Project tree and Details view displaying the same child objects

Note

Not all options are available for an object when selected in the Details view. For example, an object can be opened, but cannot be renamed from the Details view pane.

Right-click options are also unavailable.

Uses of the Details view

The Details view pane is only capable of showing child objects and will not show any information when there are no child objects available.

The Details view pane would typically be used to do the following:

  • Preview child objects in a selected parent object.
  • Directly open child objects in a selected parent object.
  • Check basic details such as the block number or comments assigned to objects.

Overview view mode

The Details view pane also works in the Overview view mode, behaving in the same manner as if the object had been selected from the project tree directly.

The Overview view mode is similar to the Details view but uses the main activity area to display the results and shows all objects within the previously opened object.

The Overview view mode is entered by clicking the persistent Overview button at the bottom left of TIA Portal.

Note

Users of SIMATIC Manager (Siemens older development software) may find the Overview mode familiar when in the Details view (using the tabs at the top of the view). This displays blocks in a familiar way to how SIMATIC Manager displays blocks in the Details view.

 

Instructions and libraries

On the right-hand side of TIA Portal are the Tool panes used to develop application logic. Here, we find two important tabs called Instructions and Libraries, which are outlined in more detail here:

  • Instructions
    • Contains instructions for use when developing code
    • Contains selection methods for selecting different versions of groups of instructions
    • Contains any optional package instructions that have been loaded into TIA Portal
  • Libraries
    • Contains access to the project library
    • Contains access to global libraries

Instructions

The Instructions tab is the area in TIA Portal where programming instructions are stored. You can see an overview of the Instructions pane here:

Figure 1.15 – Instructions pane

Figure 1.15 – Instructions pane

There are a lot of items here that are organized into categories (folders).

Some categories contain a selectable version. This allows programmers to use previous versions of operations/instructions in a newer environment if required by the project. The default version will always be the most recent, and it is not advised to change it unless there is a specific reason to do so.

Adding instructions from the Instructions tab

Instructions are the objects that are used in the programming window—the building blocks of the logic. These are used together to build the logical part of the program. An example is shown in the following screenshot:

Figure 1.16 – Example of instruction added from the Instructions pane

Figure 1.16 – Example of instruction added from the Instructions pane

Instructions are easily added to the program block in use through one of the two following methods:

  • Double-clicking on the instruction in the Instructions pane. This will add the instruction to the current location in the Program block window.
  • Dragging the instruction from the Instructions pane and placing it in the desired location in the Program block window.

Box instructions

A third option is also available for box instructions. Adding an empty box instruction (from the general category) will result in the following being added to the Program block window:

Figure 1.17 – Empty box instruction

Figure 1.17 – Empty box instruction

?? can be replaced with the name of an instruction that uses the box notation, such as the previously shown MOVE instruction, as illustrated in the following screenshot:

Figure 1.18 – Example of an empty instruction box being defined as a MOVE instruction

Figure 1.18 – Example of an empty instruction box being defined as a MOVE instruction

Adding favorite instructions

Favorites can be added to a Favorites bar in both the Instructions pane and in the Program block window below the Block interface pane, as illustrated in the following screenshot:

Figure 1.19 – Two instances of the Favorites bar

Figure 1.19 – Two instances of the Favorites bar

Instructions can be added to the Favorites bar by simply dragging and dropping them into place. There are some limitations to the Favorites bar, as outlined here:

  • Only instructions from the basic instructions set can be added.
  • Favorites cannot be re-organized once placed; however, they can be slotted between existing items. This means that if an instruction needs to be moved, it must be deleted and re-added.

Libraries

The library feature in TIA Portal is an extremely well-developed and feature-rich part of the development environment but is often underused and not appreciated by programmers.

Library management allows programmers to keep versions of program blocks so that they can be distributed throughout a project or shared between other projects. This offers the ability to use consistent and pre-tested code, wrapped up in a very well-controlled environment.

Note

It's best to start using libraries right at the beginning of a project (and throughout its life cycle) when defining a project structure is easier.

The Libraries tab consists of the following two areas:

  • Project library
    • This contains Types and Masters that are relative to the current project
    • Can only be used by the currently opened project
  • Global library
    • This also contains Types and Masters that are used to update or populate the project library
    • Can be updated via the project library

      Types and Masters

      Throughout the library system in TIA Portal, two common terms are used: Types and Masters (master copies). These refer to how objects placed inside the library behave.

      Types: Program blocks placed in the Types folder will be explicitly connected to the project library. This means that they cannot be edited without first confirming the requirement to be edited. If a type is edited, it must be saved as a new version; TIA Portal will manage this appropriately.

      Masters: Any object placed in the master copies will be a copy of the object placed. Unlike Types, these serve as templates and can be edited at will in the project without updating the library. If more than one object is placed in the Master copies folder at once, TIA Portal will group them together as a single object to ensure they are copied back together.

Project library

The Project library is a locally held collection of program blocks that directly relate to the current project, as illustrated in the following screenshot:

Figure 1.20 – Example of typed objects and master copies

Figure 1.20 – Example of typed objects and master copies

This library is used to help programmers ensure that the program blocks used throughout the project are strictly version-controlled, or to provide templates in order to get started with a program block quickly.

The Libraries tab is found on the right-hand side of the TIA Portal application, below the Instructions tab.

Blocks that are used in the project library can only be opened if they are instantiated in the project itself. This means that in order to edit or open a project library object, it must at least exist in the project tree.

Note – Master Copies

Master copies cannot be opened at all from the Libraries pane and must be copied (dragged) into the project tree before an object can be opened.

Types

Types are version-controlled program blocks. Only function blocks, functions, and user-defined types (UDTs) can exist as a type in a library.

Types can be in one of the following two modes:

  • Released
  • In test

The following screenshot shows an example of a program block in test:

Figure 1.21 – Example of a program block in test

Figure 1.21 – Example of a program block in test

When a type is released, it has been added to the library, versioned, and is now available to be used in the project tree. At this point, it is protected and cannot be edited without creating a new version.

When a type is in test, it is available to be edited, versioned, and then committed back to the library. A type must be put into test to create a new version. The test version can be downloaded into the PLC via the project tree so that tests on the new version can be performed.

Editing Library Blocks (In Test)

The block to be edited must exist in the project tree before it can be edited. A block can be edited by right-clicking and choosing Edit type in the Libraries pane.

The project library should be used in order to release multiple in-test blocks at once. The status indication in the library will show the following symbols for different types of inconsistencies between the project library and project tree:

  • Multiple inconsistencies: More than one object is in test (including dependents)
  • Non-Default version instantiated: The project tree has an in-test version instantiated
  • Default dependent not used: The default version of this block does not use the same default version of a dependent block (inconsistent versioning)
  • Consistent: No inconsistencies detected

In order for library objects to be used correctly, all items should be consistent unless testing is actively occurring.

There is more than one method for releasing versions, as outlined here:

  • Via the yellow information banner at the top of a typed block that is in test
  • Via the right-click menu when clicking an object in test in the project library

When either is clicked, the following dialog box is presented:

Figure 1.22 – Release type version dialog box

Figure 1.22 – Release type version dialog box

In this dialog box, information about the type can be entered, including an author and a comment.

The version number will automatically increase the minor revision number; however, this can be overridden to make larger version increments.

Checkboxes at the bottom of the dialog box allow programmers to change the behavior of the release.

Deleting unused types is a good way of keeping the project library clean and easy to use. Setting dependent types to edit mode will be pre-selected if the block being released has dependent types that are not in test yet (these dependent blocks will need to be updated to maintain library consistency).

Discarding Changes

Be careful! Clicking Discard changes will immediately delete the test version, without confirmation!

Master copies

Master copies work very differently from types. While master copies still reside in the library, they are not version-controlled, and modifying a master copy does not cause other blocks to need to adapt.

Master copies are also not restricted to just function blocks, functions, and UDTs. Other types—such as data blocks, tag lists, and even groups of objects and folders—can have master copies.

Editing Master Copies

Unlike types, master copies cannot be edited at all. In order to update a master copy, a new instance of the object must replace it. This can be done by simply deleting the existing version and dragging the new version (with the same name) into the Master copies folder.

Usage

A master copy serves as a template and can simply be dragged from the Libraries pane into the project tree in the position required. If the object dragged into the project tree contains more than one object (is a group of objects), all of the objects will be unpacked into their single instances, retaining any structural layout.

Icons

Different icons for master copies symbolize different meanings, as outlined here:

  • Standard singular objects: Objects retain their normal icons
  • Group of data blocks: A folder containing only data blocks
  • Group of function blocks: A folder containing only function blocks
  • Group of mixed objects: A folder containing more than one type of object
  • Empty folder: A folder/group with no content (useful for templating project-tree layouts)

Global library

The global library is a library that can be used by more than one project. The global library behaves slightly differently from the project library, but still maintains a familiar approach to updating and maintaining objects within it.

Libraries Pane

Just as with the project library, the global library is found on the left-hand side of TIA Portal in the Libraries pane.

Creating a new global library

Global libraries exist outside of the project and can be saved in different directories from the active project. To create a new global library, click the icon.

A familiar dialog box will open that is similar to the one used to create a new project, as shown here:

Figure 1.23 – Create new global library dialog box

Figure 1.23 – Create new global library dialog box

By default, global libraries are saved in the Automation folder; however, this can be changed to any location.

It's important to note the version number of the global library—the version of TIA Portal must match in order to use the library. If an older version library is opened in a newer version of TIA Portal, a conversion to the new version takes place. You cannot downgrade TIA Portal libraries to lower versions.

Opening a global library

Just as with a project, a global library must be browsed for and opened. This can be done in the same place as when creating a new global library, by clicking the icon.

A new dialog will open that allows a global library to be browsed for and opened, as illustrated in the following screenshot:

Figure 1.24 – Open dialog for a global library

Figure 1.24 – Open dialog for a global library

If a global library is to be edited, remember to uncheck the Open as read-only checkbox. If this is left checked, objects can be read from the global library but cannot be written to the global library.

Note

A project doesn't have to be opened to open a global library; however, without a project, the use of a global library is limited!

Using a global library

Before any objects in the global library can actually be used, it is important to understand the differences between a global library and a project library. Almost all of the differences relate only to types, with master copies still behaving as templates.

If a type is required from a global library, it will automatically be added to the project library if dragged into the project tree, as will all of its required dependents.

Upgrading a global library

A global library is easily updated from a project library by right-clicking the object to be upgraded in the project tree and selecting Update types | Library. A new dialog will open, as illustrated in the following screenshot:

Figure 1.25 – Updating types in a library

Figure 1.25 – Updating types in a library

From the dropdown, the open (and writable) global library can be selected. When OK is clicked, the global library will be updated with all new versions.

This also works the other way around, for updating project library types from the global library.

The global library must be saved after updating by clicking the Save icon () in the Global library pane.

Note

Checkbox options should only be selected if there is an explicit requirement to do so. It's good practice to keep previous versions available in the global library to support older projects as time and versions progress.

Periodically, very old versions may be removed once no projects are making use of them (the project library will still contain the relative version, though, if one in use is removed from the global library).

 

Online testing environment

The Testing tab on the right-hand side of the TIA Portal application contains tools that are used only when a device is connected via the Go online function.

If no device is connected to, the Testing tab will simply display No online connection in the central processing unit (CPU) operator panel, and other functions are not available.

The Go online function can be found on the top menu bar—it looks like this:

Figure 1.26 – Go online function

Figure 1.26 – Go online function

Once clicked, a connection dialog will open that allows CPUs and other devices to be searched for and connected to, as illustrated in the following screenshot:

Figure 1.27 – Go online dialog that allows connection to devices

Figure 1.27 – Go online dialog that allows connection to devices

In the Go online dialog (Figure 1.27), devices can be searched for and connected to. Different interfaces can be selected from drop-down lists, and different subnets can be specified if required. Once the desired device is found, highlight it and click GoOnline. This will then connect the development environment to the device.

CPU operator panel

Once online, the Testing tab—specifically, the CPU operator panel—now contains data (if connected to a CPU in the project), as illustrated in the following screenshot:

Figure 1.28 – CPU operator panel once online and connected to a CPU

Figure 1.28 – CPU operator panel once online and connected to a CPU

These controls allow the CPU (PLC) to be stopped via the STOP button, memory reset via the MRES button, and placed back in to run via the RUN button.

The status of the CPU can also be read in this panel via the RUN/STOP, ERROR, and MAINT status LEDs. This is useful if the CPU is not local to the programming device running TIA Portal (connected via a virtual private network (VPN) connection, for example).

Call environment

The call environment is an important part of viewing and monitoring online code. In TIA Portal, a program block may be called more than once and via a different call environment (called by a different parent or instance). The Call environment panel in the Testing tab allows the call path to be defined, as illustrated in the following screenshot:

Figure 1.29 – Call environment panel

Figure 1.29 – Call environment panel

Figure 1.29 demonstrates a call path to a program block. When the Change … button is pressed, a list of available call paths is displayed. A call path can be selected, and TIA Portal will then monitor the selected call path.

Note – SIMATIC Manager

Programmers who have worked with Siemens SIMATIC Manager may remember that multiple calls to the same function block on the same call path mean that only the first instance is available to be monitored. TIA Portal rectifies this behavior by also allowing instances to be selected.

Breakpoints

Breakpoints are used to pause the execution of the CPU in order to help debug programming logic. They are only available in Structured Control Language (SCL) and Statement List (STL) languages and are not available on all CPUs.

Warning – Outputs

If a breakpoint halts the execution of the CPU, outputs may remain in their current state until the breakpoint is released! This could cause damage to assets or personnel. It is important to understand the risks associated with using breakpoints in a live equipment environment.

Breakpoints and their usage are advanced topics that relate only to textual languages. Using breakpoints effectively is covered in more detail in Chapter 5, Working with Languages in TIA Portal.

Call hierarchy

When in offline mode (not online with a CPU), the Call hierarchy pane always displays No call path available.

When in online mode with a CPU and actively monitoring a program block via the Monitor function , the Call hierarchy pane displays the relative call path to the block being monitored, as illustrated in the following screenshot:

Figure 1.30 – Example of an object called by OB1

Figure 1.30 – Example of an object called by OB1

Figure 1.30 shows an example of a function block that is called by Main [OB1]. Should the block being monitored have multiple parents, the entire call hierarchy will be displayed.

 

Summary

This chapter has covered the required areas to start a project with a good understanding of TIA Portal's tools and layout, environment setup, and library management systems.

Understanding where and how to use the tools that TIA Portal offers is important. As a further learning exercise, it is recommended that users familiarize themselves with these tools. It is important to remember that TIA works best when all of the tools are utilized together.

The next chapter expands on the inner workings of TIA Portal , on how objects are created, and how these fit together to create a software structure of a program in a hierarchical manner.

About the Author
  • Liam Bee

    Liam Bee has worked in automation for over 16 years, after starting his career at 16 years old as an instrument technician in the water industry. He began his automation journey by maintaining PLCs and the instruments connected to them. He found very early on that he had an interest in PLCs and automation, taking the time to learn PLC programming in his own time, as well as exposing himself as much as possible to automation while working. After 8 years of working in maintenance, Liam started his own side business, providing bespoke controls using lower-range PLC solutions. This experience proved invaluable to his progression; he learned quickly, often through failure, and his knowledge of control design improved significantly. 12 years into his career, he moved roles again; this time, he was looking for something to fill knowledge gaps and target Siemens as he was yet to use Siemens extensively. Liam started at Aquabio Ltd and quickly found himself immersed in Siemens SIMATIC Manager and TIA Portal. Over the next 3 years, he worked hard to understand Siemens' tools and development environments, calling on knowledge from other PLC environments that he had previously worked with. Over his years working with automation, he has learned many different languages and development environments. He has worked with Siemens, Allen Bradley, Schneider, Mitsubishi, and a host of other PLC platforms, all of which have helped shape the design concepts that he uses today. Liam has also taught himself computer programming languages such as VBA, VBS, VB.NET, C#, Java, and more. Closing the space between IT and industrial automation is important as time moves forwards and he has always tried his hardest to be at the forefront of innovation.

    Browse publications by this author
PLC and HMI Development with Siemens TIA Portal
Unlock this book and the full library FREE for 7 days
Start now