You are on page 1of 52

User Guide

Visual T&D Excel® Add-In


© 2011 Cooper Power Systems, LLC – All rights reserved.
The information in this document is subject to change without notice.

Cooper Power Systems


Energy Automation Solutions
730 Commerciale Street
Suite 200
Saint-Jean-Chrysostome, Quebec
Canada G6Z 2C5
Phone: +1.418.834.0009
Fax: +1.514.227.5256
Email: PSMO-sales@cooperindustries.com
Web: http://www.cooperpower.com

Technical Support: PSSJ-support@cooperindustries.com

GUI-00115-00054 T, version 8
Contents
Welcome 1
Introduction .........................................................................................................................1
Welcome to the Visual T&D Excel Add-In ..........................................................1
Contacting Cooper Power Systems .......................................................................1
Getting Assistance .................................................................................................2
Installing the Visual T&D Excel Add-In .............................................................................3
Preliminaries ..........................................................................................................3
Loading the Add-In into Excel ..............................................................................3
Verify the Installation ............................................................................................3

Accessing the data 5


Overview .............................................................................................................................5
Setting up the Visual T&D Server Connection ....................................................................5
Adding or Modifying a Connection.......................................................................6
Using the Add-In Functions .................................................................................................7
Microsoft Excel Basic Concepts............................................................................7
Formulas.................................................................................................. 7
Cell References ....................................................................................... 8
Worksheet Functions ............................................................................... 8
Arguments................................................................................. 8
Structure .................................................................................... 8
Formulas that Contain Functions ............................................................ 8
Array ....................................................................................................... 8
Array Formulas ....................................................................................... 9
Date and Time ......................................................................................... 9
Inserting a Formula on a Worksheet......................................................................9
Manually Entering a Formula ................................................................. 9
Entering a Formula Containing a Function ........................................... 10
Formula Palette ....................................................................... 10
Pasting a Function ................................................................... 11

Visual T&D Excel® Add-In •i


Inserting a Function (Microsoft Excel 2003) .......................... 11
Entering an Array Formula ................................................................... 13
Visual T&D Data Access Functions ....................................................................13
Elements Common to all Functions.....................................................................13
Suspending the Execution of Visual T&D Functions ..........................................14
Removing the Formulas ......................................................................................14
The Data Point Browser ......................................................................................14
Grouping Data Points ............................................................................ 16
The Event types Browser.....................................................................................18
Accessing the Properties of a Data Point.............................................................19
Function VssPtProp ............................................................................... 19
Examples ............................................................................................... 20
Displaying the Properties of a Data Point ............................... 20
Displaying the Properties of Multiple Data Points.................. 20
Displaying the Properties of Multiple Data Points by
Column ................................................................................... 21
Accessing the Current Value of a Data Point ......................................................21
Function VssPtCurrVal ......................................................................... 21
Examples ............................................................................................... 22
Displaying the Current Value of a Data Point......................... 22
Displaying the Current Value of Multiple Data Points ........... 22
Displaying the Current Value of Multiple Data Points by
Column ................................................................................... 23
Function VssCurrVal ............................................................................ 23
Accessing the History of a Data Point .................................................................23
Function VssPtArchVal ........................................................................ 24
Examples ............................................................................................... 25
Displaying the First 5 Transitions on a Data Point, for a
Particular Period ..................................................................... 25
Displaying the First 3 Transitions on 3 Data Points, for a
Particular Period ..................................................................... 25
Accessing Data Calculated from the History of the Data Points .........................26
Function VssPtCalcVal ......................................................................... 26
Displayed Quality Values...................................................................... 30
Examples ............................................................................................... 32
Displaying Calculated Values for a Data Point over a
One-Day Period, with a One-Hour Sampling Interval ............ 32
Displaying Calculated Values for 2 Data Points over a 5-
Minute Period, with a 1-Minute Sampling Interval ................ 33

ii • Visual T&D Excel® Add-In


Accessing the alarm and event history ................................................................33
Function VssAlarmAndEvent ............................................................... 33
Examples ............................................................................................... 35
Displaying the alarms and events with a limit of 5 events ...... 35
Updating the Data ................................................................................................35
Updating all the Data ............................................................................ 35
Updating the Real-Time Data ............................................................... 35
Updating the Historical Data ................................................................. 36

Creating a Report Model 37


Overview ...........................................................................................................................37
Creating a Model ...............................................................................................................37
Generating a Report from a Model ....................................................................................37

Automating Report Generation 39


Overview ...........................................................................................................................39
Creating the Report Generation Script ...............................................................................39
Using the Trigger Time in Scripts and Report Models ........................................39
Function VssSetTriggerTime ................................................................ 40
Function VssGetTriggerTime ............................................................... 40
Example ................................................................................................ 40
Creating the Script ...............................................................................................41
Testing the Script.................................................................................................41
Scheduling a Periodic Report Generation ..........................................................................42
Creating an Event-Triggered Task to Generate Reports ....................................................43

Tips and Tricks 45


Overview ...........................................................................................................................45
Tricks and Tips ..................................................................................................................45
Function TODAY() .............................................................................................45
Function NOW()..................................................................................................45
Limitations and Known Problems .....................................................................................46
Excel Worksheet Limitations ..............................................................................46
Merge & Center Function ....................................................................................46
Loss of Selection after a Data Update .................................................................46

Visual T&D Excel® Add-In • iii


Welcome

Introduction

Welcome to the Visual T&D Excel Add-In


The Visual T&D family of products is specially designed to integrate a large number of diverse
data sources, thereby providing you with unified view of your electrical substation information.

With the Visual T&D Excel Add-In, you can easily:

‰ access the current and historical substation data in a Microsoft® Excel® workbook, either
locally or remotely;

‰ create custom reports from the current and historical substation data;

‰ perform advanced calculations on the substation data, using Visual T&D server calculation
functions as well as the tools provided by Excel;

‰ create report templates, and have reports generated automatically.

Contacting Cooper Power Systems


Cooper Power Systems is committed to providing the best possible support to Visual T&D users.
Do not hesitate to contact us if you have any questions regarding Visual T&D or any of our other
electrical substation automation products.

Our sales department can answer general questions about using Visual T&D, and can assist you in
acquiring a license or give you pricing information.

Email: PSMO-sales@cooperindustries.com
Phone: +1.418.834.0009
Fax: +1.514.227.5256

Visual T&D Excel® Add-In •1


Getting Assistance
If you have any question regarding the performance, application or testing of any component of
this Cooper Power Systems product, do not hesitate to contact us. Our staff will be pleased to
assist you.
Technical Support
Cooper Power Systems
Energy Automation Solutions
730 Commerciale Street, Suite 200
Saint-Jean-Chrysostome, Quebec
Canada G6Z 2C5

Email: PSSJ-support@cooperindustries.com
Phone: +1.418.834.0009
Fax: +1.514.227.5256

Business hours are from 8 a.m. and 5 p.m. EST, Monday to Friday.

2• Visual T&D Excel® Add-In


