Professional Documents
Culture Documents
Siemens
TIA Portal / TIA Add-Ins / V1.1 Industry
Online
https://support.industry.siemens.com/cs/ww/en/view/109783096 Support
Legal information
Legal information
Use of application examples
Application examples illustrate the solution of automation tasks through an interaction of several
components in the form of text, graphics and/or software modules. The application examples are
a free service by Siemens AG and/or a subsidiary of Siemens AG ("Siemens"). They are
non-binding and make no claim to completeness or functionality regarding configuration and
equipment. The application examples merely offer help with typical tasks; they do not constitute
customer-specific solutions. You yourself are responsible for the proper and safe operation of the
products in accordance with applicable regulations and must also check the function of the
respective application example and customize it for your system.
Siemens grants you the non-exclusive, non-sublicensable and non-transferable right to have the
application examples used by technically trained personnel. Any change to the application
examples is your responsibility. Sharing the application examples with third parties or copying the
application examples or excerpts thereof is permitted only in combination with your own products.
The application examples are not required to undergo the customary tests and quality inspections
of a chargeable product; they may have functional and performance defects as well as errors. It is
your responsibility to use them in such a manner that any malfunctions that may occur do not
result in property damage or injury to persons.
Disclaimer of liability
Siemens shall not assume any liability, for any legal reason whatsoever, including, without
limitation, liability for the usability, availability, completeness and freedom from defects of the
application examples as well as for related information, configuration and performance data and
any damage caused thereby. This shall not apply in cases of mandatory liability, for example
under the German Product Liability Act, or in cases of intent, gross negligence, or culpable loss of
life, bodily injury or damage to health, non-compliance with a guarantee, fraudulent
non-disclosure of a defect, or culpable breach of material contractual obligations. Claims for
damages arising from a breach of material contractual obligations shall however be limited to the
© Siemens 2022 All rights reserved
foreseeable damage typical of the type of agreement, unless liability arises from intent or gross
negligence or is based on loss of life, bodily injury or damage to health. The foregoing provisions
do not imply any change in the burden of proof to your detriment. You shall indemnify Siemens
against existing or future claims of third parties in this connection except where Siemens is
mandatorily liable.
By using the application examples you acknowledge that Siemens cannot be held liable for any
damage beyond the liability provisions described.
Other information
Siemens reserves the right to make changes to the application examples at any time without
notice. In case of discrepancies between the suggestions in the application examples and other
Siemens publications such as catalogs, the content of the other documentation shall have
precedence.
The Siemens terms of use (https://support.industry.siemens.com) shall also apply.
Security information
Siemens provides products and solutions with Industrial Security functions that support the secure
operation of plants, systems, machines and networks.
In order to protect plants, systems, machines and networks against cyber threats, it is necessary
to implement – and continuously maintain – a holistic, state-of-the-art industrial security concept.
Siemens’ products and solutions constitute one element of such a concept.
Customers are responsible for preventing unauthorized access to their plants, systems, machines
and networks. Such systems, machines and components should only be connected to an
enterprise network or the Internet if and to the extent such a connection is necessary and only
when appropriate security measures (e.g. firewalls and/or network segmentation) are in place.
For additional information on industrial security measures that may be implemented, please visit
https://www.siemens.com/industrialsecurity.
Siemens’ products and solutions undergo continuous development to make them more secure.
Siemens strongly recommends that product updates are applied as soon as they are available
and that the latest product versions are used. Use of product versions that are no longer
supported, and failure to apply the latest updates may increase customer’s exposure to cyber
threats.
To stay informed about product updates, subscribe to the Siemens Industrial Security RSS Feed
at: https://www.siemens.com/industrialsecurity.
Table of Contents
Legal information ......................................................................................................... 2
1 Introduction ........................................................................................................ 4
1.1 Boundary Conditions ............................................................................ 4
1.2 Restrictions ........................................................................................... 4
2 Preparations ....................................................................................................... 5
2.1.1 Installing the Application....................................................................... 5
2.1.2 Integration into the Project ................................................................... 5
3 Testing a TIA Add-In .......................................................................................... 7
3.1.1 Providing the Objects to be Tested ...................................................... 7
3.1.2 Starting the Test ................................................................................... 8
3.1.3 Defining Breakpoints ............................................................................ 9
3.1.4 Simulation of the UpdateUI delegate timeout..................................... 10
3.1.5 Additional Options .............................................................................. 10
3.1.6 Final Test ............................................................................................ 11
4 Appendix .......................................................................................................... 12
4.1 Service and support ........................................................................... 12
4.2 Industry Mall ....................................................................................... 13
4.3 Links and literature ............................................................................. 13
4.4 Change documentation ...................................................................... 13
© Siemens AG 2022 All rights reserved
1 Introduction
The TIA Add-In Tester allows you to test a TIA Add-In during development without
having to install & activate it in the TIA Portal. The TIA Add-In to be tested is
loaded in the TIA Add-In Tester as an Openness Application, connected to the TIA
Portal, and executed.
attached
TIA Add-In Tester
executes
*.addin
Using the TIA Add-In Tester, it is possible to set breakpoints in the TIA Add-In. The
code of the TIA Add-In can, therefore, be run through line by line, and errors can
be identified before it is installed and activated in the TIA Portal.
© Siemens AG 2022 All rights reserved
Note The following describes how to set up and use the TIA Add-In Tester in Microsoft
Visual Studio. The use of other development environments has not been tested,
but is possible, in principle.
1.2 Restrictions
The permissions of a TIA Add-In and VCI providers cannot be simulated.
2 Preparations
The TIA Add-In Tester can be integrated into your own TIA Add-In project in just a
few steps. After the initial setup, testing of a TIA Add-In can be started by simply
"starting" the project within Visual Studio.
Download the TIA Add-In Tester from the entry page (see \2\) and extract the zip
file to a local folder.
The following steps integrate the TIA Add-In Tester into your own TIA Add-In
project:
1. Open the project properties of the Add-In in the Solution Explorer.
2. Switch to the "Debug" option.
3. In the "Start external program" field, add the complete path to the file
"TiaAddInTester.exe" in the unpacked local folder from section 2.1.1.
4. In the "Command line arguments" field, add the attribute "--path" followed by
the full path of the TIA Add-In to be tested. At this point, specify the path of the
© Siemens AG 2022 All rights reserved
*.addin file that is generated when using the TIA Add-In Publisher.
5. In the "Working Directory" field, add the full path of the unzipped local folder
from section 2.1.1.
6. Add the following method to all classes in which the TIA Add-In class
"ContextMenuAddIn" is inherited:
public IEnumerable<IEngineeringObject> GetSelection(string label) { }
This method is executed by the TIA Add-In Tester to generate the selection for
the MenuSelectionProvider. Return the Openness objects to be tested here. In
the Click and Update delegate, these objects are then available via
menuSelectionProvider.GetSelection().
6
© Siemens AG 2022 All rights reserved
switch (label)
{
case "Item 1":
var myPlc = project
.Devices[0]
.DeviceItems.FirstOrDefault(plc => plc.Name == "MyPlc")
.GetService<SoftwareContainer>().Software as PlcSoftware;
// return the program blocks folder
return myPlc?.BlockGroup.Blocks;
case "Item 2":
// return all Startdrive devices in the project
return project.Devices
.Where(x => x.DeviceItems.Any(y => y.GetService<DriveObjectContainer>() != null));
default:
return Enumerable.Empty<IEngineeringObject>();
}
}
During the first execution of the TIA Add-In Tester, the TIA Openness Firewall for
"TiaAddInTester.exe" must be confirmed with "Yes, all" if necessary.
Note Only one TIA Portal instance may be active during the test. Close all other
instances before testing.
The test of a TIA Add-In can be started via the menu "Debug" → "Start
Debugging", or by pressing the F5 key in Visual Studio.
After loading the TIA Add-In and establishing the connection to the TIA Portal, the
Openness objects provided from the GetSelection method are passed to UpdateUI
and the Click delegate of the specified context menu item. By default, the first Add-
In and the first context menu entry are executed (see section 3.1.5).
The Click delegate of a context menu item is only executed if the return value of
the UpdateUI delegate was "MenuStatus.Enabled". This simulates the behavior in
the TIA Portal that a context menu entry can only be executed if it has the status
"MenuStatus.Enabled". If no UpdateUI delegate was implemented, the Click
delegate is always executed. If Openness objects are provided in the GetSelection
method that do not correspond to the type of the context menu item, then this
results in the status "MenuStatus.Hidden". The Click delegate is not executed in
this case.
Start
Add-In
Connection to the
TIA Portal
Call
GetSelection
method
Preserved
objects
UpdateUI
yes Call UpdateUI
dele gate
Imp lemented? delegate
no
Call Click
Enabled MenuStatus?
delegate
Disabled/Hidden
End
Set a breakpoint at the points in the code that you want to analyze.
Program execution is paused when the breakpoint is reached so that the states of
the variables can be analyzed.
While the program sequence is paused at the defined breakpoint, the status can be
read out by pointing the mouse at a variable to be analyzed (1) and updating the
status (2).
© Siemens AG 2022 All rights reserved
1 2 3 4
In the TIA Portal, the maximum execution time of the UpdateUI delegate is limited
to 250 ms. After the time limit has expired, the context menu entry is set to
"Hidden" in the TIA Portal and is not displayed.
Therefore, the execution time of the UpdateUI delegate is measured and displayed
in the TIA Add-In Tester. Exceeding the time limit has no effect on the test, but a
warning is issued.
By default, the first context menu Add-In and the first context menu entry found are
tested. The Add-In and/or context menu entry of the Add-In to be tested can be
specified with optional parameters (see point 4 in section 2.1.2).
In Figure 3-6, the context menu item "InOut" is tested. The arguments are specified
as follows:
--path "D:\FCFBConverter\bin\Debug\FCFBConverter.addin" --menu
"FC-FB Converter" --item "InOut"
The parameter "--menu" is only necessary if several Add-Ins have been
implemented in the TIA Add-In to be tested.
Note Regardless of the cascading of the context menu entry, only the context menu
entry text (2) must be specified in each case.
Since the TIA Add-In Tester does not execute the TIA Add-In like a common TIA
Add-In, but instead like an Openness Application, the final test of a TIA Add-In to
be published should always be done in the TIA Portal.
Note Debugging a TIA Add-In in the TIA Portal is described in the FAQ "How to debug
a TIA Add-In".
https://support.industry.siemens.com/cs/ww/en/view/109790393
© Siemens AG 2022 All rights reserved
4 Appendix
4.1 Service and support
Industry Online Support
Do you have any questions or need assistance?
Siemens Industry Online Support offers round the clock access to our entire
service and support know-how and portfolio.
The Industry Online Support is the central address for information about our
products, solutions and services.
Product information, manuals, downloads, FAQs, application examples and videos
– all information is accessible with just a few mouse clicks:
support.industry.siemens.com
Technical Support
The Technical Support of Siemens Industry provides you fast and competent
support regarding all technical queries with numerous tailor-made offers
– ranging from basic support to individual support contracts.
Please send queries to Technical Support via Web form:
support.industry.siemens.com/cs/my/src
© Siemens AG 2022 All rights reserved
Service offer
Our range of services includes the following:
• Plant data services
• Spare parts services
• Repair services
• On-site and maintenance services
• Retrofitting and modernization services
• Service programs and contracts
You can find detailed information on our range of services in the service catalog
web page:
support.industry.siemens.com/cs/sc
The Siemens Industry Mall is the platform on which the entire siemens Industry
product portfolio is accessible. From the selection of products to the order and the
delivery tracking, the Industry Mall enables the complete purchasing processing –
directly and independently of time and location:
mall.industry.siemens.com