WinCC User Archives
WinCC User Archives
WinCC User Archives
Manual
C79000-G8263-C141-01
WinCC, SIMATIC, SINEC, STEP are Siemens registered trademarks. All other product and system names in this manual are (registered) trademarks of their respective owners and must be treated accordingly.
(The reproduction, transmission or use of this document or its contents is not permitted without express written authority. Offenders will be liable for damages. All rights, including rights created by patent grant or registration of a utility model or design, are reserved.)
(We have checked the contents of this manual for agreement with the hardware and software described. Since deviations cannot be precluded entirely, we cannot guarantee full agreement. However, the data in this manual are reviewed regularly and any necessary corrections included in subsequent editions. Suggestions for improvement are welcomed.)
Siemens AG 1994 - 1998 All rights reserved C79000-G8263-C141-01 Printed in the Federal Republic of Germany
Siemens Aktiengesellschaft
Table of Contents
1 Introduction ...........................................................................................1-1
1.1 1.2 1.2.1 1.2.2 1.2.3 1.3 1.4 1.5 Application of the User Archives....................................................................1-1 Components of the User Archives .................................................................1-1 The User Archives Editor ...............................................................................1-2 The User Archives Control.............................................................................1-3 User Archives Script Functions......................................................................1-3 Configuration and Runtime ............................................................................1-3 Functionality of the User Archives .................................................................1-6 Legend ...........................................................................................................1-7
3 4
The Table Window of the User Archives Editor..................................3-1 Menus and Toolbar of the User Archives Editor ................................4-1
4.1 4.2 The Menus of the User Archives Editor .........................................................4-1 The Toolbar of the User Archives Editor........................................................4-5
Table of Contents
11.98
ii
11.98
Table of Contents
Appendix................................................................................................8-1
8.1 8.2 8.3 8.3.1 8.3.2 8.4 The SQL Language........................................................................................8-1 Alphabetical List of SQL Keywords................................................................8-2 Specifications.................................................................................................8-3 Performance while Writing and Reading Tags ..............................................8-4 Performance of the Picture Opening Times...................................................8-4 Note the Following .........................................................................................8-5
iii
Table of Contents
11.98
iv
11.98
Preface
Preface
Purpose of the Manual This manual introduces you to the functions of each software component and their operation in a reference manual format. You can find the information you need quickly by using the table of contents or the index. Naturally, the information is also available to you in the on-line help in either a context-sensitive fashion or in the on-line help contents.
Total Overview and Configuration Example The "Getting Started" manual, which is part of the WinCC package, contains a total overview of WinCC and a configuration example in which the most significant functions of the individual components are followed through in a practical application.
Additional Support If you have technical questions, please address them to your Siemens contact partner, located in the businesses responsible for your location. You can find the addresses in the attachment entitled Siemens Worldwide, in "S7-300 Automation System Structure in an S7300," in catalogs, and on CompuServe (go.autforum). In addition, you may call our Hotline at 011-49-911-895-7000 (Fax 7001). You can find additional information on the Internet under the address www.aut.siemens.de/coros/html_00/coros.htm. Information about SIMATIC products Up to date information about SIMATIC products can be obtained: from the Internet under http://www.aut.siemens.de/ via fax# 08765-93 02 77 95 00 In addition, the SIMATIC Customer Support provides current information and downloads that can be beneficial for the utilization of SIMATIC products: from the Internet under http://www.aut.siemens.de/support/html_00/index.shtml via the SIMATIC Customer Support Mailbox under phone# +49 (911) 895-7100 To address the mailbox, use a modem with up to V.34 (28.8 kBaud), which parameters must be set as follows: 8, N, 1, ANSI, or dial up through ISDN (x.75, 64 kBit). The SIMATIC Customer Support can be reached by phone under the number +49 (911) 895-7000 and by fax under the number +49 (911) 895-7002. Inquiries can also be made via Internet mail or mail addressed to the above mailbox.
Preface
11.98
vi
11.98
Introduction
1 Introduction
The to the User Archives Editor contains the following information: Application of the User Archives Components of the User Archives Configuration and Runtime Functionality of the User Archives Legend
1-1
Introduction
11.98
The Navigation Window (the window at the top left) for selecting archives and views. The Data Window (the window at the top right) for displaying and editing fields. The Data Window displays the fields of the archives and views, which were selected from the navigation window. The Table Window (the window at the bottom) for displaying and changing online data of the selected archives and views. In the table window of the User Archives Editor, an online connection to the process pictures of the PLCs can be made. The navigation and data windows of the User Archives Editor provide fast access to all elements of the User Archives, utilizing a Windows Explorer-like user interface. The creation and editing of User Archives is done user-friendly via dialog boxes and wizards.
1-2
11.98
Introduction
Example: Acquisition of Operating Data of a Turbine An electric utilities company creates the "HPTurbine1" User Archive. This archive monitors the operating conditions of a high pressure turbine. The "HPTurbine1" User Archive contains the following data fields: HDTurbine1 Index RPM Entry Pressure Outlet Pressure Steam Temperature1 Steam Temperature2 Oscillation Frequency Oscillation Amplitude Storage Temperature1 Storage Temperature2
1-3
Introduction
11.98
In runtime, at set time intervals, the operating data of the turbine can be stored on your hard drive in the form of User Archives data records:
S5 / S7 AS data script functions script functions The User Archive script functions are storing the data set HDTurbine1any 15 minutes on the harddisk
data set 805 data set 804 data set 803 data set 802
The data are stored any 15 minutes in the preconfigured data set
Using the User Archives script functions, data can then be analyzed or be visualized through the "WinCC User Archives Table Control" OLE control. Example: Recipes of a Beverage Producer An example for a data flow to a PLC are recipes. A beverage producer, which in our example produces Cola and orange juice, uses User Archives to provide recipes of the ingredients to PLCs (S5, S7, AllenBradley, Applicom, etc.). Archive Cola Data Fields Water Sugar Coloring7 Phosphoric Acid Caffeine
The User Archives use the data interfaces to the PLCs that are provided by WinCC, especially the raw data of the WinCC data manager. For the data transfer from/to PLCs, WinCC provides a set of action scripts. Application of the Views WinCC offers the "Views" as an additional feature. Views allow data fields of different User Archives to be summarized. For example, product groups, which are located in data fields of different User Archives, can be summarized in views.
Archiv Cola Data fields Water Sugar color7 Phophoric acid Caffein Data fields Water Orange juice Color6
View
Colors
Archiv Juice
1-4
11.98
Introduction
In our example, the beverage producer creates views for the flavoring and coloring product groups, which are located in different User Archives.
Note Existing software, which performed direct ODBC database accesses to the User Archives of versions older than 4.0, will not be able to access User Archives of version 4.0. For User Archives databases older than version 4.0, the User Archives editor provides a converter for converting to the new User Archives format. Software with direct ODBC accesses, must be adapted to the new format of version 4.0 User Archives.
1-5
Introduction
11.98
Control Tags Wizard-supported creation of WinCC tags as control tags Fast access to User Archives for scripts and PLCs Indirect addressing in script programs
1.5 Legend
This manual uses the following symbols and fonts: indicates action via the left mouse button R indicates action via the right mouse button Text texts that you enter yourself are displayed in the Courier font
File New all WinCC menus, functions and entry fields that must be selected, are displayed in Italic
1-6
11.98
Configuration
2-1
Configuration
11.98
The User Archives are used as follows: Archives: Contains an archive each for the Cola and orange juice. Views: Views summarize data fields of the two archives. In the example, this is the coloring product group. Each archive consists of data fields with properties that can be edited. In the example, the data fields of the Cola archive contain its ingredients. Each data field has properties (like name, alias name, type, length, value, etc.). The display of the data fields and their properties in the User Archives editor takes place in lines and columns. Therefore, we will also refer to the data fields as lines and to the properties as columns. For example, the structure of the Cola archive looks as follows: Cola Archive Data Fields (Lines) Water Sugar Coloring7 Caffeine Phosphoric Acid Properties (Columns) Name Alias Type Water Sugar C1007 Caffeine Phos. A. Well 5 Zmela D1007 Caffeine PhosAc Int Int Int Int Int
Note If you make changes to the configuration of an archive, this archive must not be displayed by a Control or be requested by the "UAQueryArchive" script function at the same time.
The preset option "Create Multiple Archives in Sequence" allows the sequential creation of multiple archives. If only one archive is to be created, this option can be deactivated from the "Edit - Options" menu. To create an User Archive, proceed as follows: In the navigation window, click on Archives. R Right-click on the navigation or data window. The "New Archive" button will be displayed.
2-2
11.98
Configuration
Click on the "New Archive" button. The "General Information" dialog box will be displayed. A new User Archive is created using this dialog box.
As the archive name, for example, enter "Cola". In the "Alias" field, a second name can be entered, for example "Calif Cola". The usage of an alias name is optional. The field can be left blank, or be used for comments, explanations, etc. If the "Limited" archive type is specified, the maximum number of data records can be defined in the "Number" field. The "Unlimited" archive type defines archives with an unlimited number of data records.
Note Keywords (or reserved words) of the database language SQL must not be used as archive or field names. See also the "Alphabetic List of SQL Keywords" chapter. Data records are not checked for completeness or correctness while they are created.
2-3
Configuration
11.98
At the "Type" entry, the communication type can be defined: None: No communication possible Via Raw Data Tag: Access to PLC via a raw data tag Via Data Manager Tag: Access to PLC via WinCC tags To establish a connection via raw data tags, select "via Raw Data Tag". Enter the identification of the PLC in the "PLCID" field. The "PLCID" can contain a maximum of 8 ASCII characters. This identifier describes the corresponding archive and is required in order for the PLC to sent back the process picture data to the correct archive. If you selected "via Raw Data Tag", clicking on "Select" allows you to choose a raw data tag.
2-4
11.98
Configuration
In the four entry fields of the dialog box, WinCC tags are assigned to an "Archive ID", an instruction code, an archive field and a set/return value. Each of these entry fields contains a "Select" button. It helps you with the assignment of the corresponding WinCC tag. After clicking on the "Select" button, the "Select Tag" dialog box is displayed in which all previously created WinCC tags are listed and can be selected. To simplify the assignment of WinCC tags even further, the "Generate" button is provided. This button automatically generates four new WinCC tags as the User Archives control tags. Clicking on the "Generate" button will display on the "Generate Control Tags" dialog box:
2-5
Configuration
11.98
In there you can define, if you want to use internal or external tags. You can also change the preset names for the tag group and WinCC tags. Clicking on the "Edit" button will display the "Tag Properties" dialog box. The properties of the control tags can be edited in this dialog box.
By writing the identifier of the archive, the instruction code (6, 7 or 8), the archive field and the set value (for writing) into the control tags, the archives can accessed in read and write mode. For reading (instruction code = 6), the read value will be placed in the corresponding control tag (in the example above, the "@UA_Cola_Value" tag). Function of the Control Tags ID The identifier (or data record number) of the archive Instruction Code Three instruction codes are possible: Read, Write and Delete Read =6 Write = 7 Delete =8 Field The archive field Value The set or return value
2-6
11.98
Configuration
The currently set authorization levels for the read and write access are displayed. To change these settings, click on one of the "Select" buttons. The "Authorization Levels" dialog box will then be displayed, which makes available the authorization levels that have been created by the User Administrator:
Activating the "Column - Last Access" option creates a column containing the date and time of the last access. The "Column - Last User" option creates a column containing the name of the user who last accessed the User Archive.
2-7
Configuration
11.98
Select one of the authorization levels. For example, select the "Column - Last User". Complete the archive creation by clicking on "Finish". If you selected the "Create Multiple Archives in Sequence" option from the "Edit - Options" menu, the "Create Next Archive?" dialog box will be displayed. If you select "Yes", the initial "General Information" dialog box for defining the next archive will be displayed. This completes the creation of the blank "Cola" User Archive, which from now on will be displayed in the User Archives editor:
Save the new User Archive by clicking on the "Disk" (save) icon or go to the "Project - Save" menu. Note Changes made to an User Archive only become effective after saving that User Archive. In our example, the properties of the Cola archive are: Archive Cola Properties Name Cola Alias Calif Cola Type: Unlimited Max. Records: 1 Com. Type: Raw PLCID: S7112 Tag Name: CalifTagGroup Right read: 0 Right write: 0 Flags: U Pos.: 3 Last access: 03/05/98 12:54
2-8
11.98
Configuration
The "Archive Properties" dialog box will then be displayed, in which you can change the properties. The "General Information", "Communication", "Flags" and "Select Authorization" tabs are described in the "Creation of a New User Archive" chapter. The additional "Sequence" tab defines the sequence of the archives.
2-9
Configuration
11.98
Save the User Archive by clicking on the "Disk" (save) icon or go to the "Project Save" menu. Note Changes made to an User Archive only become effective after saving the database.
Click on New Field. The "General Information" dialog box will be displayed. Note If archive fields are changed, data might be lost under the following circumstances: If a new consistency requirement can not be met anymore by already existing data, e.g. for "Unique", "Not Null", etc. If a field has been renamed. If a new data type is unable to convert the data from the source.
2-10
11.98
Configuration
In the Field Name entry field, enter the name of the first archive field. In our example, this is the recipe ingredient "Water". In the "Alias" field, a second alias name can be entered. The field can also be used for comments or explanations. The names entered serve for the later assignment of the fields for the tabular display. In the Type entry field, one of the following tag types can be selected: Integer Double String Date/Time
2-11
Configuration
11.98
Minimum, Maximum and Start Value A period must be used if minimum, maximum and start values of the "Double" type, and decimal values, are entered. WinCC Tag Here you can create a WinCC tag that will store the value of the archive field. Follow one of these steps: 1. Enter the tag directly in the input field. 2. Interactively choose a tag or create a new one by clicking on the "Select" button. 3. Automatically generate a new tag by clicking on the "Create" button. 4. Edit the properties of an existing tag by clicking on the "Edit" button.
2-12
11.98
Configuration
Rights Using the "Select" buttons, the read and write access rights can be defined. These access rights are defined in the User Administrator. The creation of access rights is performed as described in the "Creation of a New User Archive" chapter. Flags In the "Flags" area, the following properties can be defined for the selected data field: "Field must contain a Value": The field must contain a value other than zero. "Field must contain an unique Value": The field must contain an unique value, i.e. the values in this column must differ from one another. "Field supported by an Index": The field is supported by an index value. This index, for example, can increase the performance of search commands. Complete the data field creation by clicking on the "Finish" button. This will create a new data field in the "Cola" User Archive. If you selected the "Create Multiple Fields in Sequence" option from the "Edit - Options" menu, the "Create Next Field?" dialog box will be displayed. If you select "Yes", the initial "General Information" dialog box for defining the next field will be displayed.
2-13
Configuration
11.98
Note Changes made to an User Archive only become effective after saving the database.
To edit the data fields of an User Archive, proceed as follows: R In the data window of the User Archives editor, right-click on the "Water" field name. Select "Properties" from the pop-up menu.
The "Field Properties" dialog box will then be displayed, in which the selected property can be changed.
2-14
11.98
Configuration
The "General Information", "Values", "Flags" and "Select Authorization" tabs are described in the "Defining the Archive Fields" chapter. The additional "Sequence" tab defines the sequence of the archive fields.
2-15
Configuration
11.98
In our example, the Cola archive contains the following properties: Archive Cola Data Fields Water Properties Name Water Alias Water_from_Well_4 Type: Length: Precision: Min. Value: 1000 Max.Value: 1200 Start Value: 1100 Tag n... : Right (read): 0 Right (write): 0 Flags: P... : Sugar Name Alias .... Coloring7 Name Alias .... Caffeine Name Alias .... Phosphoric Acid Name Alias .... NN 3 Integer
Note Changes made to an User Archive only become effective after saving the database.
2-16
11.98
Configuration
Right-click on the navigation or data window. The button "New View" will be displayed.
Click on the "New View" button. The Wizard for configuring views will be activated. The "General Information" dialog box will be displayed, in which a new view can be created.
2-17
Configuration
11.98
As the view name, for example, enter "Cola". In the "Alias" field, a second name can be entered, for example "Calif Cola". Click on the "Finish" button. This creates a new, but still blank, view:
If you selected the "Create Multiple Views in Sequence" option from the "Edit - Options" menu, the "Create Next View?" dialog box will be displayed. If you select "Yes", the initial "General Information" dialog box for defining the next view will be displayed. Save the view.
Note Changes made to views only become effective after saving the database.
2-18
11.98
Configuration
You can change the names in the "View Name" and "Alias" fields. The date and time of the last modification are also displayed.
2-19
Configuration
11.98
Relation In the "Relation" field, SQL expressions can be entered directly. The appendix contains additional information about the SQL Language. Conditions In the "Field OP" area, conditions can be entered interactively. To do so, select entries from the left and right "Field" list boxes and set the relation by selecting an operation from the "OP" list box. Click on the "Add" button to apply the condition. This condition will then be displayed in the "Relation" field.
2-20
11.98
Configuration
Procedure: Select a view via a mouse click. Use the "Up" and "Down" buttons to move the view one position up or down.
Click on New Column. The "General Information" dialog box will then be displayed.
2-21
Configuration
11.98
In the "Archive" field, you can select one of the created User Archives. For example, keep the "Cola" archive setting. In the "Archive Field", select one data field of the Cola User Archive. For example, keep the "Coloring7" setting. TAB to the next field or select a field using the mouse. In the Column Name entry field, enter the name for the first column of the view, for example "Coloring". In the "Alias" field, a second name, comments or explanations can be entered. This entry is optional.
Note The User Archives editor will only display archives and archive fields that have been saved since their last editing.
The beverage producer in our example creates a Coloring view in which he summarizes the Coloring7 and Coloring16 data fields from the Cola and Orange Juice User Archives. If you selected the "Create Multiple Columns of a View in Sequence" option from the "Edit - Options" menu, the "Create Next Column?" dialog box will be displayed. If you select "Yes", the initial "General Information" dialog box for defining the next column will be displayed. Save the field of the view. Note Changes made to views only become effective after saving the database.
2-22
11.98
Configuration
The "General Information" tab contains the same fields as the tab used for creating a new view column. The date and time of the last change are displayed in the "Changed" field.
2-23
Configuration
11.98
Procedure: Select a view via a mouse click. Use the "Up" and "Down" buttons to move the view one position up or down.
2-24
11.98
Via the "Edit - Runtime Data" menu or the corresponding button, the table window can be turned on or off. Double-clicking on one of the table fields enables the data entry. This is marked by a text cursor. You can navigate around the table using the arrow keys. Working in the User Archives editor table resembles the User Archive OCX table.
Note If one or more values are changed in the User Archives Editor table or an OCX table, you must click somewhere else on the table after making the entry in order for the value to be accepted into the database and be updated in all displays.
3-1
11.98
3-2
11.98
Restore The "Restore" menu command discards the changes made and restores the last saved state. Additionally, this function allows you to apply changes that have been made and saved by scripts or external programs since opening the editor. These external changes are not automatically provided to the editor. Convert This menu command allows WinCC V3.x User Archives to be converted to the new WinCC V4.02 User Archives format.
4-1
11.98
The conversion is carried in two steps: 1. 2. Conversion of the archive structure. Conversion of the runtime data.
To convert the archive structure, proceed as follows: 1. 2. 3. Select the User Archive to be converted and start the conversion by clicking on the "Convert" button. After successful conversion, exit the dialog window by clicking on the "Close" button. Save the converted archive structure.
To convert the runtime data, proceed as follows: 1. 2. Select the "Project - Convert" menu command. In the "Covert Old Archives" dialog window, click on the "RT Data" button. This will open the "Convert Runtime Data" dialog window.
3. 4. 5.
Select the old and newly converted archive and start the conversion by clicking on the "Convert" button. Close the "Convert Runtime Data" dialog window. Close the "Convert Old Archives" dialog window.
4-2
11.98
Runtime Data This menu command allows you to edit online data in the table window. A check mark next to this menu indicates that the "Runtime Data" status is active. Options This menu command defines how User Archives/views and their entries are created. The following dialog box will be displayed after clicking on this menu:
Create Multiple Archives in Sequence: If this option is checked, a dialog box for defining an additional archive will automatically be displayed after an User Archive has been created. Create Multiple Fields in Sequence: If this option is checked, a dialog box for defining an additional data field will automatically be displayed after an User Archive data field has been created. Create Views in Sequence: If this option is checked, a dialog box for defining an additional view will automatically be displayed after a view archive has been created. Create Multiple Columns of a View in Sequence: If this option is checked, a dialog box for defining an additional column will automatically be displayed after a view column has been created. Divide Adjust the size of the three windows of the User Archives editor using this menu command. Import Use this menu command to import User Archives.
4-3
11.98
In the "File Selection" field, enter the path and file name of the User Archive to be imported. The "..." button helps you to select the file. In the "File Format" field, the file format of the file to be read can be defined. The "Options" button allows you to set the desired separator. The default separator is the ";" semicolon. In the "Archive Selection" field, an archive of the current project can be selected. The import process is initiated after clicking on the "Import" button. The structure of the source and target archives must be identical, otherwise the import will fail. Export Use this menu command to export User Archives.
In the "File Selection" field, enter the path and file name of the User Archive to be exported. The "..." button helps you to select the file. In the "File Format" field, the file format in which the archive is to be written can be selected. The "Options" button allows you to set the desired separator. The default separator is the ";" semicolon. In the "Archive Selection" field, an archive of the current project can be selected.
4-4
11.98
In the "Filter" field, an export filter can be defined. In the "Filter for Field" box, the field the filter is referring to is specified. In the "from ... to" boxes, the value range passing the filter is entered. Selecting the "SQL Expression" radio button allows you to enter a filter expression using the SQL language. Additional information about SQL expressions can be found in the appendix. The export process is initiated after clicking on the "Export" button.
4-5
11.98
4-6
11.98
The User Archives Table Control offers two views: The table view and the form (userdefined) view. The Table View The table view displays the User Archives in tabular form. Each data record occupies one line with multiple columns, forming multiple data fields for each record. The Form (User-Defined) View The form view provides a user interface, which can be defined by the user. The form view of the User Archives offers three field types: Static Texts, Input Fields and Buttons.
5-1
11.98
2. 3. 4.
5-2
11.98
2. 3.
In the Source input field, define the archive or view which is to be displayed in the Control. Click on "Archive" and then select "Cola". In the Process field, the runtime access type can be set. Deactivate the "Read Only" check-box. The "Insert", "Change" and "Delete" access types will be listed. Activate them. The "Frame" check-box defines, if the OCX window is displayed framed/unframed. Activate this option.
4.
5-3
11.98
2.
This icon allows you to switch between the form and table views. Click on this icon to display the form view. Now you can start with the configuration of the form. The following form will be created:
5-4
11.98
After clicking on the "Insert Text Field" selection, the "Text Field Properties" dialog box for the configuration of the text will be displayed.
In the "Text" field, enter the text "Cola Input Form" as the title of the form.
Select "Insert Edit Field". The "Edit Field Properties" dialog box will be displayed:
5-5
11.98
Click on the icon. All configured data fields of the "Cola" archive are available for selection from the list-box. Select the "Water" field. You can also define additional edit fields, e.g. Sugar, Coloring7, Caffeine, Phosphoric Acid, etc.
Select "Insert Button". The "Button Properties" dialog box for changing the button field will be displayed:
In the "Text" field, the button label can be entered. Enter the text "Table View". In the "Action" field, one of the icons for the form view can be selected. Your newly configured button will perform the same action as the corresponding icon from the toolbar. Select "Form" to enable switching to the table view. To define additional button fields, follow the steps outlined above. For example, a "Sort" button could be defined. This completes the configuration of the User Archives Control.
5-6
11.98
Note A complete description of all properties of the WinCC User Archives Control can be found in the Online Help.
5-7
11.98
Frame Form
Description The Archive/View selection buttons define, if an archive or view is configured. A previously configured archive/view can be selected in this field. In the Edit field, the runtime access type can be defined. If the "Read Only" check-box is deactivated, the "Insert", "Change" and "Delete" access types will be listed. The "Frame" check-box defines, if the Control window is displayed framed/unframed. The "Form" check-box defines, if the form view in the Control window should be the initial view.
5-8
11.98
Tab: Columns
Orientation Reset
Description In the Columns field, the fields - created by the User Archives Editor to be displayed in the process picture are defined. The Properties field allows you to define the properties of the field currently selected in the Columns field. The "Locked" check-box allows you to write-protect the selected field. In the "Format" field, the value display is defined: Fixed (fixed-point number), Scientific, Date, Time and TimeStamp. Currently, the selection of a format has no influence on the display of the value in runtime. The display of a date field always follows the "DD.MM.YY hh.mm.ss" format. The "Orientation" can either be "Left", "Centered" or "Right". The "Reset" button restores the previous setting.
5-9
11.98
Tab: Toolbar
Description The "Icons" field allows you to select the icons of the Controls toolbar. The "Access" field displays the access rights of the selected icon. Clicking on the "Select" button will display the "Authorization Levels" dialog box, in which you can define the desired access. The "Turn Off" button allows you to turn the toolbar on or off.
In the "Authorization Levels" dialog box, the desired access can be defined. The entries in this dialog box were previously set in the User Administrator.
5-10
11.98
Description The "Elements" selection buttons define the elements of the Controls status bar. The "Turn Off" button allows you to turn the status bar on or off.
If all elements of the status bar have been activated, the status bar will look as follows:
Tab: Filter/Sort
5-11
11.98
Sort
Description In the "Filter Condition" tab, the filter conditions are defined. Enter the rules for the filter conditions directly. These conditions are formulated using the database programming language SQL (Structured Query Language). The appendix contains a Description of SQL with several, practical examples. Example: FieldC > 100 All data records in the "FieldC" column containing values greater than 100 are selected. In the "Sort" tab, the sort conditions are defined. Enter the sorting rules directly using the database programming language SQL. See Description of SQL
Tab: Fonts
In the "Fonts" tab, the fonts used in the Control are defined. Tab: Colors
In the "Colors" tab, the colors used in the Control are defined.
5-12
11.98
2.
Defining a New Form Field: R In the Graphics Designer, right-click on the User Archives Control at the position, where you want to place the text. The following selection menu will be displayed:
The following field types are available: Text: A text field contains any static text. Edit: An edit field gives you display and editing possibilities for the current archives data fields. Button: A button provides you with a separate button instead of a form field icon.
5-13
11.98
After selecting "Insert Text Field", the "Text Field Properties" dialog box is displayed:
In the "Text" field, the desired text can be entered. If you expand the field, all field names will be provided as static text.
After selecting "Insert Edit Field", the "Edit Field Properties" dialog box is displayed:
In the "Field" field, one of the displayed fields can be selected. All fields of the archive, that has been set during configuration, are provided.
5-14
11.98
After selecting "Insert Button", the "Button Properties" dialog box is displayed:
In the "Text" field, the label for the new button can be entered. For example, if you enter "Table View", your button will be labeled with the text "Table View". In the "Action" field, one of the icons for the form view can be selected. Your newly configured button will perform the same action as the corresponding icon from the toolbar. For example, if you select the "Form" action, clicking on this button in runtime will switch you back to the table view.
This will display the corresponding dialog box for editing the form field, as described in the Defining a New "Text" Form Field, Defining a New "Edit" Form Field and Defining a New "Button" Form Field chapters.
5-15
11.98
The deletion will be carried out without a prior warning! The deletion can be reversed via the "Edit - Undo" command or the "CTRL - Z" key combination.
Note If the User Archives Control is in the form view while deleting, the background of the User Archives Control will remain after deletion. This background can be ignored, since it will disappear after additional Graphics Designer objects have been configured.
5-16
11.98
The table and form windows of the User Archives Control table is operated with this toolbar:
5-17
11.98
Note If one or more values are changed in the Control table, you must click somewhere else on the table after making the entry in order for the value to be accepted into the database and be updated in all displays. User Archive scripts must be able to select data records for themselves. A selection of data records via the User Archives Control is not possible.
Note If one or more values are changed in the User Archive Control form, you must click on another data record after making the entry in order for the value to be accepted into the database and be updated in all displays.
5-18
11.98
Switch This icon allows you to switch between the form and table views. Delete data record The highlighted data record is deleted. Define a new data record Enter values into the data fields sequentially and acknowledge input each time by clicking on this icon. After making all entries, the data record with the entered values will be created. Edit an existing field After clicking on this icon, click on the field you want to edit. This will display the cursor, signaling the editability of this field. As long as the "Edit an existing field" icon is active, the User Archives Control is in the "Edit" mode. This means that you can move the cursor around the table and make changes immediately. If the "Edit" mode is turned off, changes can only be made after pressing the F2 hotkey or double-clicking on the field to be changed. Page through the table window These buttons allow you to page forward/backward in the table window and to jump to the beginning/end of the archive. Read or write from tags These buttons allow you to read and write from WinCC tags. While configuring the archive (in "Archive Properties" dialog box - "Communication" tab), the communication type Communication via WinCC Tag must be specified. In the "Control Tag" tab, a Control Tag must be defined.
5-19
11.98
Import/export archives Clicking on these icons imports/exports User Archives in the CSV (Coma Separated Value) format. Warning! Before exporting to Excel, the CSV file type must be specified in order for the exported WinCC CSV file to be read correctly. Define filter conditions This option allows the input of filter conditions. The filter conditions are formulated using the database programming language SQL (Structured Query Language). The appendix contains a Description of SQL with several, practical examples. Additional information can be obtained from appropriate literature. Example: ID < 100 Only data fields with IDs ranging from 1 to 99 will be selected, all other data fields will not be displayed. Define sort conditions This option allows the input of sort conditions. Enter the sorting rules directly using the database programming language SQL. Also refer to the Description of SQL in the appendix. Additional information can be obtained from appropriate literature. Request help Click on this icon to request help for the User Archives Control.
5-20
11.98
Note User Archives scripts must be able to select data records for themselves. A selection of data records via the User Archives OCX control is not possible. If a program has opened an User Archive and a record is added or deleted via a control or the User Archives editor, that program will not be informed about the change. Only after a requery will the changes be known to the program.
6-1
11.98
6-2
11.98
6-3
11.98
Handles for the Runtime Archive Functions UaConnect -> Handle UAHCONNECT required from: uaDisconnect uaQueryArchive --> Handle UAHARCHIVE uaQueryArchiveByName --> Handle UAHARCHIVE required from: uaArchiveOpen Prerequisite for: uaArchiveClose uaArchiveDelete uaArchiveExport uaArchiveGetFieldLength uaArchiveGetFields uaArchiveGetFieldType uaArchiveGetFieldValueDate uaArchiveGetFieldValueDouble uaArchiveGetFieldValueLong uaArchiveGetFieldValueString uaArchiveGetFieldName uaArchiveGetFilter uaArchiveGetID uaArchiveGetName uaArchiveGetSort uaArchiveImport uaArchiveInsert uaArchiveMoveFirst uaArchiveMoveLast uaArchiveMoveNext uaArchiveMovePrevious uaArchiveReadTagValues uaArchiveReadTagValuesByName uaArchiveRequery uaArchiveSetFieldValueDate uaArchiveSetFieldValueDouble uaArchiveSetFieldValueLong uaArchiveSetFieldValueString uaArchiveSetFilter uaArchiveSetSort uaArchiveUpdate uaArchiveWriteTagValues uaArchiveWriteTagValuesByName uaReleaseArchive
6-4
11.98
The following example describes two standard functions for reading and writing from and to an User Archive in runtime. The "UAReadFromArchive" function reads the "Cola" archive and displays the data read in the "Global Script Diagnostics Window". The "UAWriteToArchive" function writes to the archive and displays states and messages. The diagnostics window is created by placing an OLE Control, from the Object Palette -> Smart Objects -> OLE Control, in the Graphics Designer and then selecting the "WinCC Global Script - Diagnostics Control" from the "Insert OLE Control (OCX)" dialog box. In the Graphics Designer, create a new screen for your project. In this screen, create the "Read Archive" and "Write Archive" buttons and add the following script functions. The procedure is as follows: In the Graphics Designer, from the "Object Palette" -> "Windows Objects", select "Button". Place the button in the Graphics Designer and size it while keeping the mouse button pressed. R Right-click on this new button and select "Properties" from its pop-up menu. In the "Properties" tab, the button label (text) and color can be defined. The labels, for example, could read "Read Archive" and "Write Archive". In the "Events" tab, add an action to the mouse by selecting "Mouse" and then double-clicking on "Mouse Action". This will display the script editor. Enter the UAReadFromArchive standard script function listed below:
6-5
11.98
#include "apdefap.h" void UAReadFromArchive() { UAHCONNECT hConnect; UAHARCHIVE hArchive; LONG IndexArchive; LONG FieldLength; LONG FieldType; LONG NumberOfFields; LONG Index; long IntValue; double DoubleValue; char ArchiveName[255], StringField[255]; SYSTEMTIME SysDate; //******* Connect to User Archives Component **************************** if ( uaConnect( &hConnect ) == FALSE ) { printf( "uaConnect error: %d\n", uaGetLastError() ); return; } if ( hConnect == NULL ) { printf( "Handle UAHCONNECT equals NULL\n" ); return; } //******* Connect to Archive via Archive Name **************************** if ( uaQueryArchiveByName( hConnect, "Chili", &hArchive ) == FALSE ) { printf( "uaQueryArchive Error: %d\n", uaGetLastError() ); return; }
//******* Opens Archive*********************************************** if ( uaArchiveOpen( hArchive ) == FALSE ) { printf( "uaArchive Open Error\n" ); return; } //******* Get Number of Fields ***************************************** NumberOfFields = uaArchiveGetFields( hArchive ); printf( "Number of Fields = %u\n", NumberOfFields ); //******* Read and Show Data Fields ************************************ for ( Index = 1; Index < NumberOfFields; Index ) { printf( "Data of Field %u: \n", Index ); FieldType = uaArchiveGetFieldType( hArchive, Index ); switch ( FieldType )
6-6
11.98
{ case UA_FIELDTYPE_INTEGER : printf("Field Type = Integer\n"); if ( uaArchiveGetFieldValueLong (hArchive, Index, &IntValue ) == TRUE) printf( "Field Value = %u\n", IntValue ); else printf("Error calling uaArchiveGetFieldValueLong: %d\n", GetLastError() ); break; case UA_FIELDTYPE_DOUBLE : printf("Field Type = Double\n"); if ( uaArchiveGetFieldValueDouble ( hArchive, Index, &DoubleValue ) == TRUE ) printf( "Field Value = %g\n", DoubleValue ); else printf( "Error calling uaArchiveGetFieldValueDouble: %d\n", uaGetLastError() ); break; case UA_FIELDTYPE_STRING : printf("Field Type = String\n"); if ( uaArchiveGetFieldValueString ( hArchive, Index, StringField, 20 ) == TRUE ) printf( "Field Value = %s\n", StringField ); else printf( "Error callinguaArchiveGetFieldValueString: %d\n", uaGetLastError() ); break; case UA_FIELDTYPE_DATETIME : printf("Field Type = Date & Time\n"); if ( uaArchiveGetFieldValueDate (hArchive, Index, &SysDate) == TRUE ) printf( "%d.%d.%d\n ",SysDate.wDay, SysDate.wMonth, ysDate.wYear); else printf( "Error calling uaArchiveGetFieldValueLong: %d\n", uaGetLastError() ); break; case -1 : default : printf( "Error executing uaArchiveGetFieldType\n"); } //******* Read and Show Field Length ************************************** FieldLength = uaArchiveGetFieldLength( hArchive, Index ); if ( FieldLength != -1 ) printf( "Field Length = %u\n", FieldLength ); else printf( "Error executing uaArchiveGetFieldLength\n"); }
6-7
11.98
//******* Close Archive ************************************************** if ( uaArchiveClose ( hArchive ) == FALSE ) { printf( "error on closing archive\n" ); return; } //****** Release Connection to Archive ************************************* if ( uaReleaseArchive ( hArchive ) == FALSE ) { printf( "error on releasing archive\n" ); return; } //******* Disconnect User Archives Component ************************* if ( uaDisconnect ( hConnect ) == FALSE ) { printf( "error on disconnection\n" ); return; } }
Create a second button for writing to the archive. Follow the procedure described for the first button. This time, name the standard script function UAWriteToArchive and enter the following script:
void UAWriteToArchive() { UAHCONNECT hConnect; UAHARCHIVE hArchive; LONG IndexArchive; LONG FieldLength; LONG FieldType; LONG NumberOfFields; LONG Index; long IntValue; double DoubleValue; char StringField[255]; SYSTEMTIME SysDate; //******* Connect to User Archives Component ************************** if ( uaConnect( &hConnect ) == FALSE ) { printf( "uaConnect error: %d\n", uaGetLastError() ); return; }
6-8
11.98
if ( hConnect == NULL ) { printf( "Handle UAHCONNECT equals NULL\n" ); return; } //******* Connect to Archive via Name ************************************* if ( uaQueryArchiveByName( hConnect, "Chili", &hArchive ) == FALSE ) { printf( "uaQueryArchive Error: %d\n", uaGetLastError() ); return; } //******* Opens Archive ************************************************* if ( uaArchiveOpen( hArchive ) == FALSE ) { printf( "uaArchive Open Error\n" ); return; } //******* Get Number of Fields ******************************************** NumberOfFields = uaArchiveGetFields( hArchive ); printf( "Number of Fields = %u\n", NumberOfFields ); //******* Read Last Data Set ********************************************** if ( uaArchiveMoveLast( hArchive ) == TRUE ) printf( "Number of Fields = %u\n", NumberOfFields ); else { printf( "uaArchiveMoveLast Error: %d\n", uaGetLastError() ); return; } //******* Write into Data Fields ******************************************** IntValue = 32; DoubleValue = 64; strcpy( StringField, "Text12" ); GetSystemTime( &SysDate ); for ( Index = 1; Index < NumberOfFields; Index ) { printf( "Data of Field %u: \n", Index ); FieldType = uaArchiveGetFieldType( hArchive, Index );
6-9
11.98
switch ( FieldType ) { case UA_FIELDTYPE_INTEGER : printf("Field Type = Integer\n"); if ( uaArchiveSetFieldValueLong ( hArchive, Index, IntValue ) == TRUE ) printf( "Field Value = %u\n", IntValue ); else printf( "Error calling uaArchiveSetFieldValueLong: %d\n", uaGetLastError() ); break; case UA_FIELDTYPE_DOUBLE : printf("Field Type = Double\n"); if ( uaArchiveSetFieldValueDouble ( hArchive, Index, DoubleValue ) == TRUE ) printf( "Field Value = %g\n", DoubleValue ); else printf( "Error calling uaArchiveSetFieldValueDouble: %d\n", uaGetLastError() ); break; case UA_FIELDTYPE_STRING : printf("Field Type = String\n"); if ( uaArchiveSetFieldValueString ( hArchive, Index, StringField ) == TRUE ) printf( "Field Value = %s\n", StringField ); else printf( "Error calling uaArchiveSetFieldValueString: %d\n", uaGetLastError() ); break; case UA_FIELDTYPE_DATETIME : printf("Field Type = Date & Time\n"); if ( uaArchiveSetFieldValueDate ( hArchive, Index, &SysDate ) == TRUE ) printf( "%d.%d.%d\n ", SysDate.wDay, SysDate.wMonth, SysDate.wYear ); else printf( "Error calling uaArchiveGetFieldValueLong: %d\n", uaGetLastError() ); break; case -1 : default : printf( "Error executing uaArchiveGetFieldType\n"); } FieldLength = uaArchiveGetFieldLength( hArchive, Index ); if ( FieldLength != -1 ) printf( "Field Length = %u\n", FieldLength ); else printf( "Error executing uaArchiveGetFieldLength\n"); }
6-10
11.98
//******* Close Archive ************************************************** if ( uaArchiveClose ( hArchive ) == FALSE ) { printf( "error on closing archive\n" ); return; } //****** Release Connection to Archive ************************************* if ( uaReleaseArchive ( hArchive ) == FALSE ) { printf( "error on releasing archive\n" ); return; } //******* Disconnect User Archives Component *************************** if ( uaDisconnect ( hConnect ) == FALSE ) { printf( "error on disconnecting\n" ); return; } }
You can now close the Script Editor and the Graphics Designer and start runtime. You can then observe the effect of your script function in the Global Script Diagnostics Window.
6-11
11.98
6-12
11.98
6-13
11.98
6-14
11.98
7-1
11.98
7-2
11.98
The Request Header Structure of the request header in detail (breakdown by Bytes): Field Function Request Length in Byte LSB Request Length in Byte MSB Request Type Reserved Field Number LSB Field Number MSB Data Record Number LSB . . Data Record Number MSB Selection Criterion LSB Selection Criterion MSB Comment Length of the field is 2 Bytes . see description Length of the field is 2 Bytes . Length of the field is 4 Bytes . . . Field number, according to which the selection is made (not for 0) Length of the field is 2 Bytes
7-3
11.98
Data of the Request The data of the request corresponds to the contents of a data record (or the addressed field). Important Note Text fields are not \0-terminated !!! Numbers must be transmitted in the Intel format (first LSB, last MSB). An Integer field has the length of 4 Bytes, a Double field 8 Bytes. The data is moved by the length of the field that has been selected as the selection criterion, if the selection criterion has a value unequal to 0. If the selection criterion is to be used, the beginning of the data range will be used as the selection value in the field size of the selection criterion.
Acknowledgment Header Structure of the acknowledgment header in detail (breakdown by Bytes): Field Function Message Length in Bytes LSB . . Message Length in Bytes MSB Transfer Type Reserved Request Type Reserved Reserved Field Number LSB Field Number MSB Data Record Number LSB . . Data Record Number MSB Name of the Archives 1st Character . . . . . . Name of the Archives 8th Character Comment Length of the field is 4 Bytes . . . 1 from WinCC, 2 from the PLC see description
Length of the field is 2 Bytes . Length of the field is 4 Bytes . . . The indication of the name is done in ASCII Length of the field is 8 Bytes . . . . .
Data of the Acknowledgment The acknowledgment either contains the data record, the addressed field (for a read request) or is empty (write request, archive request).
7-4
11.98
Description of the Request Types Type 4 5 6 7 8 9 10 Description Test archive for presence Delete all data records from the archive Read data record Write data record Delete data record Read data record field Write data record field
Description of the Error Codes Group General Archive Archive Data Record Data Record Field Field General General No. 0 1 2 101 102 201 202 254 255 Description Function has been executed Invalid data Data not available Invalid data Data not available Invalid data Data not available Function not available Undefined error
The decimal number 300 in the Intel format corresponds to the hex number 12C ( 1*256 2*16 12 ).
7-5
11.98
SIMATIC Format In the SIMATIC format, the least significant byte is stored at more significant place (moved by 1). In the "SIMATIC Format", the decimal number 300 is stored as follows: Bit Binary Hex 15 0 14 0 13 1 2 12 0 11 1 10 1 9 0 C 8 0 7 0 6 0 5 0 0 4 0 3 0 2 0 1 0 1 0 1
The decimal number 300 in the SIMATIC format corresponds to the hex number 2C01. If 2C01 is erroneously interpreted following the Intel format, the resulting decimal number would be 11265, a considerable deviation. For the SIMATIC PLCs, function blocks are available which can perform corresponding data conversions. These function blocks should always be called before and after a data transfer between the S5/S7 and WinCC. The function blocks can be downloaded from the Siemens Customer Support Internet site ( http://www.ad.siemens.de/support/html_00/download/s5-ag135.htm#.._download_s5ag135_angps5_3.htm ). Download the compressed "ANSI_S5.EXE" file. "ANSI_S5.EXE" contains the "IEEE:GP" function block. Active sending is described in the reference manuals of the PLCs and CPs (Communication Processors).
7-6
11.98
Appendix
8 Appendix
The appendix covers the following topics: SQL Statements for specifying sort and filter criteria of User Archives Alphabetical List of SQL Keywords; they must not be used as archive or field names in User Archives Specifications, in particular the Performance while Writing and Reading Tags and the Performance of the Picture Opening Times Note the Following
8-1
Appendix
11.98
alter asc break cast check commit convert cursor deallocate default do elseif escape exists for goto holdlock index instead is left match modify not off options out prepare proc real remote return save
and begin by char checkpoint connect create date dec delete double encrypted exception fetch foreign grant identified inner int isolation like membership named null on or outer primary procedure reference rename revoke savepoint
8-2
11.98
Appendix
schedule smallint start synchronize then tran union user varbinary view with
select some stop syntax_error time trigger unique using varchar when work
set sqlcode subtrans table tinyint truncate unknown validate variable where writetext
8.3 Specifications
Testing Environment The measurements described below have been taken in the following testing environment: Hardware Setup: Pentium II 266 / 64MB Connection: S5 Ethernet Layer 4 CP1413 with CP143 to S5-115U Project Environment: Message system with archiving and continuos load of 1 message/sec Process Value Archiving of 8 Values/sec Process Value Acquisition of 8 Values/sec Data Manager Tags and Raw Data Tags The data manager tags of WinCC were measured. The measurements show that access times increase with archive size. For larger archives, the application of raw data tags is recommended. Raw data tags transfer data in packets and also provide faster access times in large archives.
8-3
Appendix
11.98
8-4
11.98
Appendix
8-5
Appendix
11.98
8-6
11.98
Index
Index
A
Action Script 6-1 Archive Field Configuration 2-10 Archives 1-1 Authorization Levels 2-7
N
Navigation Window 1-2
P
Properties of the User Archives Contro 5-7 Properties of View Fields 2-23 Properties of Views 2-19
C
Configuration 1-3 Configuration of Form Fields 5-13 Configuration of User Archives 2-2 Configuration of View Fields 2-21 Configuration of Views 2-17 Configuration Steps 2-1 Configuring User Archives Control 5-2 Control Tags Dialog Box 2-5
R
Recipe Example 2-1 Reference for the User Archives Functions 6-11 Relation Tab 2-20 Rights and Flag 2-13 Runtime Operation 1-3
D
Data Window 1-2
S E
Example Acquisition of Operating Data of a Turbine 1-3 Script Function Example 6-5 Script Functions 6-1 Sequence Tab 2-15, 2-20, 2-23 SIMATIC S5 and S7 Message Interface 7-1 Specifications 8-3 SQL Keywords 8-2 SQL Statements 8-1
F
Features 1-5
I
Introduction 1-1
T
Table Window 1-2, 3-1 The "Communication" Dialog Box" 2-4 The "Sequence" Tab 2-9 The Handles of the Script Functions 6-3 The Rights and Flags Dialog Box 2-7 Toolbar 4-5
L
Legend 1-6
M
Menu Operation 4-1
U
User Archive Properties 2-9, 2-14 User Archives Control 1-3 User Archives Control during Runtime 5-17 User Archives Editor 1-2
Index-1
Index
11.98
User Archives Script Functions 1-3 User Archives Table Control 5-1
V
Values Dialog Box 2-12 Views 1-1
Index-2