Installing the Visual T&D Excel Add-In

Preliminaries
The Visual T&D Excel Add-In is an add-in specially designed to be under the control of Microsoft
Excel 2000 or a newer version. Therefore, make sure the software is installed before you begin.

The Visual T&D Excel Add-In belongs to the Visual T&D family of products and is available as
an option at installation time. If you are not sure whether you installed the option, launch the
installation again.

Loading the Add-In into Excel


The add-in is installed in the Client/Bin folder of the product installation directory. The file is
called VSSADDIN.XLL. Locate the file now.

‰ Start Excel.

‰ In the Tools menu, click Add-Ins.

‰ In the Add-Ins window, click Browse and select the VSSADDIN.XLL file you found above.

At this point, the list of available add-ins should contain the Visual T&D Excel Add-In.

‰ Click OK and close the Add-Ins window.

Verify the Installation


Once the add-in has been loaded, a Visual T&D menu appears on the Excel menu bar.

‰ Click About in the Visual T&D menu, to verify that you have the correct product version.

Visual T&D Excel® Add-In •3


Accessing the data

Overview
The Visual T&D Excel Add-In allows you include your substation's real-time and historical data
in the various Excel calculation and report formatting functions.

In this chapter, you will start by learning how to set up the Visual T&D server connection. You
will then familiarize yourself with the various data access functions provided by Visual T&D.

Setting up the Visual T&D Server Connection


To ensure that Excel can access the Visual T&D data, you have start by setting up a connection to
the Visual T&D server. If you want to access the data for more than one Visual T&D server,
simply repeat the configuration steps for each server.

Note: Remember that the Visual T&D Excel Add-In and the server program may be
installed on different computers. All the functions remain available, regardless of
whether the server is installed locally or remotely.

To modify the list of available connections, you will use the Connections dialog box. This
window displays the list of connections that have been configured, as well as their respective
statuses.

To display this dialog box:

‰ In the Visual T&D menu, click Connections.

Visual T&D Excel® Add-In •5


Object Description

Available Displays the list of connections to Visual T&D servers.


connections

Disabled When selected, indicates that the connection is not currently active.

Name Displays the symbolic name of the connection.

Address Displays the name or IP address of the computer on which the server resides.

Status Displays the connection’s current status.

Add Displays a dialog box through which you can add a new connection.

Edit Displays a dialog box through which you can modify the properties of the
selected connection.

Delete Deletes the selected connection from the list.

Adding or Modifying a Connection


When you click the Add or Edit button in the Connections dialog box, the system displays the
Connection Properties dialog box, which you can use to enter or modify the information required
in to establish a connection with the server.

6• Visual T&D Excel® Add-In


Box Description

Name Specifies the symbolic name of the connection.

Address Specifies the name or IP address of the computer on which the server resides.

Port Specifies the TCP port to use.

The Visual T&D server uses port 16102 by default. You can have it use another
port, however, in order to meet network security constraints. If you do need to
modify the port number to be used by the Visual T&D server, contact our
technical support group.

User Name Specifies the name of the user account to be used in establishing a connection to
the server.

Password Specifies the password for the specified user account.

Remember my If you put a checkmark, the password is saved for the next time you start Excel. If
password you do not put a checkmark, you will have to enter your password every time you
start Excel for the purpose of opening a connection with the Visual T&D server.

Note: You can use several instances of Excel to simultaneously edit or consult different
documents. Remember that each instance of the application loads into memory,
a copy of the Visual T&D Excel Add-In, which uses its own connections, and that
the server can accept a limited number of connections (4) on a given computer.
To avoid using several connections, you can open all your documents with the
same instance of Excel, using the File menu’s Open command.

Using the Add-In Functions


The Visual T&D Excel Add-In adds advanced functions to the list of functions already available
in Microsoft Excel. Before proceeding, you should have a few basic concepts so that you can use
the functions correctly.

Microsoft Excel Basic Concepts

Note: This document is mostly based on Microsoft Excel 2000. Some clarifications may
be specified for Microsoft Excel 2003 when significant changes were made
between those two versions.

Formulas
A formula is an equation that analyzes the data on a worksheet. Formulas perform mathematical
operations such as additions, multiplications or value comparisons. They can refer to cells on the
same worksheet, to cells on other worksheets within the same workbook, or to cells in other
workbooks.

Visual T&D Excel® Add-In •7


Formulas calculate the values in a specific order. In Excel, a formula always begins with the equal
(=) sign. This sign tell Excel that the characters that follow represent a formula. Next come the
items to be calculated (operands), separated by the calculation operators. Excel calculates the
formula from left to right, based on a specific order for each operator in the formula. You can
modify the order of the operations by using parentheses.

Cell References
A formula can refer to constants and to other cells. The cell that contains the formula itself is
called the dependent cell when its value depends on the values of other cells. For example, cell B2
is a dependent cell if it contains the formula =C2.

By default, each time there is a change to the cell referred to in the formula, the dependent cell
changes as well.

If you use constants in the formula, rather than references to other cells (=30+70+110, for
example), the result changes only if you modify the formula.

Formulas can refer to cell ranges, or to names or labels representing cells or cell ranges.

Worksheet Functions
Functions are predefined formulas that perform calculations using specific values called
arguments, in a certain order (or structure). For example, the SUM function adds values or cell
ranges, while the PMT function calculates loan payments as a function of interest rate, term and
principal.

Arguments
Arguments can be numbers, text, or logical values such as TRUE or FALSE, arrays, error values
such as #N/A, or cell references. The selected argument must produce a valid value. Arguments
can also be constants, formulas or other functions.

Structure
The structure of a function begins with the name of the function, followed by a left parenthesis,
followed by the arguments separated by commas, and lastly, by a right parenthesis. If the function
starts a formula, type an equal sign (=) before the name of the function. When you create a
formula that contains a function, you can use the Formula Palette for assistance (see “Formula
Palette”, page 10).

Formulas that Contain Functions


You can use worksheet functions in your formulas. Functions are predefined formulas that
perform complex calculations. For example, you can use the SUM function to add the values of a
range of cells.

Array
An array is used to create unique formulas that generate several results and that act on a group of
arguments spread out across various lines and columns. Excel supports two types of arrays:
formula arrays and constant arrays. A formula array is a rectangular area of cells that share a
common formula. A constant array is a group of constants that are laid out in a particular manner
and that act as an argument in a formula.

8• Visual T&D Excel® Add-In


The Visual T&D functions can all be inserted in a formula array, in order to simultaneously
display several pieces of information for several data points.

Array Formulas
Array formulas perform several calculations and return either a single result or multiple results.
For example, in a list of sales figures for various regions, you can use an array formula to calculate
the average sales figures for a particular region.

Date and Time


Excel stores dates as serial numbers used for calculations. January 1, 1900 is serial number 1 if the
workbook has been using the calendar since 1900. If the workbook has been using the calendar
since 1904, Excel stores January 1, 1904 as serial number 1 (January 2, 1904 as serial number 2).
Using the 1900 example, Excel would store January 1, 1998 as serial number 35796 since 35,795
days would have elapsed since January 1, 1900.

