ihistorian excel add-in
TRANSCRIPT
-
8/10/2019 IHistorian Excel Add-In
1/38
Using the iHistorianExcel Add-In
-
8/10/2019 IHistorian Excel Add-In
2/38
Proprietary Notice
The manual and software contain confidential information which represents trade secrets of GE FanucInternational, Inc. and/or its suppliers, and may not be copied or disclosed except as provided in the license with
GE Fanuc International, Inc. The information in this manual is subject to change without notice and should not
be construed as a commitment by GE Fanuc International, Inc. GE Fanuc International, Inc. assumes no
responsibility for any errors that may be in this document.
2003 GE Fanuc International, Inc. ALL RIGHTS RESERVED.
Trademarks
2003 GE Fanuc International, Inc. All rights reserved. Microsoft is a registered trademark of Microsoft
Corporation. All other brands or names are property of their respective holders.
iHistorian Version 2.0 2.03
-
8/10/2019 IHistorian Excel Add-In
3/38
Contents iii
Why You Should Read This Manual ...................................................................................................v
1. Understanding the iHistorian Excel Add-In .................................................................................. 1
Understanding Excel Add-In Conventions ............................................................................... 2
Installing The Excel Add-in with iHistorian................................................................................ 3
2. Using the iHistorian Excel Add-In .................................................................................................. 5
Selecting Options ..................................................................................................................... 5
Searching Tags ........................................................................................................................ 7
Querying Current Values .......................................................................................................... 7
Querying Raw Data .................................................................................................................. 7
Querying Calculated Data ........................................................................................................ 8
Querying Filtered Data ........................................................................................................... 8
Exporting Tags ......................................................................................................................... 8
Importing Tags.......................................................................................................................... 9
Adding New Tags or Modifying Tag Parameters ...................................................................... 9
Deleting Tags ......................................................................................................................... 10
Exporting Data........................................................................................................................ 10
Importing Data ........................................................................................................................ 11
Searching Messages .............................................................................................................. 11
Exporting Messages............................................................................................................... 11
Importing Messages ............................................................................................................... 11
Listing Archives ...................................................................................................................... 12
Listing Collectors .................................................................................................................... 12
Contents
-
8/10/2019 IHistorian Excel Add-In
4/38
iv Using the iHistorian Excel Add-In
3. Defining Reports............................................................................................................................ 13
Building Dynamic Reports ...................................................................................................... 13Sharing Excel Reports............................................................................................................ 13
Using the Sample Reports...................................................................................................... 13
Sample Report 1 iHistorian Statistical Analysis .................................................... 14
Sample Report 2 Daily Report .............................................................................. 16
Sample Report 3 Batch Report ............................................................................. 19
Troubleshooting the Excel Add-In Sample Reports .............................................................. 21
Running a Report Using Visual Basic..................................................................................... 22
Array Formulas for the iHistorian Excel Add-In ...................................................................... 23
Description of Array Formula Parameters ................................................................. 24
Editing an Array Formula in Microsoft Excel .............................................................. 28
4. Troubleshooting the Excel Add-In ............................................................................................... 29
Troubleshooting General Imports ........................................................................................... 29
Troubleshooting Tag Imports.................................................................................................. 30
Troubleshooting Data Imports ................................................................................................ 30
-
8/10/2019 IHistorian Excel Add-In
5/38
Why You Should Read This Manual v
Why You Should Read This ManualThe Using the iHistorian Excel Add-In manual is intended for process control
engineers, integrators, and developers responsible for creating and maintaining
iHistorian reports in Excel.
This manual provides descriptive material and specific operating procedures for
performing all common tasks.
Reference Documents
For related information about iHistorian, refer to the following documents:
Getting Started with iHistorian
Using the iHistorian Administrator
iHistorian Data Collectors
Migrating Advanced and Classic iHistorian Data
iHistorian Software Development Kit (SDK) Online Help System
-
8/10/2019 IHistorian Excel Add-In
6/38
vi Using the iHistorian Excel Add-In
-
8/10/2019 IHistorian Excel Add-In
7/38
Chapter 1. Understanding the iHistorian Excel Add-In 1
1. Understanding the iHistorian Excel Add-InThe iHistorian Excel Add-In greatly expands the power and benefits of using the
iHistorian data archiving and retrieval system. Using the Add-In, you can:
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 iHistorian by
generating a tag worksheet using the standard Excel tools, editing the parameters, and
then bulk importing the information directly into iHistorian. Using similar
techniques, you can export tag parameters to Excel, make bulk changes, and thenimport the changes back into iHistorian in a simple, straightforward procedure.
-
8/10/2019 IHistorian Excel Add-In
8/38
2 Using the iHistorian Excel Add-In
Understanding Excel Add-In Conventions
The Excel Add-In uses several conventions in its dialog boxes. These conventions
are important to take full advantage of the features of the iHistorian Excel Add-In.
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:
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 datapoints 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-celloutput range, the orientation of that range determines whether the requested
data is returned into rows or columns.
-
8/10/2019 IHistorian Excel Add-In
9/38
Chapter 1. Understanding the iHistorian Excel Add-In 3
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 256. For
example, if you are trying to display a recordset returned from the Search Tags
query that returns more than 256 records, the query will not return any data.
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.
Installing The Excel Add-in with iHistorian
Before you install the Excel Add-In, verify that Microsoft Excel is already installed
on your computer. Microsoft Excel is a prerequisite for the Add-In the Add-In will
not function without it.
You install the Excel Add-In package as one of the standard installation options from
the iHistorian Install CD. Run the Install CD on the computer on which you want to
use the Excel Add-In and select the Excel Add-In option at the prompt. Refer to the
Getting Started with iHistorianfor the complete installation procedure.
NOTE: If you are running the iHistorian Excel Add-In on Office 97, you must install
Office 97 Service Release 1 or greater.
-
8/10/2019 IHistorian Excel Add-In
10/38
4 Using the iHistorian Excel Add-In
After you install the Excel Add-In, use the following procedure to activate the Add-
In:
[1] Open a new worksheet, select Add-Ins from the Tools menu. The Add-Ins
dialog box, shown in Figure 1-1, appears.
Figure 1-1: Excel Add-Ins Dialog Box
[2] Select iHistorian Add-In and click OK.
The Add-In is now ready to use and the iHistorian menu is now available in
the Excel Toolbar.
TIP: If the iHistorian Add-In is not listed, click the Browse button to locate the
iHistorian.xla file.
-
8/10/2019 IHistorian Excel Add-In
11/38
Chapter 2. Using the iHistorian Excel Add-In 5
2. Using the iHistorian Excel Add-InThis chapter describes recommended procedures for setting up the Excel Add-In and
using the various options and commands.
Selecting Options
To select options for running the Excel Add-In, select Options from the iHistorian
menu. The iHistorian Excel Add-In dialog box, shown in Figure 2-1, appears.
Figure 2-1: Add-In Options Dialog Box
-
8/10/2019 IHistorian Excel Add-In
12/38
6 Using the iHistorian Excel Add-In
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 Description
Internal vs. External References 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.
Automatically Update Links to
Add-In (Yes/No)
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 differencesamong 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). Intellution
recommends 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 iHistorian Dialogs. The default setting is Show Labels.
Color Allows you to select the header name color from the drop-down list:
black, blue, red, green, magenta, cyan, or yellow.
Assign Default Server This dialog box shows the current server assignment. You can modify
the setting by clicking the Edit button and accessing the iHistorian
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.
-
8/10/2019 IHistorian Excel Add-In
13/38
Chapter 2. Using the iHistorian Excel Add-In 7
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 iHistorian menu, the iHistorian Tag Search dialog box
appears.
Once you have searched for tags, you need to select them to add them to the current
worksheet.
Querying Current Values
Querying Current Values retrieves the most recently updated value of one or more
Tags or process variables.
Querying Raw Data
Raw data values are the values actually stored in the archive, after applying collectorand archive compression, but before applying any interpolation, smoothing, or other
signal processing calculations. Querying Raw Data retrieves these values for selected
tags.
Adjust Column Widths This option lets you automatically adjust the width of columns in your
worksheet as formulas are inserted by iHistorian 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.
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.
Field Description
-
8/10/2019 IHistorian Excel Add-In
14/38
8 Using the iHistorian Excel Add-In
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.
Querying Calculated Data
Querying Calculated Data retrieves data that is the result of performing specified
calculations on raw data values in the archive.
Querying Filtered Data
The Query Filtered Data function is similar to the calculated data query, with theaddition of a search filter on the data. The Search Filter allows you to filter the actual
data retrieved with a filter condition. This is useful when trying to retrieve all data for
a specific Batch ID, Lot Number, or Product Code and for filtering data where certain
limits were exceeded, such as all data where this temperature exceeded a certain
value.
Exporting Tags
The Export Tags function permits you to send tag information from the iHistorian
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 iHistorian application. The Server is the reference
point for all import and export functions, as illustrated inFigure 2-2. 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.
Intellution recommends that you first export a tag and then import it, to become
familiar with the procedure and what the data looks like.
-
8/10/2019 IHistorian Excel Add-In
15/38
Chapter 2. Using the iHistorian Excel Add-In 9
Figure 2-2: Import/Export Reference Convention
Importing Tags
The Import Tags function permits you to move tag information into the iHistorian
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 iHistorian 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 iHistorian Administrator prevents you from
performing this import, however. As another example, the Excel Add-In allows you
to import circular references, while the iHistorian Administrator does not.
Adding New Tags or Modifying Tag Parameters
You can use the Excel Add-In to add tags to your iHistorian system or to modify
parameters for existing tags. For example, you can generate and define new tags
either automatically or manually in an Excel worksheet and then import them in bulk
to the iHistorian system. This can be a very convenient mechanism when you are
working with large numbers of tags.
-
8/10/2019 IHistorian Excel Add-In
16/38
10 Using the iHistorian Excel Add-In
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 iHistorian.
To add tags using the iHistorian Excel Add-In:
[1] Build a tag worksheet in Excel using macros or any other tools you are
familiar with. Since iHistorian 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 iHistorian. 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
iHistorian 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.
Deleting Tags
You cannot use the Excel Add-In to delete tags from your iHistorian system. For
more information on deleting tags, refer to theDeleting a Tagsection of theUsing theiHistorian Administrator manual.
Exporting Data
The Export Data function allows you to move values from the iHistorian 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 iHistorian application. The Server is the reference
point for all import and export functions. If you want to move tag information fromthe 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.
-
8/10/2019 IHistorian Excel Add-In
17/38
Chapter 2. Using the iHistorian Excel Add-In 11
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.
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.
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.
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.
If you choose to export messages from iHistorian into Excel and then import the
messages back into the iHistorian, note that the Importing Messages function only
allows you to add messages to the iHistorian Server. It does not allow you to modify
or remove any existing messages.
-
8/10/2019 IHistorian Excel Add-In
18/38
12 Using the iHistorian Excel Add-In
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.
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 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 the substring Hero5_Collector to
return the details for all those collectors. Ensure that your selected output rangeallows for all the collectors to be listed or only the number rows/columns specified in
the output range will be filled in.
-
8/10/2019 IHistorian Excel Add-In
19/38
Chapter 3. Defining Reports 13
3. Defining ReportsThe ability to generate a wide range of custom reports is a major benefit of using the
iHistorian Excel Add-In. Using this versatile tool, you can use all the standard,
familiar Excel tools and techniques to access the iHistorian 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 iHistorian 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.
Building Dynamic Reports
You can define a report so that Excel recalculates the worksheet whenever the
contents of specific cells, such as start times or dates, change. In this way, the report
generates a dynamic snapshot of process performance, updated regularly in real time.
You can also, of course, manually initiate recalculation at any time.
The primary rule to follow in building a dynamic report is to use formulas with cell
references that contain variable information rather fixed data, so that recalculation
produces new data each time it occurs. You then initiate recalculation by changing
certain inputs manually or automatically.
Sharing Excel Reports
You can share any Excel reports you develop with the iHistorian Excel Add-In as you
would any other Excel workbook. Each client using the worksheets, however, must
have the iHistorian Excel Add-In installed and enabled inside Excel.
Using the Sample Reports
The iHistorian application includes three typical sample reports. These reportsclearly 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.
-
8/10/2019 IHistorian Excel Add-In
20/38
14 Using the iHistorian Excel Add-In
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 iHistorian Server in order for these reports to work. The iHistorian Batch ReportSample.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 iHistorian
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 iHistorian\Server directory of the 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). Intellution recommends 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.
Sample Report 1 iHistorian Statistical Analysis
This report, illustrated in Figure 3-1, calculates, for a specified time period, a number
of statistical properties of a tag, such as average, maximum, minimum, standarddeviation, 2 sigma and 3 sigma control limits, and correlation coefficients for other
tags. It displays charts of various types for several of these variables.
-
8/10/2019 IHistorian Excel Add-In
21/38
Chapter 3. Defining Reports 15
Figure 3-1: Sample Report 1 iHistorian Statistical Analysis
The chart at the lower left is a plot of the main variable vs. time with sigma controllimits 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.
Figure 3-2shows the worksheet associated with the sample report that contains the
data used to generate the report.
-
8/10/2019 IHistorian Excel Add-In
22/38
16 Using the iHistorian Excel Add-In
Figure 3-2: Sample Report 1 Data Values
Sample Report 2 Daily Report
This sample report, shown in Figure 3-3, 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.
-
8/10/2019 IHistorian Excel Add-In
23/38
Chapter 3. Defining Reports 17
Figure 3-3: Sample Report 2 Daily Report Values
The report shown in Figure 3-4is a collection of chart plots of the data displayed in
the report of Figure 3-3.
-
8/10/2019 IHistorian Excel Add-In
24/38
18 Using the iHistorian Excel Add-In
Figure 3-4: Sample Report 2 Daily Report Charts
Figure 3-5shows the worksheet used to set up the Daily Sample Report. Edit the
worksheet to adapt this report to your application.
-
8/10/2019 IHistorian Excel Add-In
25/38
Chapter 3. Defining Reports 19
Figure 3-5: Sample Report 2 Daily Report Setup Worksheet
Sample Report 3 Batch Report
The sample report shown in Figure 3-6is an example of a report that might be used
with a batch type of industrial process. The table at the top 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.
-
8/10/2019 IHistorian Excel Add-In
26/38
20 Using the iHistorian Excel Add-In
Figure 3-6: Sample Report 3 Batch Report
Figure 3-7shows the configuration worksheet used to generate the report shown inFigure 3-6. Edit this worksheet to adapt it to your requirements.
-
8/10/2019 IHistorian Excel Add-In
27/38
Chapter 3. Defining Reports 21
Figure 3-7: Sample Report 3 Batch Report Setup Worksheet
Troubleshooting the Excel Add-In SampleReports
If you follow the recommended installation procedures, you should not have any
difficulty in running the Sample Reports. If you do encounter any problems, they are
likely to relate to the locations of files and the links to those files.
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). Intellution recommends that you select No and keep the existing information.
The links will be automatically updated for your worksheet. Save your worksheetafter the links have been updated.
For problems in the worksheets themselves, refer to Excel online Help for assistance.
-
8/10/2019 IHistorian Excel Add-In
28/38
22 Using the iHistorian Excel Add-In
Running a Report Using Visual Basic
The following Visual Basic example shows you how to create a hidden instance of
Microsoft Excel, open a preconfigured iHistorian report in that instance, and then
print the report to the default printer. If you want to use the following example, you
need to modify the path of the .XLA and .XLS files. The paths that you need to edit
are bolded in the following example.
To use this example, a user must have the privileges to run the collector as a Windows
service in Windows and a default printer must be installed. If iHistorian 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. Mostlikely, 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 iHistorian 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
End Select
Next wksSheet
.Close False
-
8/10/2019 IHistorian Excel Add-In
29/38
Chapter 3. Defining Reports 23
End With
Set wkbNewBook = Nothing
xlApp.Quit
Set xlApp = Nothing
End Sub
Array Formulas for the iHistorian Excel Add-In
In Microsoft Excel, an array formula is a data request that inputs a set of parameters
and returns a result or list of results. The iHistorian Excel Add-In uses the following
array formulas:
ihSearchTags(pServer,pTagMask,pDescriptionMask,pCollector,pArraySize,pSort,p
RowCol,Parameters())
ihQueryData(pServer,pTagName,pStartTime,pEndTime,pSamplingMode,pCalculati
onMode,pSamplingInterval,pNumberOfSamples,pDirection,pFilterTag,pFilte
rMode,pFilterComparisonMode,pFilterComparisonValue,pArraySize,pSort,p
RowCol,Parameters())
ihQueryMessages(pServer,pTopic,pStartTime,pEndTime,pSearchText,pArraySize,p
Sort,pRowCol,Parameters())
ihListArchives(pServer,pArchiveNameMask,pArraySize,pSort,pRowCol,Parameters())
ihListCollectors(pServer,pCollectorNameMask,pArraySize,pSort,pRowCol,Paramet
ers())
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.
-
8/10/2019 IHistorian Excel Add-In
30/38
24 Using the iHistorian Excel Add-In
Description of Array Formula Parameters
Table 3-1describes the parameters for the array formulas for the iHistorian Excel
Add-In.
Table 3-1: Descriptions of Array Formula Parameters
Parameter Description
pArchiveNameMask A search mask you can use to browse the archivers.
Use standard Windows wildcard characters.
pArraySize The number of cells that the array spans.
pCalculationMode The type of calculation mode. See the CalculationModessection in the Getting Started with
iHistorianguide for a complete list.
pCollector The collector or collector mask that you want to
query.
pCollectorNameMask A search mask for browsing collectors. Use
standard Windows wildcard characters.
pDescriptionMask A search mask for browsing tag descriptions. Use
standard Windows wildcard characters.
pDirection The direction (forward or backward from the start
time) of data sampling from the archive.
pEndTime The end time used to refine your query.
http://../GettingStarted/GSguide.pdfhttp://../GettingStarted/GSguide.pdfhttp://../GettingStarted/GSguide.pdfhttp://../GettingStarted/GSguide.pdf -
8/10/2019 IHistorian Excel Add-In
31/38
Chapter 3. Defining Reports 25
pFilterComparisonMode 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 comparison
value.
EqualLast Filter condition is True when the
FilterTag is equal to the last comparison value.
NotEqual Filter condition is True when theFilterTag 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 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 DataRecordsetquery (to determine the appropriate filter times).
Table 3-1: Descriptions of Array Formula Parameters
Parameter Description
-
8/10/2019 IHistorian Excel Add-In
32/38
26 Using the iHistorian Excel Add-In
pFilterMode 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).
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.
Table 3-1: Descriptions of Array Formula Parameters
Parameter Description
-
8/10/2019 IHistorian Excel Add-In
33/38
Chapter 3. Defining Reports 27
pNumberOfSamples 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.
pRowCol The sorting criteria used: 0 for Columns and 1 for
Rows.
pSamplingInterval For non-raw sampled data, this column represents a
positive integer for the time interval (in
milliseconds) between returned samples.
pSamplingMode The type of sampling mode used by the query. See
the Sampling Modessection in the Getting Started
with iHistorianguide for a complete list.
pSearchText The text or mask that you want to search for in the
message.
pServer Name of the server on which you are retrieving
data. If you are running Excel on the same serverthat you are retrieving data from, you do not have
to enter a string, as the default server is used.
pSort The sorting criteria used for the rows or columns: 0
for Descending and 1 for Ascending.
pStartTime The start time used to refine your query.
pTagMask A search mask for browsing tagnames. Use
standard Windows wildcard characters.
pTagName The tagname or tagname mask that you want to
query.
Table 3-1: Descriptions of Array Formula Parameters
Parameter Description
http://../GettingStarted/GSguide.pdfhttp://../GettingStarted/GSguide.pdf -
8/10/2019 IHistorian Excel Add-In
34/38
28 Using the iHistorian Excel Add-In
Editing an Array Formula in Microsoft Excel
To edit an array formula in Microsoft Excel, follow these steps:
[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.
pTopic The message topic:
Connections
Configuration
General
Services
Performance
Security
Parameters() Output display of the array formula. T his field caninclude be one or more parameters.
Table 3-1: Descriptions of Array Formula Parameters
Parameter Description
-
8/10/2019 IHistorian Excel Add-In
35/38
Chapter 4. Troubleshooting the Excel Add-In 29
4. Troubleshooting the Excel Add-InThis chapter contains troubleshooting information for using the Excel Add-In with
iHistorian. In particular, it describes what to do if an error occurs with any of the
following:
General imports
Tag imports
Data imports
Troubleshooting General Imports
If you experience problems with general imports and want to resolve them, check the
following:
Review the iHistorianSDKErrors.log in Notepad or another text editor. This
file is usually located in your Windows\System32 folder. iHistorian records
additional information for some errors in this file. Sometimes, by reviewing
this file you can determine the cause of the error.
If using iHistorian security, verify that the user has the appropriate securityrights. If the rights are incorrect, log in as user with the correct privileges or
change the rights for the current user.
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,
iHistorian aborts the whole import.
-
8/10/2019 IHistorian Excel Add-In
36/38
30 Using the iHistorian Excel Add-In
Troubleshooting Tag Imports
If you experience problems with tag imports and want to resolve them, check the
following:
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 canexport them but can notimport 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 exceed the
maximum licensed tag count. If it does, you will not be able to import thetags.
Troubleshooting Data Imports
If you experience problems with a data import and want to resolve it, try the
following steps:
If any archives are online, ensure that the timestamps are not prior to the start
time of the oldest online archive.
Ensure that the timestamps are within the active hours setting in the Archive
Maintenance screen of the iHistorian Administrator.
Ensure that the timestamps are not for a time greater than 15 minutes ahead of
the system time on the iHistorian Server.
Ensure that the tags are valid iHistorian tags. To do this, import your tags
before importing their associated data.
-
8/10/2019 IHistorian Excel Add-In
37/38
Index 31
Index
A
adding new tags 9
Cconventions
255 character limit 3
256 maximum number of columns 3
avoiding circular references 2
no right and left arrow keys 3
recalculation 3
rows or columns 2
selecting multiple attributes 2
selection of tags, times, and events 2
specifying an output cell 2
specifying an output range 2
understanding 2
D
deleting tags 10
E
Excel Add-In
troubleshooting 21
exporting data 10
exporting messages 11
exporting tags 8
I
importing
data 11
messages 11
tags 9
installing the Excel add-in 3
L
listing archives 12
listing collectors 12
Mmodifying tag parameters 9
O
options
adjust column widths 7
assign default server 6
automatically update links 6
internal vs. external references 6
selecting 5
show/don t show header labels 6
-
8/10/2019 IHistorian Excel Add-In
38/38