Tool for Communication
Transcription
Tool for Communication
Tool for Communication Configurable applet for visualization and control of binary plant states Tool Warranty, Liability and Support Java-Applet Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc Note Entry-ID: 24207239 The function blocks and tools are not binding and do not claim to be complete regarding the circuits shown, equipping and any eventuality. The function blocks and tools 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. The introduced examples do not relieve you of the responsibility of safely and professionally using, installing, operating and servicing equipment. Using these function examples and tools within the examples, you accept that Siemens cannot be made liable for any damage/claims beyond the liability clause described. We reserve the right to make changes to these function examples and tools at any time without prior notice. If there are any deviations between the recommendations provided in these examples and other Siemens publications – e.g. Catalogs – the contents of the other documents have priority. Warranty, Liability and Support 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 function blocks and tools, information, programs, engineering and performance data etc., described in this 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 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. Copyright© 2008 Siemens I IA/DT . Any form of duplication or distribution of these function blocks and tools or excerpts hereof is prohibited without the expressed consent of Siemens I IA/DT. If you have any questions concerning this document please e-mail us to the following address: online-support.automation@siemens.com V1.0 24.09.2008 2/40 Preface Java-Applet Entry-ID: 24207239 Preface In this example we introduce fully functional and tested automation configurations based on Siemens I IA/DT standard products and individual function blocks or tools for simple, fast and inexpensive implementation of automation tasks. Apart from a list of all required hardware and software components and a description of the way they are connected to each other, the examples include the tested tools or function blocks. This ensures that the functionalities described here can be reset in a short period of time and thus also be used as a basis for individual expansions. Table of Contents Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc Table of Contents ......................................................................................................... 3 1 Automation Description ................................................................................. 5 2 Setup................................................................................................................ 7 3 Required Hardware and Software Components .......................................... 8 Components for an S7-300 configuration .................................................... 8 Components for an S7-400 configuration .................................................... 8 Components for an S7-200 configuration .................................................... 8 Configuration software/tools......................................................................... 9 4 4.1 4.2 4.2.1 Functionality ................................................................................................. 11 Functional sequence of the Java applet ......................................................... 11 Description...................................................................................................... 12 Java applet “BitPanel.jar” for visualization of 64 bits ...................................... 12 Overview .................................................................................................... 12 Calling the Java applet............................................................................... 13 Attributes .................................................................................................... 13 Parameter .................................................................................................. 14 Alternative .................................................................................................. 14 The configuration file Config_bitpanel.ini ................................................... 14 Java applet “S7Table.jar” for group-oriented visualization of 48 bits .............. 16 Overview .................................................................................................... 16 Calling the Java applet............................................................................... 17 Attributes .................................................................................................... 17 Parameter .................................................................................................. 17 Alternative .................................................................................................. 17 The configuration file Config_s7table.ini .................................................... 18 Java applet “Controlpanel.jar” for controlling binary states............................. 20 Overview .................................................................................................... 20 Calling the Java applet............................................................................... 21 4.2.2 4.2.3 V1.0 24.09.2008 3/40 Preface Java-Applet Entry-ID: 24207239 Attributes .................................................................................................... 21 Parameter .................................................................................................. 21 Alternative .................................................................................................. 21 The configuration file Config_controlpanel.ini ............................................ 22 5 5.1 Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc 5.2 5.3 5.4 5.4.1 5.4.2 5.5 5.5.1 5.5.2 Installation and Operation of the Sample/Tool .......................................... 24 Preliminary remarks ................................................................................... 24 Functionality ............................................................................................... 24 Addresses .................................................................................................. 25 Configuration of the SIMATIC Field PG .......................................................... 25 Setting the IP addresses ............................................................................ 25 Setting PG/PC interface ............................................................................. 25 Installation of the application software ............................................................ 26 Commissioning the S7 program ..................................................................... 28 Create a user ............................................................................................. 29 Define the IP address of the IE-CP ............................................................ 30 Loading the S7 program............................................................................. 31 Operating the example ................................................................................... 32 The HTML-file “content.html” ..................................................................... 32 The HTML-file “hompage.html” .................................................................. 32 The HTML-file “Visualization_and_Control.html” ............................................ 33 The HTML-file “BitPanel.html”.................................................................... 33 The HTML-file “Controlpanel.html”............................................................. 34 The HTML-file “S7Table.html” ........................................................................ 35 Adjustments .................................................................................................... 36 Adjustments for usage of the Java applet in an S7-200 station...................... 36 Adjusting the configuration file ................................................................... 36 Adjustment in the HTML-file....................................................................... 36 Adjustments for usage of the Java applet in an S7-400 station...................... 37 Adjustment in the HTML-file....................................................................... 37 6 Basic Performance Data .............................................................................. 38 Development environment ......................................................................... 38 Applet “Bitpanel.jar”.................................................................................... 38 Applet “Controlpanel.jar” ............................................................................ 38 Applet “S7Table.jar” ................................................................................... 39 7 Appendix ....................................................................................................... 40 8 History ........................................................................................................... 40 V1.0 24.09.2008 4/40 Automation Description Java-Applet 1 Entry -ID: 24207239 Automation Description Automation task In a plant, binary process variables of a SIMATIC S7-300, S7-400 or S7-200 station shall be monitored and controlled via a standard web browser as cost-efficiently as possible. The connection occurs via LAN or WAN. Automation solution In the example on hand the individual buildings of an industrial site shall be monitored and components such as lighting and air-condition be controlled. It illustrates a simple option for visualizing and controlling binary process variables of the SIMATIC S7 station on a web browser using configurable Java applets. The Java applets have been developed with the JAVA S7Beans Library which is contained in the delivery scope of the IE CPs. The source code of the Java applets is contained in this example and can be modified by the user for expansions. Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc No previous programming knowledge is required. The process variables are configured in a configuration file using a text editor. The Java applet loads all information from the configuration file onto the industrial Ethernet CP, which supports IT functions such as HTML process control, sending emails and the FTP protocol. It reads the process variables cyclically from the controller and visualizes these on the web browser. A control applet writes the process variables from the web browser into the SIMATIC S7 station. The following figure illustrates the introduced solution: V1.0 24.09.2008 5/40 Automation Description Java-Applet Entry -ID: 24207239 Figure 1-1 Automation solution BitPanel.html Controlpanel.html s7table.html BitPanel.jar Controlpanel.jar S7Table.jar Config_bitpanel.ini Config_controlpanel.ini Config_s7table.ini S7-400 with CP443-1 IT/Adv S7-300 with CP343-1 IT/Adv S7-200 with CP243-1 IT Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc WAN SIMATIC Field PG with Web Browser SIMATIC Field PG with Web Browser LAN Application areas / customer benefits The example is generally suitable for simple visualization tasks (for operator control and monitoring) in the lower performance range, such as: • Building control systems • Monitoring of remote systems / machines • etc. This solution has the following advantages for the user: V1.0 • The user does not require any programming skills. • The example can be applied to S7-200, S7-300 and S7-400 stations. • It is possible to use a standard web browser. • On the SIMATIC NET Field PG no licenses are required. 24.09.2008 6/40 Setup Java-Applet 2 Entry -ID: 24207239 Setup The following figure shows the setup of the example with an S7-300 station. Figure 2-1 Configuration •Java applets •Configuration files •HTML pages SIMATIC Field PG •Web Browser •FTP Client •STEP 7 IP address: 142.120.5.100 Subnet mask: 255.255.255.0 S7-300 Station IP address: 142.120.5.51 Subnet mask: 255.255.255.0 CP343-1 IT Industrial Ethernet Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc CPU 315-2DP SCALANCE X208 MPI V1.0 24.09.2008 7/40 Required Hardware and Software Components Java-Applet 3 Entry -ID: 24207239 Required Hardware and Software Components Components for an S7-300 configuration Table 3-1 Component Qty. MLFB / Order number Note Power Supply PS 307 5A 1 6ES7 307-1EA00-0AA0 or similar power supply CPU 315-2PN/DP 1 6ES7 315-2EG10-0AB0 or similar CP343-1 IT 1 6GK7 343-1GX20-0XE0 Components for an S7-400 configuration Table 3-2 Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc Component Qty. MLFB / Order number Note Power Supply PS 407 10A 1 6ES7 407-0KA01-0AA0 or similar power supply CPU 416-2DP 1 6ES7 416-2XK02-0AB0 or similar CP443-1 IT 1 6GK7 443-1GX11-0XE0 Components for an S7-200 configuration Table 3-3 Component Qty. MLFB / Order number Note LOGO! Power 1 6EP1331-1SH02 or similar power supply CPU 224 1 6ES7 214-1AD21-0XB0 or similar CP243-1 IT 1 6GK7 243-1GX00-0XE0 In the S7 station you require an IE CP with web server. Furthermore the IE CP must support the following IT functions: Note V1.0 • FTP functions (File Transfer Protocol) for data management and accesses to data blocks in the CPU (at least server function) • Monitor devices and process data (HTML process control) The manual of the IE CP, chapter “Properties and Services”, contains information on the communication services which support the IE CP (see /1/). 24.09.2008 8/40 Required Hardware and Software Components Java-Applet Entry -ID: 24207239 Configuration software/tools Table 3-4 Component Qty. MLFB / Order number Note SIMATIC STEP 7 Version V5.4 SP3 1 6ES7810-4CC08-0YA5 or higher MircoWIN V4.0 SP3 1 6ES7810-2CC03-0YX0 or higher FTP-Client 1 e.g. UltraFXP by software http://www.software.net or similar FTP client Web Browser 1 e.g. Internet Explorer by Microsoft Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc On the SIMATIC Field PG you require V1.0 • an FTP client, since the Java applet, the appropriate configuration file and the HTML-file are transferred to the Industrial Ethernet CP using the FTP protocol. • a web browser for visualizing and controlling the process variable. • the STEP 7 configuration tool, to configure the SIMATIC S7-300 or S7-400 station, and to load the S7 program into the CPU. When using an S7-200 station you require the configuration tool MicroWIN. 24.09.2008 9/40 Required Hardware and Software Components Java-Applet Entry -ID: 24207239 Example files and projects The software examples are available on the HTML page from which you downloaded this document. The following link takes you directly to the download page of this document. http://support.automation.siemens.com/WW/view/en/24207239 The download is a ZIP file which can be unzipped with any zip-program. The zip-file contains files in the appropriate folders: Table 3-5 Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc File name V1.0 Content STEP7 Contains the STEP7 project including configuration and user program of an S7-300 and S7-400 station MicroWIN Contains the user program and the configuration of an S7-200 station BitPanel This folder contains • Java applet including source code • Configuration file and • HTML-file for visualization of 64 bits S7Table This folder contains • Java applet including source code • Configuration file and • HTML-file for group-oriented visualization of 48 bits CtrlPanel This folder contains • Java applet including source code • Configuration file and • HTML-file for controlling 8 bits Users Pictures and further HTML-files, such as start page, table of contents, etc. 24.09.2008 10/40 Functionality Java-Applet Entry -ID: 24207239 4 Functionality 4.1 Functional sequence of the Java applet The following image illustrates the general interaction of the individual components. Figure 4-1 Functional sequence of the Java applet S7-300 CPU CP 343-1 Process variables 4 PG HTTP Server 1 K-Bus HTTP-protocol File system: Configuration file Config_bitpanel.ini Config_controlpanel.ini Config_s7table.ini Web Browser Java VM 2 Java applet Applet BitPanel.jar Controlpanel.jar S7Table.jar HTML-file BitPanel.html Controlpanel.html S7Table.html Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc 3 Table 4-1 Number Description Calling the html-page from the file system of the CP343-1 downloads the Java applet onto the web browser. The Java applet is configured by the call parameters of the HTML-file. The Java applet is the central manager of the communication between the web browser and the CPU. It is executed after the download of the virtual machine of the web browser. All necessary information (address of the process variable, position etc) are downloaded by the Java applet from the configuration file. The complete data communication from and to the Java applet is processed via the web server of the CP343-1. Via the CP343-1, the data requests are sent back to the calling applet via the communication mechanisms of the operating system of the CPU. V1.0 24.09.2008 11/40 Functionality Java-Applet 4.2 Entry -ID: 24207239 Description The example comprises a total of 3 Java applets: Table 4-2 Java applet Description BitPanel.jar Java applet for visualization of 64 bits Controlpanel.jar Java applet for controlling 8 bits S7Table.jar Java applet for group-oriented visualization of 48 bits Each Java applet is called in a separate HTML-file. Each Java applet is configured by means of an own configuration file. Table 4-3 Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc HTML-file Applet Configuration File BitPanel.html BitPanel.jar Config_bitpanel.ini Controlpanel.html Controlpanel.jar Config_controlpanel.ini S7Table.html S7Table.jar Config_s7table.ini 4.2.1 Java applet “BitPanel.jar” for visualization of 64 bits Overview In the HTML-file “BitPanel.html” the Java applet “BitPanel.jar” for visualization of 64 bits is called. The 64 bits are bit by bit read from a connected memory area of the CPU and displayed in the HTML-file “BitPanel.html” in a linear manner. In this example the flag area is defined as memory area. The memory byte 0 (MB0) until memory byte (MB7) inclusive is read out from the CPU and the individual bits are visualized. Figure 4-2 HTML-file “BitPanel.html” MB 0 Bit 0 Bit 0 Bit 0 Bit 7 Bit 0 Bit 7 Bit 0 Bit 7 Bit 0 Bit 7 Bit 0 Bit 7 Bit 7 Bit 7 MB 1 V1.0 MB 6 MB 4 MB 2 Bit 0 Bit 7 MB 5 MB 3 24.09.2008 MB 7 12/40 Functionality Java-Applet Entry -ID: 24207239 Calling the Java applet The Java applet BitPanel.jar is called using the <object></objects> tags in the HTML-file. In HTML 4 this element was introduced which offers a universal solution for the general integration of objects (applets, plug-ins, media, images). Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc Figure 4-3 Calling the Java applet “BitPanel.jar!” with the element <object></object> Attributes Table 4-4 describes the attributes required for integrating a Java applet as object: Table 4-4 Attribute Description classid The “classid” attribute identifies the Java version. With classid = 8AD9C840-044E-11D1-B3E9-00805F499D93 the latest installed Java version is used. codetype Specifies the object type width, height Width and height of the Java applet V1.0 24.09.2008 13/40 Functionality Java-Applet Entry -ID: 24207239 Parameter In Table 4-5 the meaning of the individual parameters is described: Table 4-5 Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc param name Description Default CODE Name of the class ARCHIVE Storage path and name of the Java applets CFGFILE Storage path and name of the configuration file S7-200 With this parameter it is defined whether the Java applet is loaded on an S7-300/400 or S7-200 station. S7-200=No The Java applet is loaded on an S7-300 or S7-400 station S7-200=Yes The Java applet is loaded on an S7-200 station NO RACK Rack of the CPU 0 SLOT Slot of the CPU 2 CYCLETIME Update time in ms 1000 Alternative Alternatively, it is possible to call the Java applet with the <Applet><Applet> tag in the HTML page. This call has been out-of-date since HTML 4 and was replaced with the <object> element. Figure 4-4 Calling the Java applet “BitPanel.jar!” with the element <applet></applet> The configuration file Config_bitpanel.ini The following table contains a description of the parameters which are defined in the configuration file and whose values can be adjusted by the user: V1.0 24.09.2008 14/40 Functionality Java-Applet Entry -ID: 24207239 Table 4-6 Parameter Description Default Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc General settings APPLET User-definable text which is displayed in the HTML-file as header over the visualized variable industrial zone - Musterstadt (example city) COLOR Font color of the header #0000FF BGCOLOR Background color of the header #FFCC99 SIZE Font size of the header 18 FONT Font type of the header Times New Roman MAX_Bytes Maximum number of variables to be visualized (in this example: bytes) 8 TestButton For test purposes for simulation false S7Adr S7-Anypointer for defining the memory area in the CPU from which the variables are read It is not necessary to define the S7Adr parameter for each read out variable, because the specified memory area is read and written in a connected manner. It is sufficient to define this parameter once in the configuration file. The parameters of the S7-Anypointer are separated by commas. 2,8,131,0,0 dataType = 2 data type repFactor = 8 repetition factor memArea = 131 memory areas in the CPU read from or written to subArea = 0 if read from a DB (memArea = 132), then the DB number is entered here byteAddress = 0 start address within the defined memory area Settings for the depiction of the short description of the variables (bit labels) FONT Font type of the bit label Times New Roman SIZE Size of the bit label 12 ALIGN Alignment of the text in the label CENTER Settings for the depiction of the visualized variables (values) FONT Font of the visualized variables Times New Roman SIZE Font of the visualized variables 12 ALIGN Alignment of the text of the visualized variables CENTER Definition of the bits within a byte [Bit0-0] TITLE Short description of the variable (bit) cafeteria COLOR Font color of the short description #0000FF BGCOLOR Background color of the short description #CCCCCC FALSE Text for state “0” of the bit closed FALSE-COLOR Font color of the text for state “0” of the bit #FF0000 FALSEBGCOLOR Background color for state “0” of the bit #EEEEEE V1.0 24.09.2008 15/40 Functionality Java-Applet Entry -ID: 24207239 Parameter Description Default TRUE Text for state “1” of the bit open TRUE-COLOR Font color of the text for state “1” of the bit #006600 TRUEBGCOLOR Background color for state “1” of the bit #CCFFFF [Bit0-1] … [Bit7-7] For each represented bit a short description can be configured with userdefinable fond and background color. Text, font of the text and background color can be configured for the states “0” and “1” of the bits. Each of the 64 bits, which are read from a connected memory area of the CPU bit by bit, must be defined separately in the configuration file. Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc The number of bits visualized in the HTML page are defined via the S7-Anypointer S7-Adr (repFactor). Prerequisite: Note 4.2.2 • Parameter MAX_bytes ≥ repFactor • In the configuration file you need to define as many bits as visualized in the HTML-file. An overview of the setup of the S7-Anypointer S7-Adr and which values the parameters must take on is available in the application “Converting S7 Data Types in Java Programs” (Entry-ID: 22698628), in the manual “S7Beans / Applets for Advanced CPS / Programming Tips / Supplement to the documentation of the Advanced CPs: CP 243- 1 IT, CP 343-1 IT / CP 343- 1 Advanced, CP 443-1 IT / CP 443- 1 Advanced” 24843906. Java applet “S7Table.jar” for group-oriented visualization of 48 bits Overview In the HTML-file “S7Table.html” the Java applet “S7Table.jar” for visualization of 48 bits (6 bytes) is called. The 48 bits are bit by bit read from a connected memory area of the CPU and displayed in the HTML-file “BitPanel.html” in a group-oriented manner. In this example the flag area is defined as memory area. Memory byte 0 (MB0) up to memory byte (MB5) inclusive are read out from the CPU. The memory bytes are displayed line by line. Bit 0 to Bit 7 of the memory bytes are displayed column by column as a group, i.e. the individual bits of this memory byte have the same meaning as for example Bit 1 = lighting. V1.0 24.09.2008 16/40 Functionality Java-Applet Entry -ID: 24207239 Figure 4-5 HTML-file “S7Table.jar” MB0 MB1 MB2 MB3 MB4 MB5 Bit0 Bit1 Bit2 Bit3 Bit4 Bit5 Bit6 Bit7 group Calling the Java applet Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc The Java applet S7Table.jar is called using the <object></objects> tags in the HTML-file. In HTML 4 this element was introduced which offers a universal solution for the general integration of objects (applets, plug-ins, media, images). Figure 4-6 Calling the Java applet “S7Table.jar!” with the element <object></object> Attributes Table 4-4 describes the attributes required for integrating a Java applet as object. Parameter In Table 4-5 the meaning of the individual parameters is described. Alternative Alternatively, it is possible to call the Java applet with the <Applet><Applet> tag in the HTML page. This call has been out-of-date since HTML 4 and was replaced with the <object> element. V1.0 24.09.2008 17/40 Functionality Java-Applet Entry -ID: 24207239 Figure 4-7 Calling the Java applet “S7Table.jar!” with the element <applet></applet> The configuration file Config_s7table.ini The following table contains a description of the parameters which are defined in the configuration file and whose values can be adjusted by the user: Table 4-7 Parameter Description Default Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc General settings APPLET User-definable text which is displayed in the HTML-file as header over the visualized variable Control of building, block A COLOR Font color of the header #0000FF BGCOLOR Background color of the header #FFCC99 SIZE Font size of the header 18 FONT Font type of the header Times New Roman MAX_Bytes Maximum number of variables to be visualized (in this example: bytes) 6 TestButton For test purposes for simulation false S7Adr S7-Anypointer for defining the memory area in the CPU from which the variables are read It is not necessary to define the S7Adr parameter for each read out variable, because the specified memory area is read and written in a connected manner. It is sufficient to define this parameter once in the configuration file. The parameters of the S7-Anypointer are separated by commas. 2,6,131,0,0 dataType = 2 data type repFactor = 6 repetition factor memArea = 131 memory areas in the CPU read from or written to subArea = 0 if read from a DB (memArea = 132), then the DB number is entered here byteAddress = 0 start address within the defined memory area V1.0 24.09.2008 18/40 Functionality Java-Applet Parameter Entry -ID: 24207239 Description Default Settings for depicting the status display COLOR Font color of the text in the status display #000000 BGCOLOR Background color of the status display #C0C0C0 FONT Font of the text in the status display Times New Roman SIZE Font size of the text in the status display 12 Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc Setting for depicting the line headings (objects) COLOR Font color of the line and column headers #0000FF BGCOLOR Background color of the line and column headers #FFFFFF FONT Font of the line headers Times New Roman SIZE Font size of the line headers 12 ALIGN Alignment of the line headers LEFT BYTE0-TITLE Header of the first line cafeteria BYTE0BGCOLOR Background color of the first line #C0C0C0 BYTE5-TITLE Header of the sixth (last) line building: block C BYTE5BGCOLOR Background color of the sixth (last) line #CCFFFF … Settings for the depiction of the column header (bit label) FONT Font of the column headers Times New Roman SIZE Font size of the column headers 12 ALIGN Alignment of the column headers CENTER Settings for the depiction of the visualized variables (values) FONT Font of the visualized variables Times New Roman SIZE Font of the visualized variables 12 ALIGN Alignment of the text of the visualized variables CENTER V1.0 24.09.2008 19/40 Functionality Java-Applet Entry -ID: 24207239 Parameter Description Default Definition of the grouped bits [Bit0] TITLE Designation of the first group displayed as header of the first column lighting FALSE Text for state “0” of the bit off FALSE-COLOR Font color of the text for state “0” of the bit #FF0000 TRUE Text for state “1” of the bit on TRUE-COLOR Font color of the text for state “1” of the bit #006600 … [Bit7] Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc In the configuration file the connected memory area is defined from which the bits are read out byte by byte. The bytes are represented line by line in the HTML page “S7Table.html”. The number of bytes represented line by line in the HTML page is defined via the S7-Anypointer S7-Adr (repFactor). Prerequisite: • Parameter MAX_bytes ≥ repFactor • In the configuration file you need to define as many bytes as represented line by line in the HTML-file. Bit 0 to Bit 7 of the read out bytes represent one group respectively. In the configuration file the 8 bit, i.e. 8 groups are defined. The meaning of the grouped bits is displayed as column header in the HTML page “S7Table.html”. Text and font for the states “0” and “1” of the bits of a group can be configured as desired. The status display displays the status of the CPU and the Industrial Ethernet CP. Color, font and size of the text in the status display, as well as the background color of the status display is defined by the user as desired in the configuration file. 4.2.3 Java applet “Controlpanel.jar” for controlling binary states Overview In the HTML-file “Controlpanel.html” the Java applet “Controlpanel.jar” for controlling binary states is called. 8 bits are represented in the HTML page. Each bit is controlled via a separate button. The button realizes a switch function or alternatively a push button function. The state of the bit is visualized via the switch or push button position and via the color of the button. V1.0 24.09.2008 20/40 Functionality Java-Applet Entry -ID: 24207239 Above the switch it is displayed where the state of the bit is saved in the CPU. In this example the states of the bits are storde in byte 1 of data block 2 (DB2) in the CPU. Hence they can be evaluated in the S7 user program. Figure 4-8 HTML-file “Controlpanel.html” Calling the Java applet The Java applet Controlpanel.jar is called using the <object></objects> tags in the HTML-file. In HTML 4 this element was introduced which offers a universal solution for the general integration of objects (applets, plug-ins, media, images). Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc Figure 4-9 Calling the Java applet “Controlpanel.jar!” with the element <object></object> Attributes Table 4-4 describes the attributes required for integrating a Java applet as object. Parameter In Table 4-5 the meaning of the individual parameters is described. Alternative Alternatively, it is possible to call the Java applet with the <Applet><Applet> tag in the HTML page. This call has been out-of-date since HTML 4 and was replaced with the <object> element. Figure 4-10 Calling the Java applet “Controlpanel.jar!” with the element <applet></applet> V1.0 24.09.2008 21/40 Functionality Java-Applet Entry -ID: 24207239 The configuration file Config_controlpanel.ini The following table contains a description of the parameters which are defined in the configuration file and whose values can be adjusted by the user: Table 4-8 Parameter Description Default Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc General settings APPLET User-definable text which is displayed in the HTML-file as header over the controlled variable building: block A COLOR Font color of the header #0000FF BGCOLOR Background color of the header #FFCC99 SIZE Font size of the header 18 FONT Font type of the header Times New Roman BTN_TAST Function mode of the button in the HTML-file. No = Switch Button simply pressing the button results in setting or resetting the appropriated bit Yes = Toggle Button If the button is pressed the state of the bit changes. The state of the bit remains as long as the button is pressed. If the button is released the state of the bit changes again. S7Adr S7-Anypointer for defining the memory area in the CPU from which the variables are read The parameters of the S7-Anypointer are separated by commas. 2,1,132,2,1 dataType = 2 data type repFactor = 1 repetition factor memArea = 132 memory areas in the CPU read from or written to subArea = 2 data are written to DB 2 byteAddress = 1 start address within the defined memory area V1.0 24.09.2008 22/40 Functionality Java-Applet Parameter Entry -ID: 24207239 Description Default Settings for depicting the status display COLOR Font color of the text in the status display #000000 BGCOLOR Background color of the status display #CCCCCC FONT Font of the text in the status display Times New Roman SIZE Font size of the text in the status display 12 Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc Settings for representing the display above the buttons COLOR Font color for the display above the buttons #000000 BGCOLOR Background color for the display above the buttons #DDDDDD FONT Font for the display above the button and for labeling the buttons Times New Roman SIZE Font size for the display above the buttons and for labeling the buttons 11 Settings for representing the buttons via which the bits are controlled [Bit0-0] TITLE Labeling the buttons 2ndF:ventilation FALSE-COLOR Color of the labeling of the button if the bit is reset (status of the bit: “0”) #000000 FALSEBGCOLOR Color of the button if the bit is reset (status of the bit: “0”) #FF4400 TRUE-COLOR Color of the labeling of the button if the bit is set (status of the bit: “1”) #000000 TRUEBGCOLOR Color of the button if the bit is set (status of the bit: “1”) #00CC00 … [Bit0-7] V1.0 24.09.2008 23/40 Installation and Operation of the Sample/Tool Java-Applet 5 Entry -ID: 24207239 Installation and Operation of the Sample/Tool Preliminary remarks To test the functionality of the tool / function block, we offer you a finished software example with test code and test parameters as download. These software examples support you in the first steps and tests. The examples are always assigned to the components used in this document and illustrate their interaction principles. However, they are not real applications in the sense of technological problem solving with definable properties. Functionality The example illustrates operator control and monitoring of binary process variables of an S7-300 station via the standard web-browser for monitoring buildings. Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc Hardware setup The hardware components are available in chapter 3 “Required Hardware and Software Components”. Install the hardware components according to Figure 2-1 Configuration. Installation of the standard software During installation of the standard software proceed as follows. Table 5-1 Instruction Comment 1. Install STEP 7 V5.4 + SP3. STEP 7 is necessary for configuring an S7-300 or S7-400 station. 2. Install MicroWIN V4.0 MicroWIN is necessary for configuring an S7-200 station. 3. Install an FTP client You can also use the standard FTPconsole program which is delivered with each operating system. V1.0 24.09.2008 24/40 Installation and Operation of the Sample/Tool Java-Applet Entry -ID: 24207239 Addresses In this example, the following addresses are used: Table 5-2 Hardware IP address SIMATIC Field PG 142.120.5.100 CP343-1 IT 142.120.5.51 CPU 315-2DP 5.1 MPI address 0 2 Configuration of the SIMATIC Field PG Setting the IP addresses Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc The IP address of the SIMATIC Field PG must lie in the same IP subnet as the IP address of the S7-300, S7-400 and S7-200 station. In the properties dialog of the network card of the SIMATIC Field PG you enter a fixed IP address (see Table 5-2). Setting PG/PC interface The first download of the hardware configuration and the S7 program into the controller is performed via MPI, since the IE CP has not yet been configured with the IP address according to Table 5-2. Via Start Æ Control Panel Æ Set PC/PG interface you adjust the S7ONLINE access point to the MPI interface of your SIMATIC Field PG. Alternatively you can also setup a connection with your S7-300 or S7-400 station via Industrial Ethernet. In this case at first you need to assign the configured IP address to the IE CP. To do this use the Primary Setup Tool (PST) or in the SIMATIC Manager the menu “Target system Æ Process Ethernet stations”. V1.0 24.09.2008 25/40 Installation and Operation of the Sample/Tool Java-Applet 5.2 Entry -ID: 24207239 Installation of the application software The zip-file “24207239_BitVis_CODE_V10.zip” contains the following code folder: • BitPanel This folder contains the Java applet “BitPanel.jar”, the HTML-file “BitPanel.html” and the configuration file “Config_bitpanel.ini”. • CtrlPanel This folder contains the Java applet “Controlpanel.jar”, the HTML-file “Controlpanel.html” and the configuration file “Config_controlpanel.ini”. • S7Table This folder contains the Java applet “S7Table.jar”, the HTML-file “S7Table.html” and the configuration file “Config_s7table.ini”. Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc Furthermore the zip-file “24207239_BitVis_CODE_V10.zip” contains the following folder: • STEP7 This folder contains the S7-program for the S7-300 / S7-400. • MicroWIN This folder contains the user program including the configuration of the S7-200. • User This folder consists of two sub-folders “HTML” and “Pictures”. The subfolder “HTML” contains the following HTML-files: • index.html (main page) • content.html (table of contents and navigation) • homepage.html (start page) • Visualization_and_Control.html (visualization and control) The sub-folder “Pictures” contains the pictures which are integrated in the HTML-files. The entire HTML-files, the Java applets, the configuration files as well as the pictures which are integrated in the HTML-pages must be loaded into the file system of the IE CP. Loading the files into the file system of the IE CP occurs via FTP. To do this, you make a connection between the FTP client on your SIMATIC Field PG (here: UltraFXP) and the FTP server (IE CP). V1.0 24.09.2008 26/40 Installation and Operation of the Sample/Tool Java-Applet Entry -ID: 24207239 To be able to connect from the FTP client to the FTP server, you enter the IP address of the FTP server (IE CP). Furthermore you use the user name and password of the configured user (see Figure 5-1). Figure 5-1 FTP client UltraFXP Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc IP address of the IE CP Transfer the source files, i.e. the HTML-files, the Java applets, the configuration files and the pictures into the following directories on the IE CP. V1.0 24.09.2008 27/40 Installation and Operation of the Sample/Tool Java-Applet Entry -ID: 24207239 Figure 5-2 Directories on the IE CP \applets BitPanel.jar Controlpanel.jar S7Table.jar sample program s7api.jar s7gui.jar s7util.jar s7applets.jar s7*.jar files (already available in the delivery condition of the IE CPs \user Config_bitpanel.ini Config_controlpanel.ini Config_s7table.ini Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc BitPanel.html Controlpanel.html S7Table.html configuration file HTML-Files, where the JavaApplets are called index.html content.html homepage.html Visualization_and_Control.html Industriegebiet.gif GrundrissEG.gif GrundrissOG.gif Lageplan.gif Swtich_OFF.jpg Switch_ON.jpg 5.3 HTML-Files (main page, contents directory and navigation, start page, visualization and control) pictures Commissioning the S7 program The application software additionally contains a STEP 7 project which contains the complete hardware configuration, including the user program of an S7-300 and S7-400 station. This STEP 7 project can be downloaded as a zip-file. Extract the “BitVis_Example_S7300_S7400.zip” file to a separate directory. The STEP7 project is then automatically unzipped with all respective subdirectories. Subsequently, you can open and edit the extracted STEP 7 project with the SIMATIC Manager. Adjust the STEP 7 hardware configuration of the S7 station in such a way that it corresponds to the hardware configuration in your plant. V1.0 24.09.2008 28/40 Installation and Operation of the Sample/Tool Java-Applet Entry -ID: 24207239 Create a user In the STEP 7 hardware configuration you open the properties dialog. Change to the “Users” tab. In the STEP 7 project “BitVis_Example_S7300_S7400.zip” the following has already been created. • User name: Administrator • Password: Administrator Click the “Edit…” button to change the properties of the user, such as user name, password and rights. Click “Add...” button to add a new user to the group. Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc Figure 5-3 Properties dialog of the IE CP Æ “Users” tab V1.0 24.09.2008 29/40 Installation and Operation of the Sample/Tool Java-Applet Entry -ID: 24207239 As administrator the user has all rights. Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc Figure 5-4 Defining the properties of the user Define the IP address of the IE-CP Change to the “General” tab of the properties dialog of the IE CP. Here you see the IP address configured for the IE CP. Click the “Properties” button. Figure 5-5 Properties dialog of the IE CP Æ “General” tab V1.0 24.09.2008 30/40 Installation and Operation of the Sample/Tool Java-Applet Entry -ID: 24207239 In the following dialog you enter the IP address and subnet mask for the IE CP. Select an IP address which is located in the IP subnet of your plant. Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc Figure 5-6 Enter IP address for the IE CP Subsequently, save and compile hardware configuration of the S7 station in STEP 7 and download it to your CPU. Loading the S7 program After the hardware configuration has been adjusted and downloaded into the CPU, you also download the S7 program (user program) into the CPU. The configuration of the S7 station is now complete. V1.0 24.09.2008 31/40 Installation and Operation of the Sample/Tool Java-Applet 5.4 Entry -ID: 24207239 Operating the example Start the web browser on your SIMATIC Field PG and call the main page via the address http://142.120.5.51/user/index.html. Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc Figure 5-7 HTML-file “index.html” content.html homepage.html In the main page “index.html” the following HTML-files are called: • “content.html”, which serves as contents directory and for navigation. • “homepage.html”, which serves as start page. The HTML-file “content.html” The HTML-file “content.html” represents the table of contents. It consists of three components: • Home page (start page) • Visualization and control • Control of building, block A The individual points are integrated into the HTML-file “content.html” as hyperlink. This enables navigating between the individual HTML-files. The HTML-file “hompage.html” The HTML-file “homepage.html”, which serves as start page. Here the picture “Industriegebiet.gif” is integrated. V1.0 24.09.2008 32/40 Installation and Operation of the Sample/Tool Java-Applet 5.4.1 Entry -ID: 24207239 The HTML-file “Visualization_and_Control.html” When selecting the component “Visualization and control” in the HTML-file “content.html” then the HTML-file “Visualization_and_Control.html” is opened. In the HTML-file the following HTML-files are called: • BitPanel.html • Controlpanel.html Figure 5-8 HTML-file “Visualization_and_Control.html” MB0 MB2 MB4 MB6 Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc Bit0 MB1 MB3 MB5 Bit7 MB7 The HTML-file “BitPanel.html” In this HTML-file “BitPanel.html” 64 bits from a connected memory area of the CPU are visualized in a linear manner. In this example the 64 bits are read out and visualized byte by byte from the flag area of the CPU. Start address is the MB0, i.e. in the HTML-file “BitPanel.html” MB0 to MB7 inclusive are represented. Within a byte, the bits are represented in the order Bit 0 to Bit 7 (see Figure 5-8). The user has the option to change or control the states of the individual bits of the defined flag area via the variable table. V1.0 24.09.2008 33/40 Installation and Operation of the Sample/Tool Java-Applet Entry -ID: 24207239 Figure 5-9 Variable table Æ Flag area Example: MB7 = 19 dec = 0001 0011 bin If a bit has the state “0” the text which was defined for this state in the configuration file is displayed in red. Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc If a bit has the state “1” the text which was defined for this state in the configuration file is displayed in green. The HTML-file “Controlpanel.html” In the HTML-file “Controlpanel.html“ the following pictures are integrated: • GrundrissEG.gif • GrundrissOG.gif Here the user has the option to control 8 bits. In this example the processes, such as lighting, heating, etc. are controlled in building Block A. The states of the bits are stored in byte 1 of data block 2 (DB2) (see Figure 5-10). Pressing the button in the HTML-file “Visualization_and_Control.html” sets the bits to “1” or resets them to “0”. The state of the bits is displayed via the background color of the button (red=0, green=1) and the position of the switch and button respectively. Figure 5-10 Variable table Æ DB2 DB2.DBB1 = 68 dec = 0100 0100 bin The states of the bits in byte 1 of DB2 are evaluated in the user program. The result of the evaluation is saved in MB1 i.e. the result of the evaluation is displayed in the HTML-file “BitPanel.html”. V1.0 24.09.2008 34/40 Installation and Operation of the Sample/Tool Java-Applet 5.4.2 Entry -ID: 24207239 The HTML-file “S7Table.html” If you select the following component in the HTML-file “content.html”: • Control of building, block A then the HTML-file “S7Table.html” is opened Figure 5-11 HTML-file “S7Table.html” MB0 MB5 Bit0 Bit1 Bit2 Bit3 Bit4 Bit5 Bit6 Bit7 Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc group In this HTML page the following picture is integrated: • Lageplan.gif In this HTML-file “S7Table.html” 48 bits are read from a connected memory area of the CPU and visualized in a grouped manner. In this example the 48 bits are read out and visualized byte by byte from the flag area of the CPU. Start address is the MB0, i.e. in the HTML-file “S7Table.html” MB0 to MB5 inclusive are represented. The bytes are represented line by line in the order MB0 to MB5. The representation of the individual bits occurs column by column from left to right in the order Bit 0 to Bit 7 (see Figure 5-11). Accordingly, the individual bits of the memory bytes have the same meaning as for example Bit 1 = lighting. The user has the option to change or control the states of the individual bits of the defined flag area via the variable table (see Figure 5-9). V1.0 24.09.2008 35/40 Installation and Operation of the Sample/Tool Java-Applet 5.5 Entry -ID: 24207239 Adjustments The Java applets and HTML-files can also be used in a S7-200 and S7-400 station. Adjustments need to be made in the configuration files or in the HTML pages. 5.5.1 Adjustments for usage of the Java applet in an S7-200 station Adjusting the configuration file In the configuration files you must adjust the access to the memory area in the CPU. Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc The variables are read out byte by byte with Java applets from the variable area of the S7-200 by the web browser or written into the variable area of the S7-200. The variable area of the S7-200 is addressed as DB1, i.e. in the configuration file the DB1 is defined as memory area in the S7-200 station. Accordingly, memArea and subArea of the parameter “S7Adr” are defined as follows in the configuration files: • memArea = 132 memory areas in the CPU read from or written to is a data block (DB) • subArea = 1 data block number Adjustment in the HTML-file In the HTML-file the value of the parameter S7-200=YES must be set. After you have transferred the HTML-file into the file system of the CP243-1 IT these can be called up with the Internet Explorer. The following message appears: Figure 5-12 Usage and password Enter the username and password which you have defined in the internet wizard of MicroWIN. In this example the username and password is “Administrator”. V1.0 24.09.2008 36/40 Installation and Operation of the Sample/Tool Java-Applet 5.5.2 Entry -ID: 24207239 Adjustments for usage of the Java applet in an S7-400 station Adjustment in the HTML-file Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc In the HTML-files the value of the parameter “SLOT” must be adjusted according to your hardware configuration. Enter the slot of your S7-400 CPU. V1.0 24.09.2008 37/40 Basic Performance Data Java-Applet 6 Entry -ID: 24207239 Basic Performance Data Development environment The example was generated with the development environment “Eclipse IDE for Java EE Developers”. This software is freeware and can be downloaded via the internet. Applet “Bitpanel.jar” Table 6-1 Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc Criterion Basic performance data Additional note Required Java Runtime version JRE version 1.6.0_03 or higher JAVA S7 Beans Library Version 2.5.5 Download at Entry-ID 22964892 Size (kBytes) 13 Web browser Internet Explorer V7.0 Size of the applet (width x height) 840 x 247 pixels Changeable in the HTML Code Number of variables 64Bit (=8Byte) Changeable the configuration file Update time in ms 1000 Changeable in the HTML Code Applet “Controlpanel.jar” Table 6-2 Criterion Basic performance data Additional note Required Java Runtime version JRE version 1.6.0_03 JAVA S7 Beans Library Version 2.5.5 Size (kBytes) 12 Web browser Internet Explorer V7.0 Size of the applet (width x height) 840 x 74 pixels Changeable in the HTML Code Number of variables 8Bit (=1Byte) not changeable Update time in ms 1000 Changeable in the HTML Code Picture “GrundrissEG.gif” 305 x 148 Pixel Picture “GrundrissOG.gif” 304 x 151 Pixel V1.0 24.09.2008 Download at Entry-ID 22964892 38/40 Basic Performance Data Java-Applet Entry -ID: 24207239 Applet “S7Table.jar” Table 6-3 Criterion Basic performance data Additional note Required Java Runtime version JRE version 1.6.0_03 JAVA S7 Beans Library Version 2.5.5 Size (kBytes) 12 Web browser Internet Explorer V7.0 Size of the applet (width x height) 838 x 183 pixels Changeable in the HTML Code Number of variables 48Bit (=6Byte) Changeable the configuration file Update time in ms 1000 Changeable in the HTML Code Picture “Lageplan.gif” 824 x 387 pixels Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc Download at Entry-ID 22964892 V1.0 24.09.2008 39/40 Appendix Java-Applet 7 Entry -ID: 24207239 Appendix Table 7-1 Topic /1/ Title • IE CP • • • • • Copyright © Siemens AG 2008 All rights reserved 24207239_BitArray_Applet_V10_en.doc • 8 Manual CP343-1 IT (6GK7 343-1GX20-0XE0 / 6GK7 343-1GX11-0XE0) Entry-ID: 8776544 Manual CP343-1 Adv (6GK7 343-1GX21-0XE0) Entry-ID: 22261695 Manual CP343-1 Adv (6GK7 343-1GX30-0XE0) Entry-ID: 28017299 Manual CP443-1 IT (6GK7 443-1GX11-0XE0) Entry-ID: 8776322 Manual CP443-1 Adv (6GK7 443-1EX40-0XE0) Entry-ID: 19308980 Manual CP443-1 Adv (6GK7 443-1EX41-0XE0) Entry-ID: 23643789 Manual CP443-1 Adv (6GK7 443-1GX20-0XE0) Entry-ID: 28011203 History Table 8-1 Version V1.0 V1.0 Date 24.09.2008 Modification First issue 24.09.2008 40/40