Inserting a Formula on a Worksheet


There are several ways to insert a formula in a cell on a worksheet. This section provides a
detailed explanation of the mechanisms available in Excel to accomplish the task.

Manually Entering a Formula


‰ Click on the cell in which you want to enter the formula.

‰ Type an equal sign (=).

‰ If you click the Edit Formula button on the formula bar, or the Paste Function
button on the toolbar, Excel inserts the equal sign for you.

Note: In Excel 2003, there is no Edit Formula button on the formula bar: use the Insert
Function button instead, which has the same aspect as the Paste Function
button in Excel 2000.

‰ Enter the formula.

‰ Press Enter.

Important Notes

‰ You can enter a formula in an array of cells by selecting the cells, typing the formula, and
pressing Ctrl+Shift+Enter.

‰ With Visual T&D functions, even if you are requesting numerous pieces of information
that will be displayed in an array of cells, you do not need to select the array of cells.
Simply enter the formula in the first cell of the array, and then press Enter. This can be
very useful for those functions where there is no way of knowing how much space will be
occupied by the results.

In the example below, a formula is typed in cell B2, requesting the units and description

Visual T&D Excel® Add-In •9


for the 3 points shown in cells A2 through A4. Once the Enter key is pressed, the results
appeared in the array of cells B2 through C4. If you were to click on any cell within the
array, you would see that the formula was automatically propagated to each of the cells.

‰ With Visual T&D functions, if you need to edit a formula that is repeated in an array of
cells, simply select the first cell in the array and make the required modifications. Then
make sure to press Ctrl+Shift+Enter, or Excel will not allow you to continue.

‰ You can also enter a formula in a range of cells by copying the formula located in another
cell.

Entering a Formula Containing a Function


‰ Click on the cell in which you want to enter the formula.

‰ To start the formula, click on the Edit Formula button.

A function name appears in the Functions zone located to the left of the Edit Formula button.

‰ Click the arrow located to the right of the Functions zone, in order to view the list of
available functions.

‰ Click on the function to be added to the formula. If the function is not in the list, click Other
functions to obtain a list of additional functions.

‰ Enter the arguments.

‰ When you have finished entering the formula, press Enter.

Formula Palette

Note: Excel 2000’s Formula Palette has no equivalent in Excel 2003. Use the Insert
Function instead (see “Inserting a Function (Microsoft Excel 2003)”, below).

The Formula Palette is a tool that makes it easy to create or modify formulas. It provides
information about functions and their arguments.

The palette appears under the formula bar when you click on the Edit Formula button in the

formula bar, or on the Paste Function toolbar button.

10 • Visual T&D Excel® Add-In


Pasting a Function

Note: Excel 2000’s Paste Function has been replaced by an insert function in Excel
2003 (see “Inserting a Function (Microsoft Excel 2003)”, below).

The Paste Function dialog box displays the list of functions available in Excel, grouped together
by category.

To open the dialog box:

‰ Select the cell.

‰ In the Insert menu, click Function.

OR

‰ Click the Paste Function toolbar button.

Inserting a Function (Microsoft Excel 2003)


Microsoft Excel 2003’s Insert Function dialog box replaces Excel 2000’s Paste Function and
Function Palette.

Visual T&D Excel® Add-In • 11


To use the Insert Function:

‰ Select the cell.

‰ In the Insert menu, click Function.

OR

‰ Click the Insert Function toolbar button.

‰ The Insert Function dialog box appears.

‰ Select a category, and then select a function. Click OK.

‰ The Function Arguments dialog box appears.

‰ Excel 2000’s users will notice the similarity between this dialog box and Excel 2000’s
Function Palette. Specify the function-specific arguments, and then click OK to insert the
function in the cell.

12 • Visual T&D Excel® Add-In


Entering an Array Formula
You create an array formula in the same way you create other formulas, but you select the array of
cells before entering the formula, and you press Ctrl+Shift+Enter after having typed the formula.

Visual T&D Data Access Functions


The various functions added to Excel are designed to help you construct requests to access Visual
T&D server data.

Function Description

VssPtProp Function used to access data point properties.

VssPtCurrVal Function used to access the current values (real-time) of the data points.

VssPtArchVal Function used to access the archived values of the data points in the historical
database.

VssPtCalcVal Function used to access the values that are calculated from archived values in the
historical database.

VssGetTriggerTime Function used to retrieve the trigger time as set by the last VssSetTriggerTime
VBA function call in a script.

This function is intended to be used in report models for event-triggered report


generation (see page 40).

VssAlarmAndEvent This function is used to retrieve the list of alarms and events.

Each function requires a group of parameters in order to be able to send a request to the server for
data. The parameters define the nature of the data to be displayed, the list of data points for which
the data is to be extracted, and the manner in which the data is to be displayed in the Excel
workbook.

Thus, each function requires 2 categories of arguments, which are the same for all functions:

‰ The list of data names for which the data is being requested. The list must contain at least one
data point, but cannot exceed 100 data points.

‰ The information to be displayed. This list specifies which information related to the data
(value, timestamp, quality, etc.) is to be displayed, and in what order. Each function has its
own display parameters, in addition to the parameters that are common to all functions.

Each function is described in detail later on in this chapter.

Elements Common to all Functions


‰ You can use all types of data points (analog and binary, input and output) with all functions.

‰ Data point names are case-sensitive. It is therefore preferable to use the data point browser
(described later on in this chapter) to insert data point names as function arguments.

Visual T&D Excel® Add-In • 13


‰ You can have up to 100 data points per function. However, certain functions may not be able
to return all the data for such a large number of data points, since the Visual T&D server
imposes its own limit on the amount of data it can return per request.

‰ The cell format is not automatically adjusted by the Visual T&D Excel Add-In. You therefore
have to adjust the format of any cells containing timestamps, as the time in Excel is displayed
as a number of days.

‰ You can specify the same display parameter more than once.

‰ Display parameters are not case-sensitive.

Suspending the Execution of Visual T&D Functions


To make it easier to create reports and report models, you can suspend the execution of the Visual
T&D functions that you use in your workbooks. This allows you to avoid sending requests to the
server unnecessarily, the results of which could break the page layout of your model.

While the functions are suspended, the cells containing Visual T&D formulas display (Function is
suspended).

To suspend the execution of the Visual T&D functions:

‰ In the Visual T&D menu, click Suspend the execution of the functions.

The menu command contains a checkmark when the execution is, in fact, suspended.

Note: The standard Excel worksheet update procedures do not update the Visual T&D
data. You have to use the commands described below.

Removing the Formulas


You can remove all the formulas you inserted in an Excel workbook. This operation allows you to
create a static copy of a report, while keeping the data obtained through the data access functions.

Note: Make sure you have a copy of the document before you remove the formulas, as
you will not be able to re-insert the formulas with Excel’s Undo command.

To remove all the formulas from a workbook:

‰ In the Visual T&D menu, click Remove All Formulas.

