Excel Add in
Excel Add in
TM
EXCEL ADD-IN
All rights reserved. No part of this publication may be reproduced in any form or by any electronic or mechanical means, including photocopying and recording, without permission in writing from GE Fanuc Automation.
Disclaimer of Warranties and Liability The information contained in this manual is believed to be accurate and reliable. However, GE Fanuc Automation assumes no responsibilities for any errors, omissions or inaccuracies whatsoever. Without limiting the foregoing, GE Fanuc Automation disclaims any and all warranties, expressed or implied, including the warranty of merchantability and fitness for a particular purpose, with respect to the information contained in this manual and the equipment or software described herein. The entire risk as to the quality and performance of such information, equipment and software, is upon the buyer or user. GE Fanuc Automation shall not be liable for any damages, including special or consequential damages, arising out of the user of such information, equipment and software, even if GE Fanuc Automation has been advised in advance of the possibility of such damages. The user of the information contained in the manual and the software described herein is subject to the GE Fanuc Automation standard license agreement, which must be executed by the buyer or user before the use of such information, equipment or software.
Notice GE Fanuc Automation reserves the right to make improvements to the products described in this publication at any time and without notice. 2006 GE Fanuc Automation. All rights reserved. Microsoft is a registered trademark of Microsoft Corporation. Any other trademarks herein are used solely for purposes of identifying compatibility with the products of GE Fanuc Automation. CIMPLICITY is a registered trademark of GE Fanuc Automation. Portions of this software are copyrighted by DataDirect Technologies, 1991-2006
We want to hear from you. If you have comments, questions, or suggestions about our documentation, send them to the following email address: [email protected]
ii
Table Of Contents
excel add-in......................................................................................................... i Version 3.1.......................................................................................................... i Using the Historian Excel Add-In.......................................................................... 1 Reference Documents .................................................................................... 1 Understanding the Historian Excel Add-In........................................................ 2 Understanding Excel Add-In Conventions .................................................... 3 Installing The Excel Add-in with Historian ................................................... 6 Using the Historian Excel Add-In...................................................................... 8 Selecting Options ......................................................................................... 10 Searching Tags............................................................................................. 14 Querying Alarm and Event Data.................................................................. 17 Querying Current Values ............................................................................. 17 Querying Raw Data...................................................................................... 19 Querying Filtered Data ................................................................................ 22 Querying Calculated Data............................................................................ 30 Exporting Tags............................................................................................. 34 Importing Tags............................................................................................. 37
iii
Adding New Tags or Modifying Tag Parameters ........................................ 38 Deleting Tags ............................................................................................... 40 Exporting Data ............................................................................................. 40 Importing Data ............................................................................................. 42 Searching Messages ..................................................................................... 43 Exporting Messages ..................................................................................... 45 Importing Messages ..................................................................................... 46 Listing Archives........................................................................................... 47 Listing Collectors......................................................................................... 49 Working with Alarm and Event Data .......................................................... 51 Defining Reports.............................................................................................. 51 Building Dynamic Reports........................................................................... 52 Sharing Excel Reports.................................................................................. 52 Using the Sample Reports............................................................................ 53 Troubleshooting the Excel Add-In Sample Reports .................................... 63 Running a Report Using Visual Basic ......................................................... 63 Array Formulas for the Historian Excel Add-In .......................................... 65 Troubleshooting the Excel Add-In................................................................... 74 Troubleshooting General Imports ................................................................ 74
iv
Table Of Contents
Troubleshooting Tag Imports....................................................................... 75 Troubleshooting Data Imports ..................................................................... 76 Troubleshooting Data or Tag Exports.......................................................... 76 Index .................................................................................................................... 77
Reference Documents
For related information about Historian, refer to the following documents:
Getting Started with Historian Using the Historian Administrator Historian Data Collectors Historian Alarms and Events Migrating Advanced and Classic Historian Data Using the Historian OLE DB Provider Historian Software Development Kit (SDK) Online Help System
Retrieve selected data from any archive file. Display it in a customized report. Present the data in any of 12 standard chart formats. Calculate derived variables from raw data values. Perform mathematical functions to smooth or characterize data. Import, export, and modify tags, data, and messages all with familiar Excel commands, macros, and computational techniques. Create dynamic reports that you can share among users.
A major benefit of using the Excel Add-In is the ability to add tags to Historian by generating a tag worksheet using the standard Excel tools, editing the parameters, and then bulk importing the information directly into Historian. Using similar techniques, you can export tag parameters to Excel, make bulk changes, and then import the changes back into Historian in a simple, straightforward procedure.
The selection of tags, times, and events should always be via cell references. Try not to type these items directly into dialog boxes. Rather, select them in the worksheet. Many dialog boxes support selecting multiple statistics or attributes. You can select multiple items in a list using one of the following methods:
o o o
Dragging the mouse over multiple items. Pressing the Shift key and clicking the ends of a contiguous range. Pressing the Control key and clicking multiple individual items.
Specifying an Output Cell is always optional. If you do not specify an output cell, the active cell is used as the starting point for output. When you specify an output cell, that cell is used as the starting point for output. If you select a range for an output cell, the top left cell in the range is used as the starting point for output. Specifying an Output Range determines how many data points are
retrieved from a given query. It is important for these functions to specify whether data points should be sorted in ascending or descending order by selecting the appropriate option.
Ensure when you are specifying an Output Range or an Output Cell that the active cells are not the same cells that you specified with tag name cell references. This will lead to circular cell referencing and incorrect values. Specifying data retrieval into Rows or Cols determines how multiple attributes or statistics are displayed in the worksheet. Specifying data retrieval into Rows or Cols only applies when the dialog box inserts a single function into the worksheet. When you select a multi-cell output range, the orientation of that range determines whether the requested data is returned into rows or columns. Microsoft Excel imposes a 255 character limit on their formulas. If you attempt to create a formula with more than 255 characters, you will receive an error message. Excel does not support the use of the right and left arrow keys of the keyboard to move between characters in text boxes and fields in the dialog boxes. The maximum number of columns allowed in an Excel worksheet is 255. For example, if you are trying to display a recordset returned from the Search Tags query that returns more than 255 records, the query will not return any data.
The maximum number of rows returned by the Excel Add-In is 32,767. If no parameters in an Excel formula change, the formula does not recalculate unless you edit (press F2) the formula and force a change. For example, if you change a Hi Scale value from 100 to 50 and then import a tag, the Hi Scale field will display 100 when looking at the tag information. When retrieving data in the Excel Add-In, be sure to leave at least one blank line at the top of the output display for the column header labels. If you do not, the header labels will not show. In several of the fields, an underscore appears at the right side of the field. If you click the underscore, the dialog box instantly changes to a minimized display. You can return to the original display by clicking the box again. The purpose of this feature is to permit you immediately to see an unobstructed view of your worksheet or other windows as you work your way through the dialog box and to allow you to select a cell or range of cells in the worksheet.
2. Select Historian Add-In and click OK. The Add-In is now ready to use and the Historian menu is now available in the Excel Toolbar. TIP: If the Historian Add-In is not listed, click the Browse button to locate the Historian.xla file. NOTE: If you install the Excel Add-In prior to installing Excel, the install program copies the Historian.xla file to your Historian folder (typically
C:\Program Files\Historian). If you decide to add the Excel Add-In after installing Excel, open Excel, select Add-Ins from the Tools menu, and click Browse to locate the Historian.xla file. If you uninstall Historian after installing the Excel Add-In as described, ensure that you clear the Historian check box in the Excel Add-Ins dialog. If you do not clear this option, you will receive an error each time you open Excel.
Selecting Options Searching Tags Querying Current Values Querying Raw Data Querying Calculated Data Querying Filtered Data Exporting Tags
Importing Tags Adding New Tags or Modifying Tag Parameters Deleting Tags Exporting Data Importing Data Searching Messages Exporting Messages Importing Messages Listing Archives Listing Collectors Working with Alarm and Event Data
Selecting Options
To select options for running the Excel Add-In, select Options from the Historian menu. The Historian Excel Add-In dialog box appears. This dialog box allows you to select several options for running the Add-In. The choices and the effects of each are listed in the following table.
Field Internal vs. External References Description Choosing Use External References allows your application to reference cells in other worksheets and workbooks in addition to the current one. If you choose Use Internal References instead, you can only access cells in the current worksheet. The default setting is Use External References. Add-In functions are maintained as worksheet links. If users who share worksheets do not have Microsoft Office installed the same way, it is necessary to turn this feature on. When on, this feature automatically re-establishes any formula links that may be broken due to
10
differences among users in Microsoft Office installation. The default setting enables this feature. The Auto Update feature allows sharing of worksheets. You must, however, install the Excel Add-In in the exact same Microsoft Office Library Path as the other worksheets if you want to use the sharing feature. When opening a worksheet with links to another worksheet, you may receive a message prompting you to update all linked information in the workbook (Yes) or keep the existing information (No). It is recommended that you select No and keep the existing information. The links will be automatically updated for your worksheet. Save your worksheet after the links have been updated. Show/Hide Header Labels This option lets you display or suppress the column header labels that are automatically placed in the worksheet when entering formulas throughout the Historian Dialogs. The default setting is Show Labels.
11
Color
Allows you to select the header name color from the drop-down list: black, blue, red, green, magenta, cyan, or yellow. This dialog box shows the current server assignment. You can modify the setting by clicking the Edit button and accessing the Historian Server Managers dialog box. This dialog box allows you to save user connection information, add or connect to a new server, delete a server, and modify the default server. This option lets you automatically adjust the width of columns in your worksheet as formulas are inserted by Historian dialogs. Click Adjust Header Column Width to modify the width of header labels; click Adjust Data Column Width to modify the data column widths to accommodate the data values. Enabling these options usually makes the worksheet much more readable. However, doing so can sometimes make the worksheet calculate too much when building a large report. In such cases, disable the automatic feature and adjust individual columns manually.
12
Save/Default/Cancel
These action buttons let you apply your choices of options. Click Save to apply the settings you entered, click Default to select default settings for all options, and click Cancel to close the dialog box.
13
Searching Tags
The Search Tags command lets you scan the tags on a specified server and then to perform actions on one or more tags you select from that group. When you select the Search Tags command in the Historian menu, the Historian Tag Search dialog box appears.
To search for tags:
1. Select Search Tags from the Historian menu. The Historian Tag Search dialog box appears. 2. In the Server field, select a server from the drop-down list. To add or connect to a new server click the Browse button (...). If you do not specify a server, the Add-In searches the default server. To set the selected server as default, ensure the Set Server to Default option is enabled. 3. Click the Search button. The Historian Tag Search dialog box is populated with a tag list. 4. Select Tags from the Search List: 1. Click a specific tagname to select it in the populated Historian Search Tags dialog box. To select multiple individual tags, press the Control key and click the tagnames. To select a sequence of tags, press the Shift key
14
and click the first and last tagname of the sequence. 2. When you have selected the tags you want, click the right arrow (>) button in the center of the screen. This moves the selected tags to the right hand window. The selected tags are the tags for which the query obtains and displays data. If you click the double right (>>) arrow instead of the single right arrow, you select and move all tags to the right hand window. 3. If you change your mind about a tag, you can deselect it by clicking on the tagname to highlight it and then clicking the left arrow (<) button. This moves the tag back to the left hand window, removing it from the list of selected tags. Similarly, you can deselect all tags, by clicking the double left (<<) arrow. 4. The Search Display section lets you choose whether you want to display tagnames or tag description. It also displays the number of tags returned. Select the display option you prefer. 5. The Output With section lets you choose whether the output presentation shows the names of the selected tags or the cell computation formulas. Select the option you prefer. NOTE: Using Output with Formula places a dynamic formula in the worksheet, versus just a copy of the tagnames currently selected. Having a dynamic formula allows the list of tags returned to be dynamic based on the tag mask criteria supplied. This is particularly useful when selecting a
15
cell reference for the tag mask as opposed to typing in a tag mask directly in the dialog. f. The Output Range field determines where in the worksheet the output data displays. Click in the Output Range field and select a range of cells in a single row or column in the worksheet. In most cases, you should choose Columns for a typical report. Selecting the Rows option rotates the report presentation 90 degrees.
g. The Output Display section lets you select the type of data to be displayed. Select a name to choose a single parameter for display. To select multiple individual parameters, press the Control key and click the parameters. To select a sequence of parameters, press the Shift key and click the first and last parameter of the sequence. h. When you have selected all desired options, click OK to apply your choices and initiate the query. Click Cancel to close the dialog box.
16
i.
Alarms and Events and the Excel Add-in Creating Alarms and Events Queries in the Excel Add-In
17
1. Select Query Current Values from the Historian menu. The Historian Current Value Query dialog box appears. 2. Select a server from the drop-down list. If you do not specify a server, the Add-In queries the default server. To set the selected server as default, ensure the Set Server to Default option is enabled. 3. Select a tag on your worksheet and, while it is selected, click in the Tag Name field of the dialog box. This enters the tagname for you automatically. NOTE: Do not use wildcards in this field. The Query Current Value feature returns a single value for a single tag at each query. If you attempt to use a wildcard in the Tag Name field, you will only get a return value for the first tag. 4. In the Output Display field, select one or more parameters for the output. To select multiple individual tags, press the Control key and click the tagnames. To select a sequence of tags, press the Shift key and click the first and last tagname of the sequence. 5. Click in the Output Cell field and then click a cell in the worksheet to define the upper left corner of the display. Be sure to leave at least one blank line at the top of the output display for the column header labels. If you do not, the header labels will not show. 6. Select either Columns or Rows for the output display. Selecting Columns displays a table of values with parameters arranged in columns with header labels at the top. Selecting Rows rotates the
18
table 90 degrees. NOTE: When selecting multiple tags, the orientation of the return data is based on the orientation of the selected tags and the Row/Col selection is ignored. 7. Click OK to initiate the query. Click Cancel to abort the operation and close the dialog.
1. Select Query Raw Data from the Historian menu. The Historian Raw Data Query dialog box appears.
19
2. Select a server from the drop-down list. If you do not specify a server, the Add-In queries the default server. To set the selected server as default, ensure the Set Server to Default option is enabled. 3. Select a tag on your worksheet and, while it is selected, click in the Tag Name field of the dialog box. This enters the tagname for you automatically. 4. In the Query Type section, select the type of data search from three options:
o
By Time Selecting the By Time option means that you search for data values between a start time and an end time. You must enter values for starting and ending times in the fields displayed at the right of the option. By Number Forward Selecting the By Number Forward means searching for a number of values after a specified time. Enter values into the After Time and Number of Values fields. By Number Backward Selecting the By Number Backward means searching for a number of values before a specified time. The display changes from start and end times to Values Before Time and Number of Values. Enter appropriate parameters in these fields.
5. In the Output Display field, select one or more parameters for the output. To select multiple individual tags, press the Control key and click the tagnames. To select a sequence of tags, press the Shift key
20
and click the first and last tagname of the sequence. 6. Click in the Output Range field and select a range of cells in a single row or column to determine where the returned data is placed. 7. Select either Columns or Rows for the output display. Selecting Columns displays a table of values with parameters arranged in columns with header labels at the top. Selecting Rows rotates the table 90 degrees. NOTE: When selecting multiple tags, the orientation of the return data is based on the orientation of the selected tags and the Row/Col selection is ignored. 8. Select either Ascending or Descending to set the order of the retrieved data in either ascending or descending order. 9. Click OK to initiate the query. Click Cancel to abort the operation and close the dialog. NOTE: The Raw Data Query returns a number of data points based on the number of rows or columns specified in the output range. If you are not viewing all your data points, select enough rows or columns to display all the data.
21
1. Select Query Filtered Data from the Historian menu. The Historian Filtered Data Query dialog box appears. 2. Select a server from the drop-down list. If you do not specify a server, the Add-In automatically uses the default server. To set the selected server as default, ensure the Set Server to Default option is enabled. 3. Select a tag or group of tags on your worksheet and, while they are selected, click in the Tag Name field of the dialog box. This enters the tagnames for you automatically.
22
NOTE: Do not use wildcards in this field. If you use a tag mask instead of a tagname, Historian only returns the first possible match. 4. In the Query Time section enter values of time in the Start Time and End Time fields. 5. In the Sampling Type section, select a type from the drop-down list. The following types are available:
Interpolated Sampling calculates values between two data points using a linear interpolation algorithm. Calculated Sampling computes values using an algorithm selected in the Calculation field. Lab Sampling computes intermediate values between two data points by using the last actual value. This type of sampling displays as a stair step type of curve. Trend Sampling determines the raw minimum and raw maximum value for each specified interval. Use the Trend sampling mode to maximize performance when retrieving data points for plotting.
6. The Calculation Field is active only after you select Calculated Sampling as the Sample Type. Select a Calculation Algorithm type from the drop-down list. The following types are available:
Average a time weighted arithmetic mean. Minimum the lowest value in the group.
23
Maximum the highest value in the group. Standard Deviation the square root of the arithmetic mean of deviations from the time-weighted arithmetic mean of all values in the group. Total the time-weighted total of all values in the group. Note that Engineering Units are assumed to be in Units/Day. If your Engineering Units were not measured in Units/Day, you must scale your total to the actual time units of the measurement. For example, if the measurement were in Units/Minute (such as GPM), you would multiply the total number by 1440 (minutes in a day) to scale the value into the correct time units. Count the total number of values in the group. Raw Average the unweighted arithmetic mean of all values in the group. Raw Standard Deviation the square root of the arithmetic mean of deviations from the unweighted arithmetic mean of all values in the group. Raw Total the unweighted total of all values in the group. Time of Minimum Value the time at which the minimum value occurred. Time of Maximum Value the time at which the maximum value occurred.
24
TimeGood the amount of time (in milliseconds) during the interval when the data quality is good.
7. In the Sampling Interval section, select either the By Interval or By Samples option.
The By Interval option displays two entry fields, Interval and Time Unit. Enter values in both. For example, to sample at 10 minute intervals, enter 10 in the interval field and select Minutes in the Time Unit field. The By Samples option displays a Number of Samples field. To specify a number of samples for the data query, enter a number in this field. For example, to query 100 samples, enter 100 in this field.
8. In the Output Display field, select one or more parameters for the output. Click a name to select it. To select multiple individual tags, press the Control key and click the tagnames. To select a sequence of tags, press the Shift key and click the first and last tagname of the sequence. 9. In the Filter Definition section, enter filter parameters in the fields for Filter Tag, Filter Comparison, Include Date Where Value Is Equal To, and Include Times. These fields are optional. If you do not enter any values, the query returns all values without filtering. See the following table for more information. 1. Select a tag on your worksheet and, while it is selected, click in the Tag Name field of the dialog box. This enters the
25
tagname for you automatically. 2. In the optional Filter Comparison field, select a comparison operator from the drop-down list (equal to, equalfirst, equallast, greater than, greater than or equal to, less than, less than or equal to, not equal to, alarm condition, alarm subcondition). 3. In the optional Include Data Where Value Is Equal To field, enter a target reference value. 4. In the optional Include Times After field, select one of the time options (Time After, Time Before, Time Before and After, Exact Time) from the drop-down list. 10. Click in the Output Range field and select a range of cells in a single row or column to determine where the returned data is placed. 11. Select either Columns or Rows for the output display. Selecting Columns displays a table of values with parameters arranged in columns with header labels at the top. Selecting Rows rotates the table 90 degrees. NOTE: When selecting multiple tags, the orientation of the return data is based on the orientation of the selected tags and the Row/Col selection is ignored. 12. Select either Ascending or Descending to set the order of the retrieved data in either ascending or descending order. 13. Click OK to initiate the query. Click Cancel to abort the operation
26
Filter Mode
27
The Filter Mode defines how time periods before and after transitions in the filter condition should be handled. For example, AfterTime indicates that the filter condition should be True starting at the timestamp of the archive value that triggered the True condition and leading up to the timestamp of the archive value that triggered the False condition. Filter Comparison Mode The type of comparison to be made on the filter comparison value: Equal Filter condition is True when the Filter Tag is equal to the comparison value. EqualFirst Filter condition is True when the Filter Tag is equal to the first comparison value. EqualLast Filter condition is True when the Filter Tag is equal to the last comparison value. NotEqual Filter condition is True when the Filter Tag is NOT equal to the comparison value. LessThan Filter condition is True when the Filter Tag is less than the comparison value. GreaterThan Filter condition is True when the Filter Tag is greater than the comparison value. LessThanEqual Filter condition is True when the Filter Tag is less than or equal to the comparison
28
value. GreaterThanEqual Filter condition is True when the Filter Tag is greater than or equal to the comparison value. Alarm Condition Specifies an alarm condition to filter data by. For example, Level. Alarm SubCondition Specifies an alarm subcondition to filter data by. For example, HIHI. The Filter Comparison Mode defines how archive values for the Filter Tag should be compared to the Filter Value to establish the state of the filter condition. If a Filter Tag and Filter Comparison Value are supplied, time periods are filtered from the results where the filter condition is False. Filter Comparison Value The value to compare the filter tag with when applying the appropriate filter to teh data record set query (to dtermine the appropriate filter times).
Examples
If you had a BatchID going into an Historian tag, that BatchID will either have a timestamp at the beginning of the batch or at the end of the batch. Different batch systems report the BatchID as the batch is started, and other systems do not report the BatchID until the batch is finished.
29
If your BatchID is reported at the beginning of a batch, you would need to use the AfterTime option because you would want to include all data for a particular BatchID after the time the BatchID was reported up until the next BatchID was reported. If your BatchID was being reported at the end of the batch, you would want to use the BeforeTime option because you would want to include all data for a particular Batch ID before the time the Batch ID was reported back to the previous BatchID being reported.
1. Select Query Calculated Data from the Historian menu. The Historian Calculated Data Query dialog box appears.
30
2. Select a server from the drop-down list. If you do not specify a server, the Add-In queries the default server. To set the selected server as default, ensure the Set Server to Default option is enabled. 3. Select a tag or group of tags on your worksheet and, while they are selected, click in the Tag Name field of the dialog box. This enters the tagnames for you automatically. 4. In the Query Time section, enter values of time in the Start Time and End Time fields. 5. In the Sampling Type section, select a type from the drop-down list. The following types are available:
Interpolated Sampling calculates values between two data points using a linear interpolation algorithm. Calculated Sampling computes values using an algorithm selected in the Calculation field. Lab Sampling computes intermediate values between two data points by using the last actual value. This type of sampling displays as a stair step type of curve. Trend Sampling determines the raw minimum and raw maximum value for each specified interval. Use the Trend sampling mode to maximize performance when retrieving data points for plotting.
6. The Calculation Field is active only after you select Calculated Sampling as the Sample Type. Select a Calculation Algorithm type
31
Average a time weighted arithmetic mean. Minimum the lowest value in the group. Maximum the highest value in the group. Standard Deviation the square root of the arithmetic mean of deviations from the time-weighted arithmetic mean of all values in the group. Total the time-weighted total of all values in the group. Note that Engineering Units are assumed to be in Units/Day. If your Engineering Units were not measured in Units/Day, you must scale your total to the actual time units of the measurement. For example, if the measurement were in Units/Minute (such as GPM), you would multiply the total number by 1440 (minutes in a day) to scale the value into the correct time units. Count the total number of values in the group. Raw Average the unweighted arithmetic mean of all values in the group. Raw Standard Deviation the square root of the arithmetic mean of deviations from the unweighted arithmetic mean of all values in the group. Raw Total the unweighted total of all values in the group.
32
Time of Minimum Value the time at which the minimum value occurred. Time of Maximum Value the time at which the maximum value occurred. TimeGood the amount of time (in milliseconds) during the interval when the data quality is good.
7. In the Sampling Interval section, select either the By Interval or By Samples option.
The By Interval option displays two entry fields, Interval and Time Unit. Enter values in both. For example, to sample at 10 minute intervals, enter 10 in the interval field and select Minutes in the Time Unit field. The By Samples option displays a Number of Samples field. To specify a number of samples for the data query, enter a number in this field. For example, to query 100 samples, enter 100 in this field.
8. In the Output Display field, select one or more parameters for the output. Click a name to select it. To select multiple individual tags, press the Control key and click the tagnames. To select a sequence of tags, press the Shift key and click the first and last tagname of the sequence. 9. Click in the Output Range field and select a range of cells in a single row or column to determine where the returned data is placed.
33
10. Select either Columns or Rows for the output display. Selecting Columns displays a table of values with parameters arranged in columns with header labels at the top. Selecting Rows rotates the table 90 degrees. NOTE: When selecting multiple tags, the orientation of the return data is based on the orientation of the selected tags and the Row/Col selection is ignored. 11. Select either Ascending or Descending to set the order of the retrieved data in either ascending or descending time order. 12. Click OK to initiate the query. Click Cancel to abort the operation and close the dialog.
Exporting Tags
The Export Tags function permits you to send tag information from the Historian Server to an Excel worksheet or to another system, which may be either local or remote. NOTE: Before importing or exporting tags, data, or messages, you should be aware of a convention used with the Historian application. The Server is the reference point for all import and export functions, as illustrated in the following figure. If you want to move tag information from the Server into your worksheet, you must use the Export Tags command. Conversely, if you
34
want to move data from your worksheet to the server, you must use the Import Data command. It is recommended that you first export a tag and then import it, to become familiar with the procedure and what the data looks like.
1. Select Administration and then select Export Tags from the Historian menu. The Export Tags from Historian dialog box appears. 2. Select a server from the drop-down list. If you do not select a server, the Add-In uses the default server. 3. In the Filter Criteria section, enter the name of the tag you want to
35
export or, as an alternative, enter a mask for selecting a group of tags. If you do not enter a tagname, the filter uses other criteria for selecting tags. If you do not enter any criteria, the filter returns all tags. If you prefer, you can enter a tag description and/or a description mask instead of a tagname or tag mask. NOTE: You cannot export multiple tags when tagnames are read from multiple cells. If you specify a range of tagnames to read from multiple cells in the Tag Mask or Tag Name(s) fields, only the first tag in the range will be exported. 4. Enter a collector name in the Collector field. This entry is optional. 5. Select a data type from the drop-down list in the Data Type field. If you do not select a data type, or if you select a data type that does not match the other entries you have made, the filter uses other criteria. 6. Select one or more field names from the list in the right hand window. To select a single item, click the name of the field. To select multiple individual tags, press the Control key and click the tagnames. To select a sequence of tags, press the Shift key and click the first and last tagname of the sequence. NOTE: Always include Tagnames in the list of fields to export. 7. In the Export Options section, select either the To New Worksheet, To CSV File, or To XML option. If you select either the CSV or XML option, you must also enter a path and filename for the destination file.
36
8. Click OK to execute the Export Tag function. Click Cancel to cancel and close the dialog box. When the export function finishes, a dialog box appears within a display of the worksheet containing the exported tags. Click OK to acknowledge the operation and close the dialog box.
Importing Tags
The Import Tags function permits you to move tag information into the Historian Server from an Excel Worksheet or from another system, which may be either local or remote. When used with the Excel Add-In, the Import Tags function moves selected information from your current worksheet into the specified Historian Server. There is no error checking when you import tags through the Excel Add-In. For example, with the Excel Add-In you can successfully import unsolicited tags without a calculation dependency (trigger). The Historian Administrator prevents you from performing this import, however. As another example, the Excel Add-In allows you to import circular references, while the Historian Administrator does not.
37
1. Select Administration and then select Import Tags from the Historian menu. A message box appears. 2. Click Yes to initiate the operation. If successful, a dialog box appears confirming completion of the import function. Click OK to close the dialog box. If errors on the import occur, a dialog box appears detailing the issues encountered during the import. If any error occurred with any line of the import, the whole import is aborted. NOTE: If you export all fields and attempt to import the read-only fields LastModified and LastModifiedUser, you may receive an Import failed, Error with Import Header message. Try exporting the tags again (not selecting the read-only fields) and importing.
38
If any conflicting names or parameters occur, the system displays a warning message to alert you to the problem. You can then eliminate the conflict and try again. You can also modify tag parameters by editing them in the worksheet and then bulk importing them into Historian.
To add tags using the Historian Excel Add-In:
1. Build a tag worksheet in Excel using macros or any other tools you are familiar with. Since Historian requires information about each tag that varies with the type of tag selected, verify that you have included all required information in the worksheet before attempting to import it into Historian. To determine what specific tag information is required, refer to the documentation provided with your SCADA application. 2. Use the Import Tags command to bulk import this information into your Historian application. NOTE: If any errors on the import occur, a dialog appears detailing the issues encountered during the import. If any error occurred with any line of the import, the whole import is aborted.
39
Deleting Tags
You cannot use the Excel Add-In to delete tags from your Historian system. For more information on deleting tags, refer to the Deleting a Tag section of the Using the Historian Administrator manual.
Exporting Data
The Export Data function allows you to move values from the Historian Server to your Excel worksheet or to another system in the same way you move tag information with Export Tags. NOTE: Before importing or exporting tags, data, or messages, you should be aware of a convention used with the Historian application. The Server is the reference point for all import and export functions. If you want to move tag information from the Server into your worksheet, you must use the Export Tags command. Conversely, if you want to move data from your worksheet to the server, you must use the Import Data command.
To export data from the Server into your Worksheet:
1. Select Administration and then select Export Raw Data from the Historian menu. The Export Data from Historian dialog box appears. 2. If you want to specify a server, select a server from the drop down
40
list. If you do not specify a server, the Add-In uses the default server. 3. Select a tag or group of tags on your worksheet and, while they are selected, click in the Tag Name field of the dialog box. This enters the tagnames for you automatically. 4. In the Query Time section enter values of time in the Start Time and End Time fields. 5. In the Sampling Type section, select a type from the drop-down list. 6. The Calculation field is active only after you select Calculated Sampling as the Sample Type. Select a Calculation Algorithm type from the drop-down list. 7. In the Sampling Interval section, select either the By Interval or By Samples option. The By Interval option displays two entry fields, Interval and Time Unit. Enter values in both. For example, to sample at 10 minute intervals, enter 10 in the interval field and select Minutes in the Time Unit field. The By Samples option displays a Number of Samples field. To specify a number of samples for the data query, enter a number in this field. For example, to query 100 samples, enter 100 in this field. 8. In the Filter Definition section, enter filter parameters in the fields for Filter Tag, Filter Comparison, Include Date Where Value Is Equal To, and Include Times. These fields are optional. If you do
41
not enter any values, the query returns all values without filtering. 9. In the Fields To Export section, select one or more fields. To select multiple individual tags, press the Control key and click the tagnames. To select a sequence of tags, press the Shift key and click the first and last tagname of the sequence. 10. In the Export Options section, select one of three options: To New Worksheet, To CSV File, or To XML File. 11. If you select To CSV File or To XML File, you must enter a file name and path for the new file in the File Name field. 12. Click OK to initiate the export. Click Cancel to abort the operation and close the dialog.
Importing Data
The Import Data command is the converse of the Export Data command. It moves selected information from your current worksheet into the specified Server in the same way the Import Tags command functions. NOTE: If you use the Active Hours setting while importing data using the Excel Add-In, note that if the first tags imported are not within the Active Hours settings, no subsequent tags will be returned on that import (even if they are within the set active hours).
42
1. Select Administration and then select Import Data from the Historian menu. A message box appears. 2. Click Yes to initiate the operation. If successful, a dialog box appears confirming the completion of the import function. Click OK to close the dialog box. If errors occur on the import, a dialog box appears detailing the issues encountered in the import. If an error occurs in any line of the import, the whole import is aborted.
Searching Messages
The Search Messages function lets you search the archives for selected types of messages generated during a specific time period and to display selected fields from those messages. This puts a dynamic formula in the worksheet. Dynamic formulas allow you to build a dynamic message report that you can build, save, and re-use.
To search for messages:
1. Select Administration and then select Search Messages from the Historian menu. The Historian Message Search dialog appears.
43
2. Select a server from the drop-down list. If you do not specify a server, the Add-In uses the default server. 3. In the Topic field, select one of six types of messages from the dropdown list. 4. In the Query Times fields, enter values for start time and end time. 5. In the Search String section, enter a search string for scanning the text of messages. You do not need to enter *s for wildcards. 6. In the Output Display section, select one or more parameters for the output display. Click a name to select it. To select multiple individual tags, press the Control key and click the tagnames. To select a sequence of tags, press the Shift key and click the first and last tagname of the sequence. 7. Click in the Output Range field and select a range of cells in a single row or column to determine where the returned data is placed. 8. Select Asc or Desc to sort the messages in ascending or descending order. 9. Select either Columns or Rows for the output display. Selecting Columns displays a table of values with parameters arranged in columns with header labels at the top. Selecting Rows rotates the table 90 degrees. NOTE: When selecting multiple tags, the orientation of the return data is based on the orientation of the selected tags and the Row/Col selection is ignored.
44
1. Click OK to execute the search. Click Cancel to close the dialog box.
Exporting Messages
The Exporting Messages function lets you find messages and export them from the server to your worksheet or to a CSV or XML file. You can specify the server and select the messages to be exported by specifying a start time, an end time, or a text string, using standard wildcards, where applicable. You can also select which fields of the messages are exported, such as time stamp, topic, message string, message number, substitutions, or username.
To export a message:
1. Select Administration and then select Export Messages from the Historian menu. The Export Messages From Historian dialog box appears. 2. Select a server from the drop-down list. If you do not specify a server, the Add-In uses the default server. 3. In the Topic field, select one of six types of messages from the dropdown list. 4. In the optional Filter Criteria fields, enter values for start time, end
45
time, and search text string in the appropriate fields. 5. In the Fields to Export section, select one or more field names from the displayed list. To select multiple individual tags, press the Control key and click the tagnames. To select a sequence of tags, press the Shift key and click the first and last tagname of the sequence. 6. In the Export Options section, select one of three options:
o o o
If you select To CSV File or To XML File, you must enter a file name and path for the new file in the File Name field. 7. Click OK to initiate the export. Click Cancel to abort the operation.
Importing Messages
The Importing Messages command writes all messages from the worksheet into the server. When you initiate the import function, a dialog box asks if you want to import messages from your worksheet into a specified server. If you reply Yes, it scans your worksheet for messages, writes them to the server, and notifies you that the operation succeeded or failed.
46
If you choose to export messages from Historian into Excel and then import the messages back into the Historian, note that the Importing Messages function only allows you to add messages to the Historian Server. It does not allow you to modify or remove any existing messages.
To import a message into the server from your worksheet:
1. Select Administration and then select Import Messages from the Historian menu. A message box appears. 2. Click Yes to execute the import. A dialog box appears when the operation is complete. Click OK to close the dialog box. If errors occur in the import, a dialog box appears detailing the issues encountered in the import. If an error occurs in any line of the import, the whole import is aborted.
Listing Archives
The List Archive function returns a list of selected statistics about an archive file. You can specify the server, the archive file name, and the type of information displayed, such as start time, end time, file name, target file size, current file size, current or read-only status, last backup time, and last backup users. You can also specify a range of cells for the display.
47
1. Select Administration and then select List Archives from the Historian menu. The Historian Archive List dialog box appears. 2. Select a server from the drop-down list. If you do not specify a server, the Add-In uses the default server. 3. In the Archive name field, enter an archive name. Do not use wild cards in this field. 4. In the Output Display section, select one or more parameters for the output display. To select multiple individual tags, press the Control key and click the tagnames. To select a sequence of tags, press the Shift key and click the first and last tagname of the sequence. NOTE: The List Archives Query sorts by archive start time. The archive list will be sorted based on start time whether this field is selected or not. 5. Click in the Output Range field and select a range of cells in a single row or column to determine where the returned data is placed. 6. Select Asc or Desc to sort the archives in ascending or descending order. 7. Select either Columns or Rows for the output display. Selecting Columns displays a table of values with parameters arranged in columns with header labels at the top. Selecting Rows rotates the table 90 degrees. NOTE: When selecting multiple tags, the orientation of the return data is based on the orientation of the selected tags and the Row/Col selection is
48
ignored. 8. Click OK to execute the search. Click Cancel to close the dialog box. TIP: To return details for more than one item, specify a substring in the Archive Name field that exists in each archive you want listed. For example, if you had archives Hero5_Archive0001 -010, you could specify the substring Hero5_Archive to return the details for all those archives. Ensure that your selected output range allows for all the archives to be listed or only the number rows/columns specified in the output range will be filled in.
Listing Collectors
The List Collectors function returns a list of selected statistics about a collector. You can specify the server, the collector name, and select the type of information displayed. You can also specify the range of cells for the display.
To display a list of Collectors:
1. Select Administration and then select List Collectors from the Historian menu. The Historian Collector List dialog box appears. 2. Select a server from the drop-down list. If you do not specify a
49
server, the Add-In uses the default server. 3. In the Collector name field, enter a Collector name. Do not use wild cards in this field. 4. In the Output Display section, select one or more parameters for the output display. To select multiple individual tags, press the Control key and click the tagnames. To select a sequence of tags, press the Shift key and click the first and last tagname of the sequence. 5. Click in the Output Range field and select a range of cells in a single row or column to determine where the returned data is placed. 6. Select Asc or Desc to sort the messages in ascending or descending order. 7. Select either Columns or Rows for the output display. Selecting Columns displays a table of values with parameters arranged in columns with header labels at the top. Selecting Rows rotates the table 90 degrees. NOTE: When selecting multiple tags, the orientation of the return data is based on the orientation of the selected tags and the Row/Col selection is ignored. 8. Click OK to execute the search. Click Cancel to close the dialog box. TIP: To return details for more than one item, specify a substring in the Collector Name field that exists in each collector you want listed. For example, if you had collectors Hero5_Collector0001 -010, you could specify
50
the substring "Hero5_Collector" to return the details for all those collectors. Ensure that your selected output range allows for all the collectors to be listed or only the number rows/columns specified in the output range will be filled in.
Defining Reports
The ability to generate a wide range of custom reports is a major benefit of using the Historian Excel Add-In. Using this versatile tool, you can use all the standard, familiar Excel tools and techniques to access the Historian archives and build reports and charts of all types to fit your specific needs. If you want, you can use the sample reports included with Historian almost as is just change the tags to fit your application. As an alternative, use the setup worksheets as a starting point and adapt them to your particular situation.
51
52
The Historian application includes three typical sample reports. These reports clearly demonstrate the power and ease-of-use of the Excel Add-In. Use them directly in your application or modify them to fit your requirements. NOTE: This manual contains hypertext links that open the provided Historian Sample Reports directly in Excel. If you did not install the Excel Add-In, moved the Sample Reports from the Sample directory, or moved the Historian.chm file from its installed location, you will receive an error when you click on these links and will be unable to take advantage of this functionality. The three sample Excel reports are built using tags from the Simulation Collector. You must have the Simulation Collector installed on a machine and collecting data to the Historian Server in order for these reports to work. The Historian Batch Report Sample.xls file also uses Batch ID and Product ID tags from the Simulation Collector. These are Simulation Collector points that are configured to store string data types. To ensure that the sample reports work correctly, you must add the string tags. These are the last 5 tags in the tag collector list. Add the string tags in the Historian Administrator by browsing the Simulation Collector and adding all of the tags by selecting the Add All Tags check box. Alternatively, you can run the Add Tags to Simulation Collector.bat batch file in the Historian\Server directory of the
53
machine that has the Simulation Collector. In addition, when you first install the Simulation Collector it prompts you for the number of simulation tags it should create (but you must still add the tags for collection using one of the two methods above). The default is 1000. Do not make this value less than 30. When opening a Sample Excel report, you may receive a message prompting you to update all linked information in the workbook (Yes) or keep the existing information (No). It is recommended that you select No and keep the existing information. The links will be automatically updated for your worksheet. Save your worksheet after the links have been updated.
This report, illustrated in the following figure, calculates, for a specified time period, a number of statistical properties of a tag, such as average, maximum, minimum, standard deviation, 2 sigma and 3 sigma control limits, and correlation coefficients for other tags. It displays charts of various types for several of these variables. Click to Open the Historian Statistical Analysis Sample Report in Excel.
54
The chart at the lower left is a plot of the main variable vs. time with sigma control limits indicated by the straight lines. The two charts to the right are scatter diagrams that show the correlation between the main variable and two other variables. The chart at the top right is a histogram of data values of the main variable that shows how the data points are distributed.
55
The following figure shows the worksheet associated with the sample report that contains the data used to generate the report.
56
This sample report, shown in the following figure, shows how the measured values and selected statistical properties of specified tags have varied during the previous 24-hour period. This sample is an example of a typical daily performance report in an industrial plant. Click to Open the Historian Daily Report Values Sample Report in Excel.
57
The report shown in the following figure is a collection of chart plots of the data displayed in the report of the previous figure.
58
The following figure shows the worksheet used to set up the Daily Sample Report. Edit the worksheet to adapt this report to your application.
59
Sample Report 2 Daily Report Setup Worksheet Sample Report 3 Batch Report
The sample report shown in the following figure is an example of a report that might be used with a batch type of industrial process. The table at the top
60
of the report shows the batch identification, the start and end times, product name, and computed statistics for several process variables. The charts show how selected process parameters varied during the batch cycle. Click to Open the Historian Batch Report Sample in Excel.
61
The following figure shows the configuration worksheet used to generate the report shown in the previous figure. Edit this worksheet to adapt it to your requirements.
62
63
Historian security is enabled, the user must have iH Readers membership. Tag level security can override this privilege. You can trigger this example to run on an event basis or on a polled basis. Most likely, you would run this example on an event basis. However, you could run it on a polled basis through the Windows Task Scheduler.
Sub CreateExcelObjects() Dim xlApp As Excel.Application Dim wkbNewBook As Excel.Workbook Dim wksSheet As Excel.Worksheet Dim strBookName As String ' Create new hidden instance of Excel. Set xlApp = New Excel.Application ' Open the preconfigured Historian Excel Add-in report. Workbooks.Open "C:\Program Files\Microsoft Office\Office10\Library\iHistorian.xla" Set wkbNewBook = Workbooks.Open("c:\testih.xls", 0, False) 'xlApp.Visible = True With wkbNewBook For Each wksSheet In .Worksheets Select Case wksSheet.Name Case "tag1" wksSheet.Select .RefreshAll .PrintOut
64
End Select Next wksSheet .Close False End With Set wkbNewBook = Nothing xlApp.Quit Set xlApp = Nothing End Sub
65
ihListCollectors(pServer,pCollectorNameMask,pArraySize,pSort,pRowCol, Parameters())
When inserting an array formula, you cannot overwrite part of the range of another array formula in your worksheet. The range includes cells without data displayed. An error message appears if you try to do so. Reselect a different output range to insert the formula.
Description of Array Formula Parameters
The following table describes the parameters for the array formulas for the Historian Excel Add-In. Descriptions of Array Formula Parameters
Parameter pArchiveNameMask Description A search mask you can use to browse the archivers. Use standard Windows wildcard characters. The number of cells that the array spans. The type of calculation mode. See the Calculation Modes section in the Getting Started with Historian guide for a complete
pArraySize pCalculationMode
66
list. pCollector The collector or collector mask that you want to query. A search mask for browsing collectors. Use standard Windows wildcard characters. A search mask for browsing tag descriptions. Use standard Windows wildcard characters. The direction (forward or backward from the start time) of data sampling from the archive. The end time used to refine your query. The type of comparison to be made on the filter comparison value: Equal Filter condition is True when the FilterTag is equal to the comparison value. EqualFirst Filter condition is True when the FilterTag is equal to the first
pCollectorNameMask
pDescriptionMask
pDirection
pEndTime pFilterComparisonMode
67
comparison value. EqualLast Filter condition is True when the FilterTag is equal to the last comparison value. NotEqual Filter condition is True when the FilterTag is NOT equal to the comparison value. LessThan Filter condition is True when the FilterTag is less than the comparison value. GreaterThan Filter condition is True when the FilterTag is greater than the comparison value. LessThanEqual Filter condition is True when the FilterTag is less than or equal to the comparison value. GreaterThanEqual Filter condition is True when the FilterTag is greater than or equal to the comparison value.
The FilterComparisonMode defines how archive values for the FilterTag should be compared to the FilterValue to establish the state of the filter condition. If a FilterTag and FilterComparisonValue are supplied, time
68
periods are filtered from the results where the filter condition is False. pFilterComparisonValue The value to compare the filter tag with when applying the appropriate filter to the DataRecordset query (to determine the appropriate filter times). The type of time filter: ExactTime Retrieves data for the exact times that the filter condition is True (only True). BeforeTime Retrieves data from the time of the last False filter condition up until the time of the True condition (False until True). AfterTime Retrieves data from the time of the True filter condition up until the time of next False condition (True until False). BeforeAndAfterTime Retrieves data from the time of the last False filter condition up until the time of next False condition (While True).
pFilterMode
69
The FilterMode defines how time periods before and after transitions in the filter condition should be handled. For example, AfterTime indicates that the filter condition should be True starting at the timestamp of the archive value that triggered the True condition and leading up to the timestamp of the archive value that triggered the False condition. pFilterTag The single tagname used when applying the filter criteria. Entering a tag for this parameter indicates that you want to perform a filtered data query. The other filter fields are disregarded unless you specify a filter tag. Number of samples from the archive to retrieve. Samples will be evenly spaced within the time range defined by start time and end time for most sampling modes. For the RawByNumber sampling mode, the NumberOfSamples column determines the maximum number of values to retrieve. For the RawByTime sampling mode, the NumberOfSamples is ignored.
pNumberOfSamples
70
pRowCol
The sorting criteria used: 0 for Columns and 1 for Rows. For non-raw sampled data, this column represents a positive integer for the time interval (in milliseconds) between returned samples. The type of sampling mode used by the query. See the Sampling Modes section in the Getting Started with Historian guide for a complete list. The text or mask that you want to search for in the message. Name of the server on which you are retrieving data. If you are running Excel on the same server that you are retrieving data from, you do not have to enter a string, as the default server is used. The sorting criteria used for the rows or columns: 0 for Descending and 1 for Ascending.
pSamplingInterval
pSamplingMode
pSearchText
pServer
pSort
71
pStartTime pTagMask
The start time used to refine your query. A search mask for browsing tagnames. Use standard Windows wildcard characters. The tagname or tagname mask that you want to query. The message topic: Connections Configuration General Services Performance Security
pTagName
pTopic
Parameters()
Output display of the array formula. This field can include be one or more parameters.
72
Editing an Array Formula in Microsoft Excel To edit an array formula in Microsoft Excel:
1. Click on the cell in the spreadsheet that contains the array formula. 2. Click in the formula bar at the top of the screen. 3. Edit the formula that appears in this bar. 4. Press Ctrl+Shift+Enter. 5. Select Save from the File menu. NOTE: To exit a formula array without editing it, press the Esc key.
73
Review the HistorianSDKErrors.log in Notepad or another text editor. This file is usually located in the LogFiles folder in your Historian program folder. Historian records additional information for some errors in this file. Sometimes, by reviewing this file you can determine the cause of the error. If using Historian security, verify that the user has the appropriate security rights. If the rights are incorrect, log in as a user with the
74
Verify that no empty rows appear between valid rows in your spreadsheet. These empty rows can cause issues. Note if any errors occur. If an error occurs with any line of the import, Historian aborts the whole import.
If you remove or add Historian Servers and attempt to Search for tags, the Historian Excel Add-In may not recognize the default server and may display a message stating that the default server has not been set. To correct this, close and reopen the Search Tags dialog box. Make sure that you are not trying to import the Calculation Execution Time, Last Modified, or Last Modified User fields for each tag. These fields are read-only. As such, you can export them but can not import them. Check that your collector does not contain any duplicate tagnames. Duplicate tagnames will cause errors to occur. Verify that the number of tags that you want to import does not exceed the maximum licensed tag count. If it does, you will not be
75
Ensure that the time stamps of any online archives are not prior to the start time of the oldest online archive. Ensure that the time stamps are within the active hours setting in the Archive Maintenance screen of the Historian Administrator. Ensure that the time stamps are not for a time greater than 15 minutes ahead of the system time on the Historian Server. Ensure that the tags are valid Historian tags. To do this, import your tags before importing their associated data.
76
Index
Index
adding new tags conventions 255 character limit 256 maximum number of columns avoiding circular references no right and left arrow keys recalculation rows or columns selecting multiple attributes selection of tags, times, and events specifying an output cell specifying an output range understanding 3 3 3 3 3 3 3 3 3 3 3 38 conventions deleting tags Excel Add-In troubleshooting Excel Add-In exporting data exporting messages exporting tags importing data messages tags importing installing the Excel add-in listing archives 42 46 37 37 6 47 63 63 40 45 34 3 39
77
listing collectors modifying tag parameters options adjust column widths assign default server automatically update links internal vs. external references selecting show/don' t show header labels options querying calculated data querying current values querying filtered data querying raw data reference documents Reports
49 38 10 10 10 10 10 10 10 30 17 21 19 1
building dynamic reports defining sharing reports using the sample reports Reports Sample reports daily report statistical analysis Sample reports searching messages searching tags tags searching for troubleshooting Excel Add-In troubleshooting understanding Excel add-in conventions
52 51 52 53 53
56 54 54 43 14 14 63 63 3
78