OpennessScripter Intro DOC V114 en
OpennessScripter Intro DOC V114 en
OpennessScripter Intro DOC V114 en
Introduction
Siemens
TIA Portal / Openness API Industry
Online
https://support.industry.siemens.com/cs/ww/en/view/109742322 Support
Warranty and Liability
Note The Application Examples are not binding and do not claim to be complete regarding the
circuits shown, equipping and any eventuality. The Application Examples do not represent
customer-specific solutions. They are only intended to provide support for typical
applications. You are responsible for ensuring that the described products are used
correctly. These Application Examples do not relieve you of the responsibility to use safe
practices in application, installation, operation and maintenance. When using these
Application Examples, you recognize that we cannot be made liable for any
damage/claims beyond the liability clause described. We reserve the right to make
changes to these Application Examples at any time without prior notice.
If there are any deviations between the recommendations provided in these Application
Examples and other Siemens publications – e.g. Catalogs – the contents of the other
documents have priority.
We do not accept any liability for the information contained in this document.
Any claims against us – based on whatever legal reason – resulting from the use of
the examples, information, programs, engineering and performance data etc.,
described in this Application Example shall be excluded. Such an exclusion shall
not apply in the case of mandatory liability, e.g. under the German Product Liability
Act (“Produkthaftungsgesetz”), in case of intent, gross negligence, or injury of life,
body or health, guarantee for the quality of a product, fraudulent concealment of a
deficiency or breach of a condition which goes to the root of the contract
(“wesentliche Vertragspflichten”). The damages for a breach of a substantial
contractual obligation are, however, limited to the foreseeable damage, typical for
Siemens AG 2018 All rights reserved
the type of contract, except in the event of intent or gross negligence or injury to
life, body or health. The above provisions do not imply a change of the burden of
proof to your detriment.
Any form of duplication or distribution of these Application Examples or excerpts
hereof is prohibited without the expressed consent of the Siemens AG.
Security Siemens provides products and solutions with industrial security functions that support the
informa- secure operation of plants, systems, machines and networks.
tion 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 only form one element of such a
concept.
Customer is responsible to prevent unauthorized access to its plants, systems, machines
and networks. Systems, machines and components should only be connected to the
enterprise network or the internet if and to the extent necessary and with appropriate
security measures (e.g. use of firewalls and network segmentation) in place.
Additionally, Siemens’ guidance on appropriate security measures should be taken into
account. For more information about industrial security, please visit
http://www.siemens.com/industrialsecurity.
Siemens’ products and solutions undergo continuous development to make them more
secure. Siemens strongly recommends to apply product updates as soon as available and
to always use the latest product versions. Use of product versions that are no longer
supported, and failure to apply latest updates may increase customer’s exposure to cyber
threats.
To stay informed about product updates, subscribe to the Siemens Industrial Security
RSS Feed under http://www.siemens.com/industrialsecurity.
OpennessScripter: Introduction
Entry ID: 109742322, V1.1.4, 10/2018 2
Table of Contents
Table of Contents
Warranty and Liability ................................................................................................. 2
1 Introduction ........................................................................................................ 4
1.1 The TIA Portal interface ....................................................................... 4
1.2 Application examples ........................................................................... 4
1.3 Until now: Necessary to create your own applications ......................... 5
1.4 New: Create scripts with OpennessScripter ......................................... 6
1.5 Advantages .......................................................................................... 6
2 Requirements ..................................................................................................... 7
2.1 Required know-how.............................................................................. 7
2.2 System requirements ........................................................................... 7
2.3 Enabler file and usage file .................................................................... 7
3 Installation .......................................................................................................... 8
4 The first start ...................................................................................................... 9
4.1 Start screen structure ........................................................................... 9
4.2 Editor structure ................................................................................... 10
4.3 Creating a script ................................................................................. 11
4.3.1 General ............................................................................................... 11
4.3.2 “Hello World” script ............................................................................. 12
4.3.3 “Open TIA Portal” script ...................................................................... 12
Siemens AG 2018 All rights reserved
5 Examples .......................................................................................................... 14
5.1 Generating a project ........................................................................... 14
5.2 Updating a project .............................................................................. 15
5.3 Comparing a project ........................................................................... 16
6 Appendix .......................................................................................................... 17
6.1 Service and Support ........................................................................... 17
6.2 Links and literature ............................................................................. 18
6.3 Change documentation ...................................................................... 18
OpennessScripter: Introduction
Entry ID: 109742322, V1.1.4, 10/2018 3
1 Introduction
1 Introduction
This introduction gives you a brief insight into the OpennessScripter. The detailed
documentation can you find in the OpennessScripter menu "Help".
Note Using the interfaces incorrectly can result in loss of data and production
downtime.
Import and compile program blocks You can modify reusable programs externally and
integrate them into a new project.
Export data Create project statistics and backups based
on your own rules.
Check programming guidelines using
external tools.
Match projects to global libraries.
Compare projects Check the consistency of local projects using an
online comparison with the project on the plant.
Generate and import visualizations Automatically generate the visualization for the
via exported program structures HMI from the existing project.
OpennessScripter: Introduction
Entry ID: 109742322, V1.1.4, 10/2018 4
1 Introduction
Figure 1-1
Siemens AG 2018 All rights reserved
OpennessScripter: Introduction
Entry ID: 109742322, V1.1.4, 10/2018 5
1 Introduction
Instead of programming commands, you use a meta language. This reduces the
writing work. In the example shown in Figure 1-2, the reduction of 3,016 characters
to 115 characters saves approx. 95% of the writing work. This example does not
yet include other savings such as incorporation into the high-level language.
1.5 Advantages
Using the OpennessScripter provides a number of advantages over an in-house
development. The ISO 9126 standard specifies the following six quality
characteristics.
Table 1-2
Characteristic Evaluation
Functionality The OpennessScripter provides the basic functionality of the TIA
Portal Openness API.
Reliability When writing a script, the number of potential errors caused by the
user is significantly reduced.
Usability An elegant user interface and commands that are oriented towards
English make the OpennessScripter easier.
Efficiency No differences regarding execution time.
(performance)
Changeability Customizing scripts is considerably easier and quicker than
modifying an application developed in a high-level language.
Portability Scripts are text files and can be transferred more easily. A special
development environment is not necessary.
OpennessScripter: Introduction
Entry ID: 109742322, V1.1.4, 10/2018 6
2 Requirements
2 Requirements
2.1 Required know-how
TIA Portal user knowledge (beginner’s level)
No programming skills
Openness” group. The setup is described in the System Manual \3\, Chapter
4.2.2. More information is also available in the OpennessScripter, “Settings >
Local users and groups”.
Whether Windows and TIA Portal are based on 32- or 64-bit versions has no
effect on the OpennessScripter.
The OpennessScripter and TIA Portal must run in the same Windows
environment, i.e., on the same Windows PC / the same virtual machine.
Importing blocks and user data types into a PLC device requires the “Enabler-
File” and “Usage-File” license files, see System Manual \3\, Chapter 4.2.4.
NOTE Enabler file and usage file are only required for TIA Openness Versions < V14
SP1
OpennessScripter: Introduction
Entry ID: 109742322, V1.1.4, 10/2018 7
3 Installation
3 Installation
Setup
A setup is provided for the OpennessScripter. It allows you to install the software
on the computer.
In the start menu, a shortcut is created in “Programs > Siemens Automation >
OpennessScripter”.
During the installation process, you should select the following options:
1. Enter the current Windows user in the local “Siemens TIA Openness” Windows
group.
2. Add the application to the TIA Portal Openness whitelist.
3. Perform a system check to check the TIA Portal dependencies.
Uninstalling
You can use Control Panel > “Programs and Features” > “OpennessScripter” to
uninstall the software.
Order
You can install the OpennessScripter, even if TIA Portal and the Openness option
package are not installed on your system.
In this case, you can write scripts but not run them.
Siemens AG 2018 All rights reserved
If you install TIA Portal or the Openness option package later, you have to
manually perform the above steps 1. and 2. or reinstall the OpennessScripter.
OpennessScripter: Introduction
Entry ID: 109742322, V1.1.4, 10/2018 8
4 The first start
OpennessScripter: Introduction
Entry ID: 109742322, V1.1.4, 10/2018 9
4 The first start
OpennessScripter: Introduction
Entry ID: 109742322, V1.1.4, 10/2018 10
4 The first start
4.3.1 General
Rules
There are three rules for the script commands:
Each command is in a separate line.
A comment starts with a “#” and can be at both the start and end of a line.
Upper/lower-case letters or indenting commands do not affect the script’s
functionality.
OpennessScripter: Introduction
Entry ID: 109742322, V1.1.4, 10/2018 11
4 The first start
Command types
The following types of commands exist:
Command with optional parameters
Command without parameters
Hybrids of these two types (for commands with multiple parameters).
Follow the below instructions to write a script that outputs the text “Hello World”.
1. Start the OpennessScripter.
2. Click the “Empty script” template.
3. Delete the entire default text in the Editor so that the text field is blank.
4. Write the following new line:
Siemens AG 2018 All rights reserved
Follow the below instructions to write a script that opens TIA Portal.
1. Start the OpennessScripter.
2. Click the “Empty script” template.
3. The template already contains texts that start with a diamond “#”. These texts
are comments for your own documentation.
4. Add your name and a description, for example “My first script”, to the comment:
# Author: Jeff Smith
# Description: My first script
5. Go to the end of the script and write a new line. Make sure not to enter a
diamond “#”:
open Portal
6. Insert a line break at the end of the line and write the next line:
disconnect Portal
7. In the “Run” menu, click the “Check” option to check the script for errors.
8. Read the information in the output. If the error check finds errors in your script,
correct them.
OpennessScripter: Introduction
Entry ID: 109742322, V1.1.4, 10/2018 12
4 The first start
9. In the “File” menu, click the “Save” option to save the script on your computer.
The file gets the “.opns” extension.
10. In the “Run” menu, click the “Run” option to start the script.
An animated progress bar at the bottom left indicates that the script is currently
being executed. No changes are possible during execution. In the
OpennessScripter, the specific line that is currently being executed is indicated
in color to the left of the line number.
11. The script starts TIA Portal. Depending on the computing power, this step may
take some time.
12. The script disconnects from TIA Portal. Please note: This does not terminate
TIA Portal. You cannot close the TIA Portal user interface automatically.
13. As soon as the script is done, the status displayed in the bottom left part of the
OpennessScripter has returned to “Ready”.
14. You have successfully written your first script.
15. In the “File” menu, click the “Close” option to return to the start screen.
Siemens AG 2018 All rights reserved
OpennessScripter: Introduction
Entry ID: 109742322, V1.1.4, 10/2018 13
5 Examples
5 Examples
5.1 Generating a project
Scenario
After production planning and before engineering: A machine manufacturer
produces a series of machines. The manufacturer can use the OpennessScripter
as a product configurator and generate projects on an automated basis.
Savings
In this example, using the OpennessScripter instead of developing a custom
application saves 82% of the writing work (code characters).
Steps
The individual steps are as follows:
1. Connect to an open project in TIA Portal
2. Select controller
3. Create group for tag table
4. Import tag table
5. Import program block
Siemens AG 2018 All rights reserved
6. Compile controller
7. Finally disconnect from TIA Portal
Script
The seven commands for the script are as follows:
connect Portal "D:\demo\project\project.ap15_1"
select Plc "PLC_1"
# Compile controller
compile Plc SoftAndHardware
disconnect Portal
OpennessScripter: Introduction
Entry ID: 109742322, V1.1.4, 10/2018 14
5 Examples
Savings
In this example, using the OpennessScripter instead of developing an application
saves 90% of the writing work (code characters).
Steps
The individual steps are as follows:
8. Connect to an open project in TIA Portal
9. Open a global library
10. Select a controller
11. Update the controller using the global library
12. Close the global library
13. Finally disconnect from TIA Portal
Script
Siemens AG 2018 All rights reserved
OpennessScripter: Introduction
Entry ID: 109742322, V1.1.4, 10/2018 15
5 Examples
Savings
In this example, using the OpennessScripter instead of developing a custom
application saves 92% of the writing work (code characters).
Steps
The individual steps are as follows:
1. Connect to an open project in TIA Portal
2. Select a controller
3. Go online with the controller
4. Perform an online comparison
5. Go offline with the controller
6. Finally disconnect from TIA Portal
Script
Siemens AG 2018 All rights reserved
OpennessScripter: Introduction
Entry ID: 109742322, V1.1.4, 10/2018 16
6 Appendix
6 Appendix
6.1 Service and Support
Industry Online Support
Do you have any questions or do you need support?
With Industry Online Support, our complete service and support know-how and
services are available to you 24/7.
Industry Online Support is the place to go to for information about our products,
solutions and services.
Product Information, Manuals, Downloads, FAQs and Application Examples – all
the information can be accessed with just a few clicks:
https://support.industry.siemens.com
Technical Support
Siemens Industry’s Technical Support offers you fast and competent support for
any technical queries you may have, including numerous tailor-made offerings
ranging from basic support to custom support contracts.
You can use the web form below to send queries to Technical Support:
www.siemens.com/industry/supportrequest.
Service offer
Siemens AG 2018 All rights reserved
OpennessScripter: Introduction
Entry ID: 109742322, V1.1.4, 10/2018 17
6 Appendix
OpennessScripter: Introduction
Entry ID: 109742322, V1.1.4, 10/2018 18