The Data Point Browser


To simplify the task of entering the function arguments, the Visual T&D Excel Add-In provides
the Data Point Browser dialog box. This dialog box allows you to browse through the list of
available data points for each configured connection, and to select the data points to be inserted in
the Excel workbook. You can then refer to cells containing data points as arguments for the
various functions.

14 • Visual T&D Excel® Add-In


To display the data point browser:

‰ In the Visual T&D menu, click Data Point Browser.

Object Description

Available Displays the list of data points that are available on the selected connection.
connections

Insert top to bottom Inserts the list of Selected points from top to bottom, starting at the selected
cell in the active workbook. Each data point name is placed in a cell, based on
its order of appearance in the list of selected points.

Insert left to right Inserts the list of Selected points from left to right, starting at the selected cell
in the active workbook. Each data point name is placed in a cell, based on its
order of appearance in the list of selected points.

Available points Displays the list of all the data points that are available on the selected
connection. Binary points are displayed in blue and analog points, in green.

Filter Filters the Available points by name. All points containing the text shown in
the box will be displayed.

Group Settings Displays the Group Settings tab of the Display Options dialog box, which you
can use to group the points differently so that you can change their order of
appearance in the Available points list.

See “Grouping Data Points”, page 16.

Selected points Contains the list of data points that will be displayed on the worksheet.

Add Adds the selected point to the list.

Visual T&D Excel® Add-In • 15


Object Description

Remove Deletes the selected point from the list.

Remove All Deletes the entire list of selected points.

Grouping Data Points


For display purposes, you can have Visual T&D group together all the data points that start or end
with the same characters. You can also specify that there is a delimiter in a specific position within
the data point name.

Let us suppose, for example, that the components of the data point names are delimited by
underscores.

If you ask Visual T&D to group the points together by the beginning of their names, you will
obtain a result that looks like this:

If you open one of the folders, the data points will be displayed as follows:

If you repeat the exercise, but ask that Visual T&D group the points together by the ending of
their names, you will obtain a result that looks like this:

16 • Visual T&D Excel® Add-In


If you open one of the folders, the data points will be displayed as follows:

To specify how you want the data points to be grouped:

‰ Click the Group Settings button of the Data Point Browser dialog box.

Visual T&D displays the Display Options dialog box.

Visual T&D Excel® Add-In • 17


Box Description

Include binary points Specifies whether binary points are to be included in the list of data points to
be grouped together.

Group data points Specifies whether or not the data points are to be grouped together.

If you do not put a checkmark, the remaining boxes will not be available.

with a common Specifies that the data points with the same characters at the beginning of
beginning their names are to be grouped together.

with a common ending Specifies that the data points with the same characters at the end of their
names are to be grouped together.

are delimited by Specifies that all the data point names have the same delimiter and that you
occurrence ... of are interested in the nth occurrence of the delimiter. For example, if the
character ... delimiter is an underscore and the data point names contain 3 underscores
separated by other characters, and you specify occurrence 2, you are referring
to the second underscore within the data point name. Visual T&D will group
together all the data points with identical characters preceding or following
the second underscore, depending on whether you requested that the data
points be grouped together by the common beginning or common ending of
their names.

have a fixed length Specifies that Visual T&D is to search for all data point names with
of ... characters n identical characters. For example, if you specify a value of 7, Visual T&D
will group together all the data point names for which the first or last 7
characters are identical, depending on whether you requested that the data
points be grouped together by the common beginning or common ending of
their names.

Preview This section of the dialog box displays a list of folders that Visual T&D
created based on your grouping criteria. When you open the different folders,
you will note that the binary points are displayed in blue and the analog
points, in green.

The Event types Browser


To simplify the task of entering the function arguments, the Visual T&D Excel Add-In provides
the Event types Browser dialog box. This dialog box allows you to browse through the list of
available event types for each configured connection, and to select the event types to be inserted in
the Excel workbook. You can then refer to cells containing the event types as arguments for the
various functions.

To display the data point browser:

‰ In the Visual T&D menu, click Event types Browser.

18 • Visual T&D Excel® Add-In


Object Description

Available Displays the list of event types that are available on the selected connection.
connections

Insert top to bottom Inserts the list of Selected event types from top to bottom, starting at the
selected cell in the active workbook. Each event type name is placed in a cell,
based on its order of appearance in the list of selected points.

Insert left to right Inserts the list of Selected event types from left to right, starting at the selected
cell in the active workbook. Each event type name is placed in a cell, based on
its order of appearance in the list of selected points.

Filter All the names of the different event types that can be selected. If a group is
selected, by example “Visual T&D Events”, all event types of that group will be
selected.

Accessing the Properties of a Data Point


The VssPtProp() function allows you to access the various data point properties. These properties
correspond to the different configuration columns in Visual T&D Explorer. Note that certain
properties are different for analog and binary points.

Function VssPtProp
This function has the following arguments:

Visual T&D Excel® Add-In • 19


Argument Description

Data points The list of data point names for which the properties are being requested. This
argument is mandatory.

Display The display parameters, including the properties to be displayed. This argument
is mandatory.

The following parameters are supported in the current version:

Name The data point name.

Unit The units associated with the data point.

Note: This property applies to analog points only.

Description The data point description.

Column Requests that the data be displayed by column. If you do not


include this parameter, the data will be displayed line by line.
The parameter can be inserted anywhere in the list of
properties to be displayed.

Connection The name of the connection to which the data points belong. You can specify
the name of the server computer or its IP address. This argument is optional,
unless the requested data points belong to 2 different connections.

Examples

Displaying the Properties of a Data Point


In the example below, VssPtProp function is used to display the name, the unit and the description
of data point L225.AB.

=VssPtProp(A7, "Name, Description, Unit")

The formula is typed in cell B7 and is automatically propagated to cells C7 and D7, since 3 fields
of information is requested.

The order of the display parameters determines the order in which the information is put into the
cells.

Displaying the Properties of Multiple Data Points


In this example, the VssPtProp function is used to display the unit and description of data points
L226.AA, L226.AB and L226.AC.

20 • Visual T&D Excel® Add-In


=VssPtProp(“L226.AA,L226.AB, L226.AC”, "Unit, Description")

Data point names are entered directly in the formula.

The formula is typed in cell B9 and it was automatically propagated to array B9 through C11,
since 2 fields of information are requested for 3 different data points.

Displaying the Properties of Multiple Data Points by Column


In this example, the VssPtProp function is used to display the same information as in the previous
example, but by column. References to cells B12 to D12 are made, rather than specifying data
point names directly in the formula.

=VssPtProp(B12:D12, "Column, Unit, Description")

Accessing the Current Value of a Data Point


The VssPtCurrVal() function allows you to access the information related to the current value
(real-time) of the data points.

Function VssPtCurrVal
This function has the following arguments:

Argument Description

Data points The list of data point names for which the current values are being requested.
This argument is mandatory.

Display The display parameters, including the information to be displayed. This


argument is mandatory.

The following parameters are supported in the current version:

