Examples for the SIMATIC S7-1200 / S7-1500 Web Server
Examples for the SIMATIC S7-1200 / S7-1500 Web Server
STEP 7 Basic (TIA Portal), STEP 7 Professional (TIA Portal)
Siemens Industry Online Support
Siemens AG 2018 All rights reserved
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 nonbinding 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 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 () 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 .
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 customers exposure to cyber threats.
To stay informed about product updates, subscribe to the Siemens Industrial Security RSS Feed at: .
Examples for the Web Server
Entry ID: 68011496, V2.1, 08/2018
2
Siemens AG 2018 All rights reserved
Table of Contents
Table of Contents
Legal information ......................................................................................................... 2
1 Preface ................................................................................................................ 5
2 Hardware and Software Components Used.................................................... 6
3 Basics of Standard Web Pages ........................................................................ 8
4 Basics of User-Defined Web Pages ................................................................. 9
4.1
Login and instructions for use .............................................................. 9
4.2
Web server ? initializing the WWW system function ............................ 9
4.3
Libraries ? jQuery and S7 Framework ............................................... 10
5 Reading and Writing with different Variable Types ..................................... 12
5.1 5.2 5.2.1 5.2.2
Automation task.................................................................................. 12 Functional mechanisms and use........................................................ 13 S7 program structure.......................................................................... 15 User-defined web page (HTML file) structure .................................... 16
6 Displaying the Date and Time ........................................................................ 19
6.1 6.2 6.2.1 6.2.2
Automation task.................................................................................. 19 Functional mechanisms and use........................................................ 19 S7 program structure.......................................................................... 20 User-defined web page (HTML file) structure .................................... 21
7 Displaying an S7 Array (S7-1500 only) .......................................................... 22
7.1 7.2 7.2.1 7.2.2
Automation task.................................................................................. 22 Functional mechanisms and use........................................................ 22 S7 program structure.......................................................................... 23 User-defined web page (HTML file) structure .................................... 23
8 ENUM ? Variable Value Replaced with Text.................................................. 24
8.1 8.2 8.2.1 8.2.2
Automation task.................................................................................. 24 Functional mechanisms and use........................................................ 25 S7 program structure.......................................................................... 26 User-defined web page (HTML file) structure .................................... 26
9 HTTP Redirection following an Error (S7-1500 only) ................................... 27
9.1 9.2 9.2.1 9.2.2
Automation task.................................................................................. 27 Functional mechanisms and use........................................................ 28 S7 program structure.......................................................................... 29 User-defined web page (HTML file) structure .................................... 30
10 Change Language on User-Defined Pages ................................................... 31
10.1 10.2 10.2.1 10.2.2 10.3
Automation task.................................................................................. 31 Functional mechanisms and use........................................................ 31 S7 program structure.......................................................................... 32 User-defined web page structure ....................................................... 32 Extending the example....................................................................... 37
11 Transferring Data without Reloading Pages Using AJAX ........................... 38
11.1 11.2 11.2.1 11.2.2
Automation task.................................................................................. 39 Functional mechanisms and use........................................................ 40 S7 program structure.......................................................................... 41 User-defined web page structure ....................................................... 42
Examples for the Web Server
Entry ID: 68011496, V2.1, 08/2018
3
Table of Contents
12 Displaying Data of a Datalog as a Graph ...................................................... 47
12.1 12.2 12.2.1 12.2.2
Automation task.................................................................................. 47 Functional mechanisms and use........................................................ 48 S7 program structure.......................................................................... 49 User-defined web page structure ....................................................... 50
13 Display Elements Using Scalable Vector Graphics ..................................... 54
13.1 13.2 13.2.1
Programming task .............................................................................. 54 Functional mechanisms and use........................................................ 54 Sample SVG element ? rotary motion of a motor .............................. 55
14 S7 Diagnostics and Loading Indicator .......................................................... 58
14.1 14.2 14.2.1 14.2.2
Automation task.................................................................................. 58 Functional mechanisms and use........................................................ 58 S7 program structure.......................................................................... 59 User-defined web page structure ....................................................... 59
15 Changing Pictures Using JavaScript............................................................. 64
15.1 Programming task .............................................................................. 64 15.2 Functional mechanisms and use........................................................ 64
16 Button for CPU Restart ................................................................................... 66
16.1 16.2 16.2.1 16.2.2
Automation task.................................................................................. 66 Functional mechanisms and use........................................................ 66 S7 program structure.......................................................................... 67 User-defined web page structure ....................................................... 67
17 Login on User-Defined Pages ........................................................................ 69
17.1 17.2 17.2.1 17.2.2
Automation task.................................................................................. 69 Functional mechanisms and use........................................................ 69 S7 program structure.......................................................................... 70 User-defined page structure............................................................... 70
18 High-Performance Communication via a String........................................... 73
18.1 18.2 18.2.1 18.2.2
Automation task.................................................................................. 73 Functional mechanisms and use........................................................ 74 S7 program structure.......................................................................... 75 User-defined web page structure ....................................................... 78
19 Installation ........................................................................................................ 82
19.1 Installing the hardware and software ................................................. 82 19.2 Installing the application example ...................................................... 83
20 Internet links .................................................................................................... 84
21 History............................................................................................................... 85
Siemens AG 2018 All rights reserved
Examples for the Web Server
Entry ID: 68011496, V2.1, 08/2018
4
Siemens AG 2018 All rights reserved
1 Preface
1
Preface
Objective of the application examples
The application examples in this document show you how to extend your own web pages on the S7-1200/1500 web server.
This document describes the examples provided for downloading. It is recommended to run the examples on a computer and simultaneously analyze them with the aid of this document.
Main contents of the application examples The application examples cover the following key points: Reading and writing with different variable types Displaying the time Outputting arrays (S7-1500 only) Using the ENUM data type HTTP redirection following an error (S7-1500 only) Change language on user-defined pages Transferring data without reloading pages Displaying a datalog generated by the controller as a graph Creating display elements Displaying diagnostic information Changing pictures using JavaScript Restarting the CPU using a button Logging in on the user-defined page High-performance data transfer
Advantages
Integrated web server in the S7-1200 and S7-1500 The standard web pages for easy display of service and diagnostic information are enabled with a single click. In addition, you can create custom, user-defined web pages that are referred to below as "user-defined pages". Access from anywhere A web browser allows you to access the S7 web pages from anywhere in the world. Application example Universal use of the application example for the SIMATIC S7-1200 and S7-1500.
Benefits Note
No additional hardware and software required. The web server can be accessed over large distances using mobile communications devices such as tablet computers, smartphones, etc.
The application examples in conjunction with the web server should not and cannot replace an HMI system.
Examples for the Web Server
Entry ID: 68011496, V2.1, 08/2018
5
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- examples of the 4ps
- tariff examples in the us
- examples of the 4 ps
- examples of the conflict theory
- examples of the first law of motion
- examples of the golden ratio
- examples of the fibonacci sequence
- efficiency examples in the workplace
- efficiency examples in the office
- examples of the second law of motion
- examples of the 8th amendment
- examples of the eighth amendment