Name The data point name.

Value The engineering value for an analog point, or the state for a
binary point.

Visual T&D Excel® Add-In • 21


Argument Description

Quality The quality of the current value or state of the data point. If the
quality is good, a value of 1 is displayed. If the value is bad or
unsure, a value of 0 is displayed.

Time The timestamp of the current value or state of the data point.
The value is in local time and represents the time of the last
transition received for the data point.

You can specify the parameter twice, in order to display the


date in one cell and the time in another.

Ms The milliseconds of the timestamp.

Column Requests that the data be displayed by column. If you do not


include this parameter, the data will be displayed line by line.
The parameter can be inserted anywhere in the list.

Connection The name of the connection to which the data points belong. You can specify
the name of the server computer or its IP address. This argument is optional,
unless the requested data points belong to 2 different connections.

Examples

Displaying the Current Value of a Data Point


In the example below, the VssPtCurrVal function is used to display several pieces of information
for data point L225.AA. The name, quality, value, date and time are requested, as well as the
milliseconds of the timestamp.

=VssPtCurrVal(L225.AA, "Name, Quality, Value, Time, Time, Ms")

The formula is typed in cell A2 and it was automatically propagated to cells B2 through F2, since
6 fields of information are requested.

The order of the display parameters determines the order in which the information is put into the
cells.

The Time parameter was entered twice in the formula, in order to put the date and time in 2
consecutive cells. Please note that cells D2 and E2 are formatted, since Excel had generated the
date and time in numerical format.

Displaying the Current Value of Multiple Data Points


In this example, function VssPtCurrVal is used to display the quality, value and timestamp of data
points L225.AA, L225.AB and L225.AC.

22 • Visual T&D Excel® Add-In


=VssPtCurrVal(A2:A4, "Quality, Value, Time")

The formula is typed in cell B2 and it was automatically put into to cells B2 through D4, since 3
fields of information are requested for each of the 3 data points.

Displaying the Current Value of Multiple Data Points by Column


In this example, VssPtCurrVal function is used to display the quality and value of 3 data points,
and data is requested to be displayed by column.

=VssPtCurrVal(B14:D14, "Column, Quality, Value")

Function VssCurrVal
This function is made available to provide compatibility with the old version of the Visual T&D
Excel Add-In. So unless you have an old version of the add-in, you should use the VssPtCurrVal
function.

The arguments for this function are the same as those for the VssPtCurrVal function. The Display
parameter can take on the following values, in addition to those described for the VssPtCurrVal
function:

Argument Description

Display 0 Equivalent to entering "Value" as an argument.

1 Equivalent to entering "Value, Time" as arguments.

2 Equivalent to entering "Value, Quality" as arguments.

3 Equivalent to entering "Value, Quality, Time" as arguments.

Accessing the History of a Data Point


The VssPtArchVal() function allows you to obtain the list of transitions for one or more data
points over a given period of time.

The function can be inserted in a single cell or in a range of cells. The Visual T&D Excel Add-In
selects the range of cells required to display the requested information.

Visual T&D Excel® Add-In • 23


If you request data for a point that has no historical data, the cells that display the information for
the data point will show #NULL!.

Function VssPtArchVal
This function has the following arguments:

Argument Description

Data points The list of data point names for which the transitions are being requested. This
argument is mandatory.

If the list contains multiple data points, the data for each point is grouped
together for the display.

Start Time Start time of the period for which the data is being requested. This argument is
mandatory.

End Time End time of the period for which the data is being requested. This argument is
mandatory.

Display The display parameters, including the information to be displayed. This


argument is mandatory.

The following parameters are supported in the current version:

Name The data point name.

Value The engineering value for an analog point, or the state for a
binary point.

Quality The quality of the current value or state of the data point.

Time The timestamp of the current value or state of the data point.

Ms The milliseconds of the timestamp.

Column Requests that the data be displayed by column. If you do not


include this parameter, the data will be displayed line by line.
The parameter can be inserted anywhere in the list.

Bound Specifies whether the data at the beginning and end of the time range is to be
included (1) or excluded (0). If no data exists at the bounding times, the next
data outside of the range is shown. This argument is optional and has a default
value of 0.

Maximum The maximum number of transitions requested for each data point. A value of 0
specifies that the maximum number of transitions returned for each data point is
the limit imposed by the server. This argument is optional and has a default
value of 0.

Connection The name of the connection to which the data points belong. You can specify
the name of the server computer or its IP address. This argument is optional,
unless the requested data points belong to 2 different connections.

24 • Visual T&D Excel® Add-In


Examples

Displaying the First 5 Transitions on a Data Point, for a Particular Period


In the example below, VssPtArchVal function is used to display the first 5 transitions on data
point L228.PT. The name, timestamp, timestamp milliseconds, value and quality are requested.

=VssPtArchVal(L228.PT,A2,B2,"Name, Time, Ms, Value, Quality",


C2,D2)

The order of the display parameters determines the order in which the information is put into the
cells.

Displaying the First 3 Transitions on 3 Data Points, for a Particular


Period
In this example, VssPtArchVal function is used to display the first 3 transitions on data points
L225.AA, L225.AB and L225.AC. The name, timestamp, timestamp milliseconds, value and
quality are requested.

=VssPtArchVal(A2:A4,B2,C2,"Name, Time, Ms, Value, Quality",


D2,E2)

The order of the display parameters determines the order in which the information is put into the
cells.

Visual T&D Excel® Add-In • 25


Accessing Data Calculated from the History of the Data Points
The VssPtCalcVal() function allows you to obtain data that is calculated based on the history of
the transitions on one or more data points, for a given period of time and a specific sampling
interval.

This function can be inserted in a single cell or in a range of cells. The Visual T&D Excel Add-In
selects the range of cells required to display the requested information.

If you request data for a point that has no historical data, the cells that display the information for
the data point will show a value of 0.

Function VssPtCalcVal
This function has the following arguments:

Argument Description

Data points The list of data point names for which the transitions are being requested. This
argument is mandatory.

Start Time Start time of the period for which the data is being requested. This argument is
mandatory.

End Time End time of the period for which the data is being requested. This argument is
optional.

If you do not specify an end time, the function returns all the available historical
data from the beginning of the period until the maximum number of transitions
has been reached.

Display The display parameters, including the calculated values to be displayed. This
argument is mandatory.

The following parameters are supported in the current version:

Time The timestamp of the start of the sampling period.

If you include this parameter in the list, it is always put into the
first column/line of the display.

Name The data point name.

If you include this parameter in the list, it is always put to the


right of/under the timestamp (if included).

Column Requests that the data be displayed by column. If you do not


include this parameter, the data will be displayed line by line.

Average The average value of the data for each sampling interval. The
average is calculated based on the values interpolated at the
beginning and end of each interval.

This calculation is the mean column of the temporary database


used to create Crystal Reports reports.

26 • Visual T&D Excel® Add-In


Argument Description

Average The numeric representation of the quality of the average data


Quality for the sampling interval.

For more information about quality values, see “Displayed


Quality Values”, page 30.

Average The text associated with the quality of the average data for the
Quality sampling interval.
String

Integral The integral value of the data for each sampling interval.

This calculation is the integ column of the temporary database


used to create Crystal Reports reports.

Integral The numeric representation of the quality of the integral data


Quality for the sampling interval.

For more information about quality values, see “Displayed


Quality Values”, page 30.

Integral The text associated with the quality of the integral data for the
Quality sampling interval.
String

Interpolative The value interpolated at the beginning of each sampling


interval.

Interpolative The numeric representation of the quality of the interpolative


Quality data for the sampling interval.

For more information about quality values, see “Displayed


Quality Values”, page 30.

Interpolative The text associated with the quality of the interpolative data
Quality for the sampling interval.
String

Maximum The maximum value for each sampling interval.

This calculation is the max column of the temporary database


used to create Crystal Reports reports.

Maximum The numeric representation of the quality of the maximum


Quality good raw data for the sampling interval.

For more information about quality values, see “Displayed


Quality Values”, page 30.

Maximum The text associated with the quality of the maximum good raw
Quality data for the sampling interval.
String

Visual T&D Excel® Add-In • 27


Argument Description

Maximum The time of the data item that has the maximum value for each
Actual Time sampling interval.

This calculation is the tMax column of the temporary database


used to create Crystal Reports reports.

Maximum The numeric representation of the quality of the time of the


Actual Time data that has the maximum value for the sampling interval.
Quality
For more information about quality values, see “Displayed
Quality Values”, page 30.

Maximum The text associated with the quality of the time of the data that
Actual Time has the maximum value for the sampling interval.
Quality
String

Maximum The milliseconds of the time of the data item that has the
Actual Time maximum value for each sampling interval.
Ms

Minimum The minimum value for each sampling interval.

This calculation is the min column of the temporary database


used to create Crystal Reports reports.

Minimum The numeric representation of the quality of the minimum


Quality good raw data for the sampling interval.

For more information about quality values, see “Displayed


Quality Values”, page 30.

Minimum The text associated with the quality of the minimum good raw
Quality data for the sampling interval.
String

Minimum The time of the data item that has the minimum value for each
Actual Time sampling interval.

This calculation is the tMin column of the temporary database


used to create Crystal Reports reports.

Minimum The numeric representation of the quality of the time of the


Actual Time data that has the minimum value for the sampling interval.
Quality
For more information about quality values, see “Displayed
Quality Values”, page 30.

Minimum The text associated with the quality of the time of the data that
Actual Time has the minimum value for the sampling interval.
Quality
String

28 • Visual T&D Excel® Add-In


Argument Description

Minimum The milliseconds of the time of the data item that has the
Actual Time minimum value for each sampling interval.
Ms

Standard The standard deviation for all the data included in each
Deviation sampling interval.

This calculation is the std column of the temporary database


used to create Crystal Reports reports.

Standard The numeric representation of the quality of the standard


Deviation deviation data for the sampling interval.
Quality
See the next section “Quality values” for value
interpretation.For more information about quality values, see
“Displayed Quality Values”, page 30.

Standard The text associated with the quality of the standard deviation
Deviation data for the sampling interval.
Quality
String

Sum of The sum of the decrements for all the data included in each
decrements sampling interval.

This calculation is the decr column of the temporary database


used to create Crystal Reports reports.

Sum of The numeric representation of the quality of the sum of


decrements decrements for all the data for the sampling interval.
Quality
For more information about quality values, see “Displayed
Quality Values”, page 30.

Sum of The text associated with the quality of the sum of decrements
decrements for all the data for the sampling interval.
Quality
String

Sum of The sum of the increments for all the data included in each
increments sampling interval.

This calculation is the incr column of the temporary database


used to create Crystal Reports reports.

Sum of The numeric representation of the quality of the sum of


increments increments for all the data for the sampling interval.
Quality
For more information about quality values, see “Displayed
Quality Values”, page 30.

Sum of The text associated with the quality of the sum of increments
increments for all the data for the sampling interval.
Quality
String

Visual T&D Excel® Add-In • 29


Argument Description

Variance The variance of the values included in each sampling interval.

Variance The numeric representation of the quality of the variance for


Quality the sampling interval.

For more information about quality values, see “Displayed


Quality Values”, page 30.

Variance The text associated with the quality of the variance for the
Quality sampling interval.
String

End The last valid value in each sampling interval.

End Quality The numeric representation of the quality of the last value for
the sampling interval.

For more information about quality values, see “Displayed


Quality Values”, page 30.

End Quality The text associated with the quality of the last value for the
String sampling interval.

Interval: Count The number of units of the sampling interval. This argument is mandatory.

Interval: Units The units of the sampling interval. This argument is mandatory and can take on
the following values:

Seconds The interval is specified in seconds.

Minutes The interval is specified in minutes.

Hours The interval is specified in hours.

Days The interval is specified in days.

Connection The name of the connection to which the data points belong. You can specify
the name of the server computer or its IP address. This argument is optional,
unless the requested data points belong to 2 different connections.

Displayed Quality Values


The VssPtCalcVal function includes, as parameters of its Display argument, quality value fields
that give additional information about the values that are displayed using this function. For
example, if this function is used to retrieve the minimum value, it can also provide the quality of
this minimum value.

A quality value is a 32-bit hexadecimal number that results from the combination of multiple
quality attribute values added together. For example, a quality value of 0x00020040, which is the
sum of 0x00020000 and 0x00000040, means that the corresponding value is respectively
“interpolated” and “uncertain”.

30 • Visual T&D Excel® Add-In


Note: Quality values are expressed as decimal numbers in Excel. However, working
with hexadecimal numbers makes it easier to decode the quality attributes that
compose the value. To transform a decimal value into an hexadecimal value in
Excel, use the DEC2HEX formula.

The following tables presents the quality attributes that can appear in a quality value.

Bad Quality Attributes Description

0x00000000 Bad Quality

0x00000004 Configuration Error

0x00000008 Not Connected

0x0000000C Device Failure

0x00000010 Sensor Failure

0x00000014 Last Known

0x00000018 Communication Failure

0x0000001C Out of Service

0x00000020 Waiting for initial data

Uncertain Quality Description


Attributes

0x00000040 Uncertain

0x00000044 Last Usable

0x00000050 Sensor Cal

0x00000054 EGU Exceeded

0x00000058 Subnormal

Good Quality Attributes Description

0x000000C0 Good

0x000000D8 Local Override

Visual T&D Excel® Add-In • 31


Additional Quality Description
Attributes

0x00010000 Extra Data

0x00020000 Interpolated

0x00040000 Raw

0x00080000 Calculated

0x00100000 No Bound

0x00200000 No Data

0x00400000 Data Lost

0x00800000 Conversion

0x01000000 Partial

Examples

Displaying Calculated Values for a Data Point over a One-Day Period,


with a One-Hour Sampling Interval
In the example below, VssPtCalcVal function is used to display the average, minimum and
maximum (including the timestamps) values stored in the historical database of data point
L225.AA, for each one-hour interval from midnight through 6 pm.

=VssPtCalcVal(“L225.AA”,A2,B2,"Time, Name, Average, Minimum,


Minimum Actual Time, Maximum, Maximum Actual Time", C2,D2)

32 • Visual T&D Excel® Add-In


Displaying Calculated Values for 2 Data Points over a 5-Minute Period,
with a 1-Minute Sampling Interval
In this example, VssPtCalcVal function is used to display the integral, the sum of the increments,
and the variance of the values stored in the historical database for points L225.AA and L225.AB,
for each one-minute interval.

=VssPtCalcVal(“L225.AA, L225.AB”,A2,B2,"Time, Name, Integral, Sum


of Increments, Variance", C2,D2)

Accessing the alarm and event history


The VssAlarmAndEventl() function allows you to obtain the list of alarms and event for one or
more type of events and one or more data points, for a given period of time and a specific
sampling interval.

This function can be inserted in a single cell or in a range of cells. The Visual T&D Excel Add-In
selects the range of cells required to display the requested information.

If you request data for an event types or a point that has no historical event log, the cells that
display the information for the event will show a value of #NULL!.

Function VssAlarmAndEvent
This function has the following arguments:

Argument Description

Start Time Start time of the period for which the data is being requested. This argument is
mandatory.

End Time End time of the period for which the data is being requested. This argument is
mandatory.

Visual T&D Excel® Add-In • 33


Argument Description

Display The display parameters, including the calculated values to be displayed. This
argument is mandatory.

The following parameters are supported in the current version:

Name The data point name.

Description The description of the event.

Value The engineering value for an analog point, or the state for a
binary point.

Time The timestamp of the current value or state of the data point.

Ms The milliseconds of the timestamp.

Note The note associated to the event or the point of the event.

Reference The reference associated to the event when it’s a user log
event.

Column Requests that the data be displayed by column. If you do not


include this parameter, the data will be displayed line by line.
The parameter can be inserted anywhere in the list.

Maximum The maximum number of events returned from the server A value of 0 specifies
that all events are returned. This argument is optional and has a default value of
0.

Alarms only Indicates if only alarms (1) are returned or if all events are (0).This flag is
effective only for event of the type « Process-related events”.This argument is
optional and has a default value of 0.

All event types Indicates if all events types must be included (1) or only those specified (0).
This argument is optional and has a default value of 0.

Event types List of the events type to be returned by the request. This argument is not
considered if « All event types » is at 1. Otherwise, this argument is mandatory.

All data points Indicates if all data points (1) are returned or only those specified (0). This
argument is optional and has a default value of 0.

Data points List of the data points to be considered in the request Events not related to a
point will ignore this argument This argument is not considered if “All data
points” is at 1. Otherwise, this argument is mandatory.

Connection The name of the connection to which the request will be sent. You can specify
the name of the server computer or its IP address. This argument is optional,
unless the application is connected to 2 or more server.

34 • Visual T&D Excel® Add-In


Examples

Displaying the alarms and events with a limit of 5 events


In the example below, VssAlarmAndEvent function is used to display the 5 first events for a given
date. All event types and data points are considered for the query. The following field are returned:
Name, Description, Time, Ms and value.

=VssAlarmAndEvent(B1;B2;"Name, Description, Value, Time,


Ms";5;;1;;1)

The order of the display parameters determines the order in which the information is put into the
cells.

Updating the Data


To avoid overloading the Visual T&D servers with numerous requests for access to cyclical data,
the standard Excel worksheet update mechanisms do not allow you to update the Visual T&D
data. However, if you modify some cells that are used as references for Visual T&D functions, the
data is updated automatically.

The Visual T&D Excel Add-In provides 3 menu commands for updating the data of the Visual
T&D functions.

Updating all the Data


This command launches an update of all the cells in the workbook that refer to a Visual T&D
function.

To update all the data:

‰ In the Visual T&D menu, click Update All Data.

Updating the Real-Time Data


This command launches an update of all the cells in the workbook that refer to a function that
accesses real-time Visual T&D data.

To update the real-time data:

‰ In the Visual T&D menu, click Update Real-Time Data.

Visual T&D Excel® Add-In • 35


Updating the Historical Data
This command launches an update of all the cells in the workbook that refer to a function that
accesses historical Visual T&D data.

To update the historical data:

‰ In the Visual T&D menu, click Update Historical Data.

36 • Visual T&D Excel® Add-In


Creating a Report Model

Overview
Microsoft Excel allows you to create report models which you can use to generate periodic
reports, without altering the model. Models are contained in files with an XLT extension.

The Visual T&D Excel Add-In provides additional functions to help you create your report
models.

Creating a Model
Creating an Excel report model simply entails saving a workbook in Excel workbook format (XLT
file). For information regarding the use of report models, you can consult the Microsoft Excel
online help.

Generating a Report from a Model


To generate a report based on a model, simply follow these simple instructions to update the report
data and save the report:

‰ In Windows Explorer, double-click on the template file (.XLT). Excel automatically creates a
new workbook based on the template.

‰ Make sure the Suspend the execution of the functions command of the Visual T&D menu
does not show a checkmark.

‰ In the Visual T&D menu, click Update All Data.

‰ When the update is done, save the document with the File menu Save command. Excel will
ask you to assign a name to the workbook (you cannot modify the model this way).

‰ In the Visual T&D menu, click Remove All Formulas, and save the document again. This
will ensure that when someone subsequently opens the file, the report data will remain as it
was when you saved it, rather than being updated with new information from the server.

Visual T&D Excel® Add-In • 37


Automating Report Generation

Overview
You can easily automate the generation of your reports, based on the models you have created.

Reports can be generated on a periodic basis, or when a specific event occurs. In both cases, a
Visual Basic for Applications (VBA) script must be used specifically for the generation. The
difference between both methods is how and when the script will be executed.

The periodic execution of a script can be planned using Windows scheduled tasks or Visual T&D
Explorer’s Task Manager. Event-triggered report generation should be automated using Visual
T&D Explorer’s Task Manager.

The most interesting feature of event-triggered report generation is the possibility to use the trigger
time to specify the range of data to include in the report. For example, an operator may be
interested to know the sequence of events that occurred 15 minutes prior to a breaker trip event,
and 5 minutes after. This is feasible using event-triggered report generation.

This chapter outlines the steps required to automate the generation of a report.

Creating the Report Generation Script


The first step consists of creating a VBA script (.VBS file) that interacts with Microsoft Excel to
open the report model, update the worksheet and the Visual T&D data, and save a static copy of
the report in a location of your choice.

Using the Trigger Time in Scripts and Report Models


When the script’s execution is triggered by an event, you can pass the trigger time to the script as
an argument, and thus refer to the trigger time in your report model to include data preceding and
following the triggering event’s occurrence. The script has the responsibility to set the trigger time
using the VssSetTriggerTime for further uses by Excel Add-In function calls found in the report
model. The trigger time is obtained via a call to VssGetTriggerTime function.

Both trigger time functions are described in details below.

Visual T&D Excel® Add-In • 39


Function VssSetTriggerTime

Note: This is a Visual T&D-specific VBA function. It is not available in Excel, but it can
be used in scripts.

The VssSetTriggerTime function is used to set the trigger date and time in a script prior to calls to
the VssGetTriggerTime function. Your script should take the trigger time as an argument, or
should know how to retrieve the trigger time by itself.

The VssSetTriggerTime function has the following arguments:

Argument Description

Trigger Time The date and time at which the event triggered the report generation. This
argument is mandatory.

Is Local Indicates if the trigger time should be interpreted by Excel as UTC time (0) or
local time (1). This argument is mandatory.

Function VssGetTriggerTime
The VssGetTriggerTime function is used to retrieve the trigger date and time as set by the
VssSetTriggerTime.

The VssGetTriggerTime function should be used as an argument for other Excel Add-In functions,
such as VssPtArchVal and VssPtCalcVal, in a report model. The report model can then be used in
a script as the template for the generated report.

The VssGetTriggerTime function has the following arguments:

Argument Description

Display The display parameters, including the information to be displayed. This


argument is optional.

The following parameters are supported in the current version:

Date and Get the trigger date and time as set by VssSetTriggerTime.
Time Milliseconds must be obtained via a second call, using the Ms
argument (see below).

Ms Get the trigger time’s milliseconds.

Example
In a report model, to display MAPLE_RTU_025_BUS_VA point’s transitions that were recorded 3
hours (0.125 of a day) prior to the event, you should type the following formula in a cell:
=VssPtArchVal(B1, VssGetTriggerTime()-0.125; VssGetTriggerTime(); "time,
value, quality"; 0)

40 • Visual T&D Excel® Add-In


As requested, the timestamp (time), value and quality of each transition are displayed in separate
columns. Please note that column A is formatted since Excel generates the date and time in
numerical format.

Creating the Script


You can use the example file installed with Excel Add-In to create a custom script file to generate
your reports. The file can be found in the product documentation and is called Excel Report -
Automatic Generator.vbs. The script it contains requires up to 4 parameters to generate a
report from a template:

‰ The name and path of the template to be used.

‰ The path of the folder in which the report is to be stored.

‰ The name of the output file.

‰ The trigger time. This parameter is optional and used for event-triggered report generation
(see “Using the Trigger Time in Scripts and Report Models”, page 39 for more details).

Note: The script shown adds the date and time of the report generation to the output
file name, in order to avoid overwriting the same file each time the report is
generated.

To create the report generation script:

‰ Save the example file under a name of your choice with a VBS extension.

Testing the Script


To verify that your script is working:

Visual T&D Excel® Add-In • 41


‰ Open a command prompt window.

‰ Run the script by entering the following command:

wscript <script name> <template name> <destination path> <output file name>

Example:
wscript "D:\Reports\my script.vbs" "D:\Reports\Template 1.xlt"
"D:\Reports\Output\" "Report 1.xls"

‰ Make sure the report was indeed generated in the destination folder.

Note: If you experience any problems with script files, feel free to contact our technical
support. However, the script should work if you follow the preceding instructions
carefully.

Scheduling a Periodic Report Generation


Once your script file is ready, you can have Windows request a periodic generation of your report,
using Windows scheduled tasks.

To schedule the generation of a report:

‰ Click Start, then All Programs, then Accessories, then System Tools, and then Scheduled
Tasks.

‰ In the Scheduled Tasks window, double-click Add Scheduled Task.

‰ In the Scheduled Task Wizard window, click Next.

‰ Click Browse, and locate wscript.exe, which normally resides in WINNT\system32\ on your
hard disk.

‰ Choose the reporting period, and click Next.

‰ Specify the frequency at which the task is to be run, as well as the start date and time, and
click Next.

‰ Enter your user name and password information, and click Next.

‰ Put a checkmark in the Open advanced properties for this task when I click Finish box,
and click Finish.

‰ In the wscript window, enter a space after the path shown in the Run box, followed by the
command line described in the previous section, as shown in the example below.

42 • Visual T&D Excel® Add-In


‰ Follow the remaining Scheduled Task Wizard steps.

When you have finished creating the scheduled task, you can verify that the task will be executed
properly as follows:

‰ In the Scheduled Tasks window, select the task to be executed.

‰ In the File menu, click Run.

‰ When the command has finished executing, verify that the report was indeed generated in the
destination folder.

Creating an Event-Triggered Task to Generate Reports


Visual T&D Explorer’s Task Manager allows a user to create event-triggered tasks. These tasks
can create simple reports, but can also launch application or scripts.

For example, a user may want to automate the generation of a report when a breaker opens. The
report would contain all transitions and the sequence of events prior, and after, the breaker event.
This is made possible using the Task Manager, by creating a task that executes a report-generation
VBA script. This task must then be configured to be triggered by the breaker’s opening event.

Task management is explained more in details in the Visual T&D Explorer User Manual.

Visual T&D Excel® Add-In • 43


Tips and Tricks

Overview
This chapter presents a few tricks and tips to make it easier for you to use the Visual T&D Excel
Add-In, and to create reports and templates.

Tricks and Tips

Function TODAY()
This Microsoft Excel function, which is part of the broader Date and Time function, displays
today's date and time. You can use the function to create a daily report template. Simply refer to
the cell in which you have placed the function, in order to specify the interval for which you want
to obtain the data.

You can add or subtract a number of days to or from the result of the function, in order to obtain
the interval for today, yesterday, and so on.

Function NOW()
This Microsoft Excel function, which is part of the broader Date and Time function, displays the
current date and time. You can use the function to create a report template in which you refer to
the function to indicate the report generation date.

However, you should avoid using the result of this function as an argument for Visual T&D
functions. Each time Excel updates a worksheet, all formulas that refer to cells containing the
NOW() function are transmitted as requests to the Visual T&D server. Furthermore, the Visual
T&D Excel Add-In forces an update of the worksheet whenever the results are ready for display.
This situation could potentially lead to an avalanche of updates.

Visual T&D Excel® Add-In • 45


Limitations and Known Problems

Excel Worksheet Limitations


Worksheets are limited to 65,535 lines and 256 columns. If a data access function needs to exceed
these limits in order to display all the results, the cell in which you entered the function will show
#Cannot display.

Merge & Center Function

Using the Excel Merge & Center function, which you access via the toolbar button , can
cause problems using Visual T&D functions. To avoid problems using this function, make sure
you do not merge two cells containing Visual T&D functions. Furthermore, do not use more than
one Visual T&D function in a given formula, except for the VssGetTriggerTime function that may
be used as an argument to another function (see “Function VssGetTriggerTime”, page 40).

Loss of Selection after a Data Update


The data update mechanisms of the Visual T&D Excel Add-In can sometimes cause the current
cell to be deselected. This problem is an irritant but does not cause any damage or loss of data.

46 • Visual T&D Excel® Add-In

You might also like