Spirit IT eXLerate 2016 reference manual II

Add to my manuals
86 Pages

advertisement

Spirit IT eXLerate 2016 reference manual II | Manualzz

Configuration-, parameterization instruction COI/eXL2016-EN

Spirit

IT

eXLerate 2016

Advanced topics reference

Programming topics, wizards, tools, controls, alarm management, trending, relational databases, client/server, redundancy, multiple languages, terminal services, customization & troubleshooting

Measurement made easy

Welcome to the exciting world of eXLerate 2016!

Using eXLerate, you are able to create your complete real-time

HMI applications completely from the well-known and most popular Microsoft® Excel environment.

This manual is the reference manual with which a developer is able to create a full-featured, full-blown real-time HMI application.

There are two reference manuals:

 The ‘Application reference manual’, with the installation and setup guide, a tutorial, the control center reference, and application development guide.

 This ‘Advanced topics reference’ manual with various additional information about the built-in wizards & tools, the worksheet- and VB function reference, database management system extensions, and various other topics.

For more information

All publications of eXLerate are available for free download from http://www.spiritit.com/support/downloads. eXLerate application reference manual eXLerate migration manual eXLerate release notes

Math function reference manual

Contents

1 Introduction to eXLerate ....................................... 5

1.1

Advantages ...................................................... 5

1.2

Purpose of this manual ..................................... 5

1.3

How this manual set should be used .................. 6

1.4

Abbreviations ................................................... 7

1.6

Terms and definitions ........................................ 9

1.7

Document conventions.................................... 10

2 Programming topics ............................................ 11

2.1

Structuring your applications ........................... 11

2.1.1

Introduction ....................................... 11

2.1.2

Worksheet organization ...................... 11

2.2

Calculation sheets .......................................... 12

2.2.1

Introduction ....................................... 12

2.2.2

Calculation sheet layout ...................... 12

2.2.3

Calculation wizard .............................. 14

2.2.4

Other tips for structured applications ... 14

5 Controls .............................................................. 27

5.1

Introduction .................................................... 27

5.2

Control overview ............................................. 27

5.3

Inserting controls ............................................ 27

5.4

Modifying controls ........................................... 27

5.5

Control Properties ........................................... 28

5.5.1

Backgrounds ...................................... 28

5.5.2

Borders & lines ................................... 29

5.5.3

Margins .............................................. 29

5.5.4

Fonts ................................................. 29

5.5.5

Formats .............................................. 29

5.5.6

Themes .............................................. 30

5.5.7

Templates .......................................... 30

5.5.8

List columns ....................................... 30

3

4

Summer/winter-time ............................................ 16

3.1

3.2

Introduction .................................................... 16

Adjusting time ................................................ 16

Wizards and tools ............................................... 18

4.1

Introduction .................................................... 18

4.2

Wizards .......................................................... 19

4.2.1

Tag & Object wizard (Ctrl + W) ............ 19

4.2.2

Calculation wizard .............................. 20

4.2.3

Color wizard ....................................... 20

4.2.4

Button wizard ..................................... 21

4.2.5

Language wizard ................................ 22

4.3

Tools ............................................................. 23

4.3.1

Shape property tool ............................ 23

4.3.2

Name definition tool ............................ 23

4.3.3

Color palette tool (Ctrl + L) .................. 24

4.3.4

Alarm tree tool (Ctrl + M) ..................... 24

4.3.5

Generate report .................................. 24

4.3.6

Generate HTML .................................. 25

4.3.7

Browse OPC servers .......................... 25

4.3.8

Communications options .................... 25

4.3.9

Show Control Center .......................... 25

4.3.10

Unprotected cells marker (Ctrl + U) ...... 25

4.3.11

Remove external links ......................... 25

4.3.12

Reset historical values ........................ 25

4.3.13

Recalculate application (Ctrl + R) ......... 26

4.3.14

Import sheets ..................................... 26

4.3.15

Advanced replace ............................... 26

6 Alarm management.............................................. 31

6.1

Alarm page types ............................................ 31

6.2

Alarm components .......................................... 31

6.3

Tag database .................................................. 32

6.4

Alarm group table ............................................ 32

6.5

Alarm summary control .................................... 32

6.5.1

Introduction ........................................ 32

6.5.2

Alarm groups ...................................... 32

6.5.3

Alarm list ............................................ 33

6.5.4

Alarm states ....................................... 34

6.5.5

Filters ................................................. 34

6.5.6

Real-time mode .................................. 34

6.5.7

Acknowledgement .............................. 35

6.5.8

Editing alarms ..................................... 35

6.5.9

Security .............................................. 35

6.6

Worksheet: Alarm History ................................ 36

6.6.1

Alarm History - Theory of operation ...... 36

6.7

Worksheet: Event history ................................. 37

6.7.1

Event history - Theory of operation ...... 37

6.7.2

Event history buttons .......................... 37

6.8

VBA and worksheet functions .......................... 38

6.9

Alarm dead-band ............................................ 39

6.10

Other alarm options ......................................... 39

2 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

7 Trending .............................................................. 40

7.1

Introduction .................................................... 40

7.2

Enabling trending ............................................ 40

7.3

Trending parameters ....................................... 40

7.4

Visualizing trend data ...................................... 40

7.5

exTrendChart control ....................................... 41

7.5.1

Chart area .......................................... 41

7.5.2

Plot area............................................. 41

7.5.3

Navigation .......................................... 41

7.5.4

Data cursor ........................................ 42

7.5.5

Time axes ........................................... 43

7.5.6

Value axes .......................................... 43

7.5.7

Pen defaults ....................................... 44

7.5.8

Markers .............................................. 44

7.5.9

Limits ................................................. 44

7.6

exTrendPenSelector control ............................. 45

7.6.1

Linking to a chart control ..................... 45

7.6.2

Tags................................................... 45

7.6.3

Pen sets ............................................. 45

7.6.4

Pens .................................................. 46

7.7

exTrendNavigator control ................................. 47

7.7.1

Selection area ..................................... 47

7.7.2

Automatic zooming ............................. 47

7.8

Accessing trend-data directly ........................... 48

7.9

Data storage ................................................... 48

7.9.1

Reading trend files .............................. 48

9 Servers, clients & printers ................................... 59

9.1

Introduction .................................................... 59

9.2

Network configuration sheet (xNet) .................. 59

9.3

Server/Client configuration .............................. 60

9.4

Printers configuration ...................................... 61

9.5

Advanced settings .......................................... 62

9.6

Application development ................................. 62

9.6.1

Names ............................................... 62

9.6.2

Pre-defined animations ....................... 63

9.6.3

Conditional development ..................... 64

9.6.4

Event logging ..................................... 64

9.6.5

Writing to IO devices .......................... 64

9.6.6

Synchronized parameters .................... 65

9.6.7

Shared values .................................... 65

10 Redundancy ........................................................ 67

10.1

Introduction .................................................... 67

10.2

Device redundancy ......................................... 67

10.4

10.2.1

Introduction ....................................... 67

10.2.2

10.3.2

Configuration ..................................... 67

10.3

Device communication channel redundancy ..... 68

10.3.1

Introduction ....................................... 68

Multiple active communication channels ........................................................ 68

10.3.3

Single active communication channel ... 68

Server redundancy .......................................... 70

10.4.1

Introduction ....................................... 70

10.4.2

Duty selection .................................... 70

10.5

Network redundancy ....................................... 72

10.5.1

Introduction ....................................... 72

10.5.2

Network considerations ...................... 72

8 Relational Databases ........................................... 49

8.1

Introduction .................................................... 49

8.2

The embedded database ................................. 49

8.2.1

Table layout ........................................ 49

8.2.2

Database identifiers............................. 49

8.2.3

User definable tables ........................... 50

8.2.4

Driver specific info values .................... 50

8.2.5

Redundancy & synchronization ............ 50

8.2.6

Advanced settings .............................. 50

8.2.7

Corruption & data loss......................... 50

8.2.8

Troubleshooting .................................. 51

8.3

External databases .......................................... 51

8.3.1

Configuration ...................................... 51

8.3.2

MySQL database driver ....................... 51

8.3.3

SQLServer Database Driver ................. 52

8.4

SQL worksheet functions ................................. 53

8.4.1

Introduction ........................................ 53

8.4.2

Queries .............................................. 53

8.4.3

Views ................................................. 53

8.4.4

SQL table ........................................... 54

8.4.5

Views ................................................. 54

8.5

SQL VBA functions .......................................... 56

8.5.1

The ‘SQLCmd’ object .......................... 56

8.5.2

Executing SQL statements................... 56

8.5.3

Reading SQL results ........................... 56

8.5.4

Writing SQL results to worksheets ....... 56

8.5.5

Executing a-synchronous SQL statements ...................................................... 56

11 Multiple languages .............................................. 74

11.1

11.2

Introduction .................................................... 74

Application support ......................................... 75

11.2.1

Adding multi-lingual support ................ 75

11.2.2

Language worksheet layout ................. 76

11.2.3

11.2.4

Adding user defined texts ................... 77

11.2.5

Multi-lingual tag database ................... 77

11.2.6

11.2.7

Multi-lingual worksheets ...................... 78

11.2.8

Multi lingual VBA code and forms ........ 78

11.2.9

Adding languages ............................... 76

Multi-lingual buttons ........................... 77

Language selection ............................. 79

12 Terminal services ................................................ 80

12.1

Introduction .................................................... 80

12.2

12.3

Configuration .................................................. 80

12.4

Requirements ................................................. 80

12.2.1

Operating system ............................... 80

12.2.2

Microsoft office .................................. 80

12.2.3

12.3.2

eXLerate license ................................. 80

12.3.1

Operating system ............................... 80 eXLerate ............................................ 80

Using terminal services ................................... 81 eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 3

13 Troubleshooting .................................................. 82

13.1

Introduction .................................................... 82

13.2

Real-time data communications problems ........ 82

13.3

Worksheet functions are excessively called ...... 83

13.4

The application does not start up properly ....... 83

4 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

1 Introduction to eXLerate

1.1 Advantages

With eXLerate, you are able to develop your process visualization applications in a convenient and familiar spreadsheet environment, and yet, for the operator generate a robust and more than complete application.

In an application created with eXLerate, which is stored in just one (!) single standard Excel workbook, you can:

 Obtain real-time values from external devices, such as a process controller, flow computer, or other device, directly into a spreadsheet cell utilizing the available communication drivers or from an OPC server.

 Visualize the obtained data in a display page using the powerful possibilities of Excel.

 Animate shape objects, such as a bar graph, with the realtime data. Shapes may be created with the office shape library, or may be imported from external tools, such as

Microsoft® Visio, or even AutoCAD®.

 Create many types of alarms for a tag, which can be printed, logged on disk or shown on a window on the display.

Trend these values, for an historical overview of a value, in a real-time or historical trend graph.

 Perform extensive calculations on the obtained data, using directly an ‘=’ formula in Excel.

 Generate professional-looking reports of the obtained, derived and all other data, graphics and tables as available in eXLerate.

 Create additional Visual Basic for Applications code to be even more flexible and powerful, with which you can create your own dialogs, functions and subroutines.

 Add database functionality in your application utilizing one of the available database standards, such as, MySQL (which is also as embedded database), SQL Server or any other

OLEDB type driver.

 Secure your applications, so an operator is restricted in his

Windows environment.

 Publish your display pages in HTML/XML/VML format onto the Internet using the built-in support of Excel.

 Skip going through a steep learning curve as is required for all other process visualization software packages. And there is no programming required to do so.

 Trouble-shoot in an open environment, without black boxes.

 Do much, much more, utilizing the fully open architecture of the Microsoft Office environment. All of these possibilities as mentioned above can be realized from within your familiar

Microsoft Excel environment.

1.2 Purpose of this manual

This eXLerate 2016 reference manual is written for a variety of readers:

The application developer, who is interested in all details required to develop a complete real-time application with eXLerate.

He or she is assumed to be acquainted in general with visualization software.

It would be an advantage if the application developer is familiar with the basics of some other real-time HMI or SCADA software package.

A more generally interested reader, who wonders if the capabilities and features of eXLerate will satisfy his/her project requirements.

Both types of readers are assumed to be familiar with the environment of Microsoft Office members, especially Microsoft

Excel.

Where the more generally interested reader is expected to be commonly acquainted with Excel, the application developer is assumed to have a thorough understanding of at least the following aspects of Excel:

 Worksheet/workbook organization

 Named ranges, tables

 ‘=’ Worksheet formula syntax

 Cell formatting

 Macro recording and playback

Although not absolutely required, a programmer is also assumed to have a good understanding of the programming environment of Visual Basic for Applications.

When one of the above areas is looking unfamiliar to the application programmer, looking for one of the - more than many – excellent study books on Microsoft Excel would be a great idea. eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 5

1.3 How this manual set should be used

This reference manual is setup both as a manual, in which a newcomer is quickly introduced with the principles and techniques of real-time application development, as well as a reference manual, in which all details of application engineering can be found. The manual is setup in two volumes, as follows:

Application reference manual

In the first chapters, an introduction is given to the manual.

Various terms and definitions as used throughout this book are given.

In chapter 2: ‘

Getting Started’

the user is acquainted with hardware and software requirements for eXLerate, the available options, and explains how to install the software on the computer. The content of the end-user license agreement is added for convenience. In this chapter, the usage of the

License number and corresponding authorization key are explained.

In chapter 3: ’

Tutorial

’, the user is introduced to the concept of eXLerate and the basic ingredients of a complete application, and is added to this reference to quickly start application development in eXLerate.

In the next chapters, fully detailed information is given on all software components.

In chapter 4: ‘Control Center reference’, a full explanation is given on using the eXLerate Control center program.

In chapters 5-10: ‘

Application development’

, an overview of the components in a complete application is given, so the user knows how start with the development of an application. Other issues of an application are discussed as well, which completes the process of engineering an application in this chapter.

In chapter 11: ‘

Reporting

’ is described, so a user is able to add reports to an application, and able to publish reports or display pages as HTML files on a web-server.

Advanced topics reference manual

In this volume, many

advanced topics

, such as structuring your application, and how to utilize calculation worksheets in an application are described in the first chapters.

The next chapters of this volume give detailed information on how to use the various

wizards and tools

in case not already discussed in the Reference Manual.

In the

Function API Reference

chapters, all worksheet functions and VBA interfaces are described in detail, with all parameters, comments and return values. This chapter is the core reference part of the eXLerate API in Microsoft Excel.

In ‘

Trouble shooting

’, help is offered when things might not work out the way you have expected.

In the next chapter, you will learn how to add a relational database based on MySQL to your application, and how to use a relational database in an application.

MySQL has been selected as the database engine typically used in an eXLerate environment, because of its programming power, excellent performance as well as its beneficial economic aspects.

6 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

1.4 Abbreviations

Throughout this document the following abbreviations are used:

AI Analog Input

AO

API

ASCII

Analog Output

Application Programming Interface

An interface that allows an application to interact with an application or operating system, in our case, eXLerate. Most of the eXLerate API is implemented through Excel worksheet functions.

American Standard Code for Information Interchange.

A set of standard numerical values for printable, control, and special charac ters used by PCs and most other computers. Other commonly used codes for character sets are ANSI, Unicode, and EBCDIC (Extended Binary-Coded Decimal Interchange Code, used by IBM for mainframe computers).

COM

CPU

DAC

DCE

DCS

DDE

DI

DLL

Component Object Model

Standard for distributed objects, an object encapsulation technology that specifies interfaces between component objects within a single application or between applications. It separates the interface from the implementation and provides APIs for dynamically loc ating objects and for loading and invoking them (see ActiveX and DCOM).

Central Processing Unit

Digital to Analog Converter

Distributed Computing Environment

Definition from the Open Software Foundation, DCE provides key distributed technologies su ch as RPC, distributed naming service, time synchronization service, distributed file system and network security.

DCOM Distributed Component Object Model

Microsoft’s protocol that enables software components to communicate directly over a network in a re liable, secure, and efficient manner.

DCOM is based on the DCE-RPC specification and works with both Java applets and ActiveX components through its use of the COM. See also ActiveX.

Distributed Control System

Dynamic Data Exchange

A relatively old mechanism for exchanging simple data among processes in MS -Windows.

Digital Input

Dynamic Link Library.

A file containing a collection of Windows functions designed to perform a specific class of operations. Most DLLs carry the . DLL extension, but some Windows DLLs, such as Gdi32.exe, use the .EXE extension. Functions within DLLs are called (invoked) by applications as necessary to perform the desired operation.

DO

EGU

EIA

GUI

HART

HMI

Digital Output

Engineering Units

Electrical Industries Association

Graphical User Interface

Highway Addressable Remote Transducer.

A protocol defined by the HART Communication Foundation to exchange information between process control devices such as trans mitters and computers using a two-wire 4-20mA signal on which a digital signal is superimposed using Frequency Shift Keying at 1200 bps.

Human Machine Interface.

I/O

IEEE

ISO

MES

Also referred to as a GUI or MMI. This is a process that displays graphics and allows people to interface with the control sy stem in graphic form. It may contain trends, alarm summaries, pictures, and animations.

Input/Output

Institute for Electrical and Electronics Engineers

International Standards Organization

Management Execution System.

A level of monitoring of a process control system that is above the PLC and HMI level, where data analysis and integration with other aspects of a company such as accounting and purchasing play a significant role.

MMI

MIC

Man Machine Interface

Machine Identification Code. License code of eXLerate which uniquely identifies your computer.

ODBC Open Data Base Connectivity.

A standardized application programmer's interface (API) for databases. It supports Visual Basic, Visual C++, and SQL for Acce ss, Paradox,

Text, Excel and many more database standards.

OEM

OLE

Original Equipment Manufacturer

Object Linking and Embedding.

A protocol specification by which an object, such as a photograph, a spreadsheet, video, sound, etc., can be inserted into an d used by an application. Renamed by Microsoft into ‘ActiveX’. eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 7

OSI

OPC

P&ID

PC

PCB

PLC

RPC

Open System Interconnection.

An ISO standard for worldwide communications that defines a networking framework for implementing protocols in seven layers. Control is passed from one layer to the next, starting at the application layer in one station, proceeding to the bottom layer, over the channel to the next station and back up the hierarchy.

OLE for Process Control.

A particular COM interface specification. Applications which implement the OPC interface are abl e to inter-operate without the developer needing to control both the server and client development. In essence, by following the OPC interface, clients and servers fr om different manufacturers can communicate and interact successfully. The OPC interface is designed to offer the types of interactions that are typical of process I/O hardware such as PLC, DCS and direct I/O boards. eXLerate 2016 is OPC DA 2.05 compliant, and Spirit

IT

is a member of the OPC Foundation.

Piping and Instrumentation Diagram

Personal Computer

Printed Circuit Board

Programmable Logic Controller.

A specialized device used to provide high-speed, low-level control of a process. It is programmed using Ladder Logic, or some form of structured language, so that engineers can program it. PLC hardware may have good redundancy and fail-over capabilities.

Remote Procedure Call

A form of application-to-application communication that hides the intricacies of the network by using an ordinary procedure call mechanis m. It is a tightly coupled synchronous process.

RS232 EIA standard for point to point serial communications in computer equipment

RS422 EIA standard for two-wire differential unidirectional multi-drop serial

RS485 EIA standard for two-wire differential bidirectional multi-drop serial communications in computer equipment

RTU Remote Terminal Unit

SCADA Supervisory Control and Data Acquisition

SQL

SVC

Standard Query Language

Supervisory Computer

TCP/IP Transmission Control Protocol/Internet Protocol.

Transmission Control Protocol/Internet Protocol. The control mechanism used by programs that want to speak over the Internet. It was established in 1968 to help remote tasks communicate over the original ARPANET.

TTL Transistor-Transistor Logic

UART Universal Asynchronous Receiver & Transmitter

URL Uniform Resource Locator.

The global address for documents and resources on the World Wide Web.

VBA Visual Basic for Applications.

The official name is "Visual Basic, Applications Edition." VBA is Microsoft' s common application programming (macro) language for Excel,

PowerPoint, Visio, Access, Project, Word, and the Visual Basic programming environment.

VBE

VML

XLL

Visual Basic for Excel.

Although VBA is a general name for the Visual Basic in Office, more specifically, in Excel, the term VBE is used as well.

Vector Markup Language.

An XML based graphics rendering language that describes how an object should be drawn on web pages resulting in more flexibil ity for the developer and faster, smaller graphical images.

Excel Link Library.

XML

Special formatted DLL, which is recognized by Excel as extension library. In an XLL, typically worksheet calculations are def ined. For example, the xlMath library from Spirit IT containing petrochemical equations has an XLL format.

Extensible Markup Language. A specification for Web documents that allows developers to create custom tags that enable the definition, transmission, validation and interpretatio n of data contained therein.

8 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

1.6 Terms and definitions

Throughout this manual the following additional terms and definitions are used:

Asynchronous A type of message passing where the sending task does not wait for a reply before continuing processing. If the receiving task cannot take the message immediately, the message often waits on a queue until it can be received.

ActiveX

C/C++

Client/server

Device driver

Engineering units

Ethernet

Event

Exception

Fieldbus

Kernel

Peer-to-peer

Polling

Process visualization software

Protocol

Query

Real-time

Real-time database

A family of Microsoft object technologies, formerly called OLE, based on the Common Object Model (COM), serving nowadays as the foundation of many internet products. See also COM/DCOM/OLE.

C is a low-level compiled programming language popular for real-time applications because of its precision and rapid execution times. C++ is an object-oriented superset of C.

A network architecture in which each computer or process on the network is either a client or a server. Clients rely on servers for resources, such as files, devices, and even processing power.

Another type of network architecture is known as a peer-to-peer architecture. Both client/server and peer-to-peer architectures are widely used, and each has unique advantages and disadvantages. Client/server architectures are sometimes called two-tier architectures

A program that sends and receives data to and from the outside world. Typically a device driver will communicate with a hardware interface card that receives field device messages and maps their content into a region of memory on the card. The device driver then reads this memory and delivers the contents to the spreadsheet.

Engineering units as used throughout this manual refers in general to the units of a tag, for example ‘bar’, or ‘ºC’, and not to a type of unit, as with ‘metric’ units, or ‘imperial’ units.

A LAN protocol developed by Xerox in cooperation with DEC and Intel in 1976. Standard Ethernet supports data transfer rates of 10 Mbps. The Ethernet specification served as the basis for the IEEE 802.3 standard, which specifies physical and lower software layers. A newer version, called 100 -Base-T or Fast Ethernet supports data transfer rates of 100 Mbps, while the newest version, Gigabit Ethernet supports rates of 1 gigabit (1000 megabits) per second.

Anything that happens that is significant to a program, such as a mouse click, a change in a data point value, or a command from a user.

Any condition, such as a hardware interrupt or software error -handler, that changes a program's flow of control.

A set of communication protocols that various hardware manufacturers use to make their field devices talk to other field devices. Fieldbus protocols are often supported by manufacturers of sensor hardware. There are debates as to which of the different fieldbus protocols is the best. Popular types of fieldbus protocol include Modbus, Hart,

Profibus, Devicenet, InterBus, and CANopen.

The core of eXLerate that handles basic functions, such as hardware and/or software interfaces, or resource allocation.

A type of network in which each workstation has equivalent capabilities and re sponsibilities. This differs from client/server architectures, in which some computers are dedicated to serving the others. Peer -to-peer networks are generally simpler, but they usually do not offer the same performance under heavy loads. Peer -to-peer is sometimes shortened to the term P2P.

A method of updating data in a system, where one task sends a message to a second task on a regular basis, to check if a data point has changed. If so, the change in data is sent to the first task. This method i s most effective when there are few data points in the system. Otherwise, exception handling is generally faster.

A system for monitoring and controlling for production processes, and managing related data. Typically such a system is connected to external devices, which are in turn connected to sensors and production machinery.

The term ‘process visualization software’ in this document is generally used for software with which SCADA software, HMI software, or supervisory computer software applications can be built. In this document, although strictly not correct, the terms ‘SCADA, ‘HMI, ‘supervisory’, and ‘process visualization’ are alternately used, and refer to the computer software applications that can be realized with eXLerate.

An agreed-up format for transmitting data between two devices. In this context, a protocol mostly references to the

Data Link Layer in the OSI 7-Layer Communication Model.

In SCADA/HMI terms a message from a computer to a client in a master/client configuration utilizing the message protocol with the purpose to request for information. Usually, more than 1 data -point is transmitted in a single query.

The characteristic of determinism applied to computer hardware and/or software. A real-time process must perform a task in a determined length of time.

The phrase "real-time" does not directly relate to how fast the program responds, even though many people believe that real-time means real-fast.

A flat database designed for quick, deterministic response. Not to be confused with a relational database, a real time database is like a hub--a lively transfer point where data can be updated and sent virtually instantaneously, eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 9

from and to many processes at the same time. In eXLerate, the contents of the real-time database can be stored in the system registry to avoid startup and shutdown problems in an application.

Registry

Resource

Synchronous

System registry

Tag

Visual Basic

A database that contains information required for the operation of Windows, plus applications installed under

Windows.

Any component of a computing machine that can be utilized by software. Examples include: RAM, disk space, CPU time, real-world time, serial devices, network devices, and other hardware, as well as O/S objects such as semaphores, timers, file descriptors, files, etc.

A type of message passing where the sending task waits for a reply before continuing processing.

The registry in Windows is an internal register, in which many properties and values from the operating system, such as class definitions, file associations, file types etc. are stored. The system registry is also used as a replacement of the older ‘.ini’ files, in which a specific program can store its internal settings a nd properties. eXLerate also uses the registry for storage of both its component properties, as well as for storage of real -time settings and user-defined parameters.

A ‘tag’ as used within this document refers to a data point existing in the tag dat abase, with a number of properties, such as its assigned I/O address, current value, engineering units, description, alias name, and many others.

A graphical programming language and development environment created by Microsoft in 1990, and currently the de-facto standard for scripting in applications like Microsoft Office. All macros in Office are created in Visual Basic.

Web Server A computer that has server software installed on it and is used to deliver web pages to an intranet/Internet.

1.7 Document conventions

Specific keys, i.e. function keys, editing keys, cursor direction keys etc., are presented with the text on top of the key en closed between ‘<‘ and ‘>‘ characters. For example <F1> refers to function key 1 while <Esc> refers to the key with the text ‘Esc’ imprinted.

Sometimes the user is assumed to press two keys simultaneously. If this is the case those keys are specified separated by a ‘ -’ character. So when <Ctrl-F1> or <Ctrl-a> appears in the text the user should press and release the keys <Ctrl> and <F1> or

<Ctrl> and ‘a’-key simultaneously.

When the book symbol as displayed at the left appears A symbol as displayed at the left indicates that the user may read further on the subject in one of the sample workbooks as installed on your machine. in the text in this manual, a reference is made to another section of the manual. At the referred section, more detailed, or other relevant information is given.

When in this manual a symbol as displayed at the left appears in the text, certain specific operating instructions are given to the user. In such as case, the user is assumed to perform some action, such as the selection of a certain object, worksheet, or typing on the keyboard.

When an important remark is made in the manual requiring special attention, the symbol as displayed to the left appears in the text.

10 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

2 Programming topics

2.1 Structuring your applications

2.1.1 Introduction

User-defined calculations in eXLerate may be placed everywhere: on potentially each worksheet cell, an expression containing worksheet functions may be entered. In various worksheets, for example in the tag database, next to the last database columns, such calculations may be entered. On operator display worksheets, user-defined expressions may be entered, for example to calculate the engineering units of a process parameter.

In itself it is acceptable to use this approach, and technically correct. However, there are a number of drawbacks to this ‘atrandom’ approach:

 It is difficult to obtain an overview of a complicated calculation, because functionality is scattered over various worksheets.

 It is difficult to do maintenance on an application, because each application is specifically built in a unique way. “Where did I put the equation for unit conversions again?”

 Redundancy in application engineering is hard to avoid, because on various sheets, the same result is required. This result is likely to be re-implemented each time it is needed.

 Unstructured applications are likely to be created when calculations are scattered over the workbook. The drawbacks of creating and maintaining unstructured programs are too many to discuss in this context.

It is clear from the above that a structured application has many advantages:

 It is easy to obtain an overview of a complicated calculation, because functionality is grouped together over well-defined worksheets.

 Maintenance on an application can be done by various programmers, since all applications are similarly built according to the same principle.

 Redundancy will be avoided: each calculation is present only once, on a dedicated worksheet area.

 Structured applications are the result, improving both the software quality and project duration. The predictability of application engineering improves.

In this section, you’ll learn how to setup your application in a structured way. Especially a

calculation worksheet

will be introduced, and its conventions and usage.

This reference manual however is not a learning book on structured programming. If you feel uncomfortable with structured programming, please check your bookstore for one of the many titles available on this area.

If your application doesn’t require any user-defined calculations, you might want to continue to a next chapter, although it would be interesting to take a look at how to setup a structured application.

2.1.2 Worksheet organization

There seem to be a lot of worksheets in the ‘MyTemplate’ sample project at first sight. There are many display and report sheets and a number of additional configuration worksheets containing various tables. In eXLerate, the following naming convention is used for worksheets:

 Display sheets are worksheets, which are used as operator displays. These worksheets may have any sheet name; internally these sheets have an object name starting with

dsp

’.

 Report sheets are worksheets, which are used as internal report pages. The names of these worksheets start with a lowercase ‘r’; internally report sheets have an object name starting with ‘rep’.

 Configuration sheets are all other worksheets used by eXLerate for its real-time HMI functionality. The name of such a worksheet starts with a lowercase ‘x’; internally a configuration sheet has an object name starting with ‘wks’.

This is a convention used by eXLerate, and users are expected to comply with this convention.

Fig. 2.1 Worksheet naming convention eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 11

2.2 Calculation sheets

2.2.1 Introduction

A calculation sheet is a worksheet containing logically grouped worksheet calculations, which are internally used by the application. The name of a calculation worksheet starts with a lowercase ‘x’, because it is neither a display nor report sheet.

In the ‘MyProject’ sample, worksheet ‘xCalc_1’ is such a calculation sheet.

In a calculation worksheet, calculation results are orderly grouped. In addition, special support from eXLerate is available.

2.2.2 Calculation sheet layout

Many HMI software packages are built using predefined objects, where a user is able to create one or more instances of an object. For example, a motor operated valve can be implemented using a generic ‘valve’ object. When the user needs six valves in an application, the valve object is copied six times, and the object properties are defined per valve instance.

In Excel/eXLerate, such complete objects do not literally exist as such, although practical implementation is almost identical to the valve example above.

In a spreadsheet, a calculation result can be obtained using various rows for the calculation. For example, a motor operated valve is controlled via nine parameters, which are grouped together on nine consecutive rows in our spreadsheet.

Such a calculation result over multiple rows may be functionally thought of as an ‘object’. Rather actually than creating multiple objects, the calculations are copied over multiple columns to create multiple instances of the ‘object’.

Calculations for multiple valves may be defined in multiple columns, where each column represents a single valve ‘object’ instance.

The calculation worksheet is set up to support such multiple sections.

The ‘xCalc_1’ calculation sheet looks as follows:

The worksheet contains a

title line

, a

header line

with various

columns

, and vertically grouped

sections

. A group may be optionally divided in

subgroups

.

The

Title line

is used to identify the calculation worksheet in the application for the application developer. In the ‘MyProject’ sample project, it contains a major, and a minor version number.

In Fig. 2.2, all groups are at outer group-

level ‘1’, except group ‘Valves’, which is opened. ‘Valves’ contains a sub-group:

‘Run valves’, and various calculations. The worksheet functions/constants/values under the ‘_1A’ column are colored blue and green.

The following columns are defined in the header line at row #3:

 Group

This column contains the logical group name, under which the calculations are identified, such as ‘Global settings’,

‘Valves’, and ‘Transmitters’. The group names are used to row-wise group the items using the ‘Data’, ‘Group’ command from the Excel menu bar. When rows are grouped together, small ‘+’, ‘-’, ‘1’ and ‘2’ buttons appear in Excel, with which groups may be opened and closed. To close all groups, click on the ‘1’ button to activate the 1st group level. To open all groups to the 2nd level, click on the

‘2’ button.

 CalcTag

The name of the ‘calculation tag’ is defined at this column. A calculation tag is a tag that may be referred to in the application, including reports. eXLerate creates various name objects for this calculation tag.

For example, when the name: ‘Calc.MyName’ is entered, eXLerate generates a name: ‘Calc.MyName’ at the ‘_Value’ column*. More names may be created, depending on more columns starting with an underscore character** (‘_’).

In the example above, because the section ‘_1A’ is defined at calculation tag ’Calc.ValveIndex1’, the name:

Title line

Header line

Grouped sections

Opened subgroup

Fig. 2.2 Calculation worksheet layout

*

A field should be non-empty to create a name in a calculation sheet

**

Such additional fields may be used for additional sections, such as a machine number or metering line

12 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

‘Calc.ValveIndex1_1A’ is created. Using this method, consistent object names are created for multiple sections, where each additional section has an associated additional column, such as ‘_2’, ‘_3’etc.

A calculation tag name should always start with ‘Calc.’ as a convention. If this field is left empty, no name is created.

 Description

This optional field contains the user-defined description of the calculation at the ‘_Value’ or ‘_{number}’ tag.

 Type

This optional field contains the user-defined type of the calculation tag, for example: CONST, SET, CALC, or TAG, for respectively a constant number, a value set by a VBAprocedure, a calculation, or a value from the tag database.

 _Value

At this column, the Calculation wizard creates the calculation name as defined under CalcTag, for calculation tags without additional sections.

 Store

At this column, the storage worksheet function exStorageID

(…) for the ‘_Value’ column may be entered. Storage worksheet functions may be used to create retentive constants in a calculation worksheet. Retentive constants are automatically stored on disk, and loaded back from disk at system startup.

 _{number}

Additional columns containing a section identification, for example ‘_1’, or ‘_1A’ may be added to the row. An additional section should start with an underscore (‘_’).

Color-coding

It is strongly recommended to use distinct colors for various items, in order to be able to distinguish the source of an item on a calculation sheet.

In the ‘MyTemplate’ project, the following color-coding is used:

Description Shortcut Type Color

Constants CONST Constants Black

VBA/Edit Orange Value set in Program code or worksheet

Value calculated in sheet formula

Input from tag database

To be implemented, not completed yet

SET

CALC

TAG

???

Table 2.1 Color-coding in a calculation sheet

Formulae

Tag base

Error/To Do

Blue

Green

Red

Using color-coding, best results are obtained to obtain a quick insight in the application.

The color-coding table above is available in the sample project as the first group: ‘Colors and naming conventions’. It may be opened/closed at any time during application development using the ‘ ’ and ‘ ‘ group-buttons at the left hand side of the page.

Using sub-groups

A sub-group is a member of a certain group. For example, in the group: ‘Global Settings’, a sub-group is defined: ‘Version

Control’, as in the figure below:

Fig. 2.3 Sub-groups in a calculation sheet

The sub-group has a title under the

Description

field of a group, and a grey bar across all columns which are included in the calculations for that sub-group. In the example above, the revision of the application is maintained with two constants.

The sub-group has two CalcTags defined: ‘Calc.Revision.Hi’, and ‘Calc.Revision.Lo’, which are two constants stored in the cell. Since these two constants are not required to be actually retentive, but are changing only when an application engineer modifies the application itself, it are two constants rather than two retentive values, hence the

Store

columns of the two calculation tags are left empty.

In another worksheet, or in VBA, these constants may be referred to with their logical ‘object’ names ‘Calc.Revision.Hi’, and ‘Calc.Revision.Lo’ rather than the direct cell-references, as in the title bar of this calculation worksheet:

Fig. 2.4 Using calculation tags in a worksheet

Although looking somewhat complex for a simple item like a version number, its value is better to understand when the application contains hundreds or maybe even thousands of calculations and constants.

Example calculation

In the example calculation below, there will be an index calculated from three digital inputs from two identical motoroperated valves, each on a different production line. The three digital inputs for each valve are obtained from the tag database.

In the group: ‘Valves’, a sub-group is defined: ‘Run-valves’; in the sample application it is the only sub-group. For each valve, there are three inputs from the tag database: a digital input which becomes ’1’ when the valve is closed, a digital input which becomes ‘1’ when the valve is opened, and a digital input which becomes ‘1’ when an error occurred at the valve’s remote control unit.

A calculation should be done to convert valve positions to an index. The index is used for animation of a valve symbol in the application: when the valve is open, it should be colored green etc., according to the table on the next page: eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 13

Description

Valve is opened

Valve is closed

Value is traveling

Status

OPEN

CLOSE

TRAVELLING

Valve has an illegal status ILLEGAL

The example calculation is shown below:

Value Color

1 Green

2

3

4

Red

Yellow

Violet

2.2.3 Calculation wizard

Calculation names in a calculation worksheet are created using the appropriate wizard from the eXLerate ribbon:

The calculation wizard reports the progress and found errors into the output window:

Fig. 2.5 Example calculation

The three digital inputs from the tag database are colored green, as per color convention.

Fig. 2.6 Output of the calculation wizard

The calculation is done using the VB function

GetValveIndex(…), which is also included in the sample project.

This function converts the three inputs to an index, ranging from 1..4 for CLOSE, OPEN, TRAVEL or ERROR status of the valve.

Note the ‘+0’ addition to the function arguments. All

VB functions should be called from a worksheet using the ‘+0’ convention for each argument. The reason why is

explained in Chapter 13.3, ‘

Worksheet functions are excessively called

’on page 83, and has to do with internal

recalculation issues of Excel.

There is only one name created for this section: ‘_1A’, which is

‘Calc.ValveIndex1_1A’. Multiple valves for other sections are simply created by copying this column to another column

‘_2A’. There are no names created for the individual valve bits, because no name appears for these tags in the

CalcTag

column.

It may be clear that searching for valve status values in the application is easily found: in the calculation sheet, at section

‘Valves’. The values may be checked and tested right here in the worksheet, and avoids unexpected application behavior.

By default, the calculation wizard updates the current calculation sheet. It is possible to update all calculation sheets via the drop-down action button.

2.2.4 Other tips for structured applications

Introduction

Although calculation worksheets alone are not the only ingredient in creating structured applications, many real-world, professional, high-demanding applications have shown that setting up all your calculations in a project using some sort of calculation worksheet is a good approach for project development.

Color-coding

Color-coding of the calculation worksheets is another great idea to keep track of the origin of the data, so you are able to understand more quickly how an application is structured.

Transparency

A well-designed application should be both transparent to an application

engineer

, who is responsible of creating a technical correct application, as well as to an application

tester

who is responsible of verifying that an application indeed behaves as defined in the project specification or functional design specification.

Project transparency can be full explored by using the strength of a spreadsheet for calculation purposes.

Most ingredients, such as the configuration tables of eXLerate, are designed for transparency and efficient programming: each configuration table can be configured, verified, and carefully tested, both in ‘real-world’ Runtime mode, or in Verify mode, where expressions and calculations can still be monitored, verified and even modified with data-communications actually running.

14 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

Simulation & testing

Data communications can be simulated to verify all calculations in an application. Step by step, all of the entries in all tables can be verified. When all configuration tables have been thoroughly tested, the application is well tested; it’s as simple as that.

For data-communications, a data-scope/debugger is available to check all incoming and outgoing messages.

The configuration of an application can be easily documented as well, simply by printing most or all of the worksheets.

Application development

Functionality still missing in an application, or even in eXLerate may be added by a user or application developer. For example, you are able to create your own tools and wizards using VB(A).

All of these ingredients should be more than adequate to create correct, powerful and yet simple applications that are easily tested and maintained afterwards.

And best of all, you are using your most popular spreadsheet program to achieve all this!

In the following chapter, you will be introduced to how Visual

Basic for Application is integrated in eXLerate, and how to use

VBA in your real-time HMI application. eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 15

3 Summer/winter-time

3.1 Introduction eXLerate is able to automatically detect a summer- and winter- changeover.

More than that, eXLerate is able to automatically update externally connected devices, and change these devices from summertime to wintertime or vice versa.

3.2 Adjusting time

To avoid fiscal integrity problems for many devices with respect to these changeovers, eXLerate adjusts the time in two half hour steps, avoiding full hour changes, and thus invalidating hourly based counters.

This segmented changeover method is a generally accepted method for systems requiring summer- and wintertime changeovers, including fiscal metering applications for custody transfer purposes.

Changes to summertime and wintertime are automatically catered for by the internal ‘Latch(…)’ worksheet functions, as follows:

Summer- to Wintertime changeover

When the time changes from summer- to wintertime, officially, the clock is set backwards for one hour, e.g. at 03:00 at night, the time is adjusted to 02:00. In eXLerate, summertime to wintertime changeovers take place in two steps:

 At 02:45, the time is adjusted to 02:15, causing a half hour correction

 Again, at 02:45 the time is adjusted to 02:15, causing the second half hour correction.

 After this sequence, latches of 02:00 – 03:00 contain

‘double’ hours, since the corresponding hourly interval event took two hours. This is a de-facto standard behavior in timeswitching industrial systems, including custody transfer metering systems.

Winter- to summertime changeover

When the time officially changes from wintertime to summertime, the clock is advanced for one hour, e.g. at 02:00 at night at the designated date, the time is advanced for an hour to 03:00. In eXLerate, this changeover takes place in the following steps:

 At 02:15, the clock is advanced to 02:45, causing a correction of half an hour. At 03:00, a normal hourly transition takes place. The latched data of 02:00- 03:00 contain only for a half hour of data.

 At 03:15, the clock is advanced again, to 03:45, causing the second correction to take place. At 04:00, a normal hourly transition takes place, again with a half hour of latched data.

 The net result of advancing the clock a full hour is that the fiscal reports contain two reporting hours each containing a half hour of data. Also this behavior is generally accepted by the industry.

The dates for summer- and winter time changeovers may be defined in the application, in the Time Table, and has a layout as follows:

Fig. 3.1 Time Table

The layout is a typical configuration table containing the table name (‘rTimeTable’), and columns headers containing the month, day and hour of the moment at which summertime becomes active (the switch-over point), and the month, day, and hour at which the wintertime becomes active.

When changeovers are enabled, the built-in Windows changeovers must be disabled, as follows:

Fig. 3.2 Disabled adjustment for daylight saving in Windows

To fully implement date/time synchronization with external devices, the following aspects would be needed to cater for as well:

To effectively enable summer- and winter changeovers, you must call the ‘exEnableSummerWinter()’ method of the

‘Comms’ object in VBA once. These settings are stored in the registry and are permanent hereafter.

16 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

To enable time updates to external devices, use must implement an update to the device using the tag database, in which the current time and date should be sent to the device.

Sometimes, this is done via regular write registers; in other cases a dedicated number must be written to the device. You could utilize the calculation worksheet for this purpose if a dedicated format is required.

You could consider implementing a dedicated write-query for this purpose, so the time/date update is sent to the device independently from other write commands to the device.

You could create a separate routine in VBA, which updates all connected devices simultaneously by triggering the appropriate time registers of these devices, for example using the ‘exUpdateForce(…)’ method of the ‘Comms’ object.

When summer- and winter changeovers are effectively enabled, a message is sent to the event logger:

‘SummerTime is set for dd/mm/yyyy hh:15:00; WinterTime is set for dd/mm/yyyy hh:45:00. Currently in xxxxxTime’. eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 17

4 Wizards and tools

In the previous chapters, you have already been introduced to most of the available wizards and tools of eXLerate.

A wizard in this context is a development assistant that generates parts of an application for you, while a tool is a smaller utility to help you with certain aspects of an application.

For example, the Color wizard is called a wizard, because it is able to create/generate a complete color palette table for you, while the Color palette tool simply shows to you the relation between an index number and its actual color.

Both utilities have in common that both types help you with application development.

Under the tools menu in eXLerate finally, a number of additional miscellaneous functions have been placed that help you in application development.

In this chapter, all available wizards, tools and additional miscellaneous functions are discussed. It may therefore be viewed as the reference chapter for development utilities.

4.1 Introduction

Because of the fact that eXLerate is worksheet oriented – most of its configuration tables is laid down in tables – an application can be constructed from these tables, where the user has the convenience to be able to use Excel as a powerful engineering environment.

The open architecture of Excel allows you to use the powerful environment of Excel, as well as additionally developed tools and wizards. You may use VBA and/or VB for development of your own assistants, tools and wizards. What other

SCADA/HMI software development tool allows you to do just that?

In the menu of eXLerate you will be able to locate all wizards and tools.

The following wizards are currently defined:

Fig. 4.1 Available wizards in eXLerate

 Tag & Object wizard

This is a development aid that creates functionality on basis of tag database definitions, such as worksheet functions, and alarm functionality.

 Calculation wizard

This is a wizard that creates calculation object names for you in a special background worksheet, called a calculation sheet.

 Color wizard

The color wizard is a wizard that is able to efficiently work with color palette tables in eXLerate.

 Button wizard

The Button Wizard creates menu navigation functionality in your application, based on the Button Table.

 Language wizard

The Language Wizard creates a translation table in which applications can define system texts in multiple languages.

The following options are available under the tools section in eXLerate:

Fig. 4.2 Available tools in eXLerate

Tools

 Shape property tool

This tool helps you in finding shapes over various worksheets, and their properties as required for animations.

 Name definition tool (Ctrl+E)

The standard Excel dialog for names lacks functionality that you rather would like to include during application engineering. This tool offers an alternative for the built-in names dialog of Excel.

 Color palette tool

This is a tool showing you the relation between a color palette index number, and the actual color for shape animations.

 Alarm tree tool

This tools visually shows the hierarchial alarm tree structure.

Generate

 Generate report

This option allows you to quickly generate a report for engineering purposes.

 Generate HTML

This option generates the HTML pages.

18 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

Communications

 Browse OPC servers

This tool allows you to browse OPC servers and paste Item-

ID’s into the application.

 Communications options

Displays the communication options.

Protected Cells

 Mark unprotected cells (Ctrl + U)

Marks all unprotected cells in a worksheet.

 Unmark unprotected cells (Ctrl + Shift + U)

Un-marks all unprotected cells in a worksheet.

Miscellaneous

 Remove external links

Removes all external links in an application workbook.

 Reset historical values

Reset the historical values of the current application. All retentive intermediate results as maintained in the registry are reset.

 Recalculate application (Ctrl + R)

Re-calculates the whole application.

To the right of the ‘tools’ button, two more tools are visible:

 Import sheets

Imports sheet into the application.

 Advanced replace

Finds & replaces cells, names, objects, etc...

In the following sections, all wizards and tools will be discussed.

4.2 Wizards

A wizard in eXLerate is a development assistant that generates parts of an application for you. For each wizard, certain options can be defined prior to actually running the wizard.

Each option is presented to you in an

option step

. You may use the <Ctrl-TAB> key, or the ‘<Back’ and ‘Next>’ buttons to browse through the steps.

When all option steps have been defined, you may actually run the wizard in the final step. In this last step, a list-box is presented in which the progress of the wizard is displayed, and other messages are reported. Errors during this process are also reported to eXLerate’s event logger.

The option buttons in each step will be remembered the next time that you run the wizard, so simply by pressing <Enter> the wizard may be re-run using the same options as the last time the wizard was invoked.

4.2.1 Tag & Object wizard (Ctrl + W)

The Tag & Object wizard is an important assistant in the automation of application engineering. Various entities in an application can be created using the Tag & Object wizard:

 Object names / calculations

The tag database contains tag definitions. Although cells in the tag database may be directly referred to, it is much better to use logical object names. These names, and the required subsequent calculations may be created manually, or the tag and object wizard is able to generate such names and calculations for you – automatically.

 Alarms

The alarm are automatically created for you when running this wizard, based on alarm properties of a tag at the tag database.

 Cell error checks

Rather than checking worksheet cells for errors manually, the Tag & Object wizard scans through all worksheets and reports errors for you.

The Tag & Object wizard is started from the eXLerate ribbon or using Ctrl + W, as follows:

Fig. 4.3 Invocation of the Tag & Object wizard eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 19

The Tag & Object wizard reports the progress and found errors into the output window:

The calculation wizard reports the progress and found errors into the output window:

Fig. 4.7 Output of the calculation wizard

Fig. 4.4 Output of the Tag & Object wizard

The output window presents the overview of all errors found by the Tag & Object wizard:

4.2.3 Color wizard

The color wizard in eXLerate is used to update the color palette in Excel with the colors defined in eXLerate.

The current color settings in Excel may be created from a special worksheet table, which is called the

Color Table

. On the other hand, the Color Table may be created from the current color settings in Excel.

The Color Table

The

Color Table

in eXLerate is located in the ‘xTables’ worksheet, and has the following layout:

Fig. 4.8 Color Table layout

Fig. 4.5 Step 2/4 of the Tag & Object wizard

These errors are clickable. Double-click on the error will select its location.

4.2.2 Calculation wizard

The calculation wizard in eXLerate is used to create object names on a calculation worksheet. To learn more about using calculation sheets in an eXLerate application, refer to section ‘

Calculation sheets’

on page 11.

The calculation wizard expects the worksheet layout as described in this section.

The calculation wizard can only be invoked when the currently selected worksheet is a calculation worksheet. If this is not the case, an error message is displayed. A worksheet is a calculation sheet when the name starts with ‘xCalc’, and where on the third row a header line is defined containing fields: ‘Group’, ‘CalcTag’, ‘Description’ etc.

Fig. 4.6. Invocation of the Calculation wizard

As with most configuration tables in eXLerate, the table starts with a table identifier (‘rColorTable’) which defines which Excel range is associated with the table, a number of field headings

(dark red row in the example above), and the data in the table itself below the header line.

The color table has 64 rows, and 6 columns, each with a specific function.

The following columns are defined:

 ID

This column contains the ID of the color entry, from 0 thru

63. This value is the color palette index number to be used for shape animations.

 C

This column contains a color-formatted cell containing the actual color as defined by the R, G, and B columns.

 R, G, and B

These columns contain the numerical value of the RGBcolor of the entry. In Windows, colors may be expressed in an RGB value, where each component red, green, and blue are represented with a numerical value of 0…255. Pure black is represented as {0,0,0}, while pure white is represented as {255,255,255}.

20 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

 Comment

Each color in the color table in eXLerate is used for a distinct property in the application. For example, pipe symbols with flowing fluids have a color index of 12, and pipe symbols without flowing fluids have a color index of 11.

When in an application all pipe colors need to be modified, only one single entry is to be updated, and not the pipe shape objects itself. In this column, the usage of the colors is defined.

The color wizard may be started as follows in eXLerate:

4.2.4 Button wizard

The Button wizard in eXLerate generates the required functionality for the menu-navigation buttons at the bottom of each display page, as per

Button Table

. The Button Table is located in worksheet ‘xTables’, and is described in Volume I,

Menu Navigation

’, ‘

The Button Table

’.

The Button Wizard should be invoked when the Button Table has been modified, for example when a new display page has been added, or when the menu navigation keys for a display page have been modi fied. The Button Wizard is started from the eXLerate menu as follows:

Color wizard

Fig. 4.9 Invocation of the Color wizard

When this menu option is selected, the following dialog appears:

Fig. 4.11 Invocation of the Button wizard

Button wizard

When started, the Button wizard looks as follows:

Fig. 4.12 Step 1/1 of the Button wizard

Fig. 4.10 Step 1/1 of the Color wizard

There are two options available:

 Generate a new color palette table, and update system colors

This option is able to generate a complete new color palette table, in case your application did not contain a color palette table.

 Update the system colors only

System colors may be updated as well. When the RGBsettings of an entry in the color palette table are empty, the wizard pastes the currently defined color in the table at that entry (which may be thought of as

reading

colors). When the color is defined, and the RGB-settings contain valid numerical values, the currently defined colors are updated from the table (which may be considered as

writing

colors).

The color wizard may be started using the ‘Run’-button:

When the Button wizard is run with ‘Run’, the following dialog appears:

Fig. 4.13 Button wizard completed

The following actions take place:

 When at the referred display page as per Button Table, the button objects are defined, its contents are updated according to the Button Table. eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 21

 When in the referred display page, no button bar is present

(yet), the button bar and corresponding frame are copied from the ‘Template’ worksheet, after which its contents is updated according to the Button Table.

 All required VBA subroutines for the menu navigation is generated as well, in module ‘

modButtons

’. Since this module is erased each time the Button Wizard is invoked, it should not be modified manually. If a user wants to manually modify certain subroutines, these should be moved to

‘ another VBA module. In the ‘MyProject’ project template,

modAlarms

’ is used for this purpose.

4.2.5 Language wizard

The Language wizard in eXLerate generates the required functionality for the translation of product related texts.

The Language wizard should be invoked when initially implementing multi-lingual texts or after an upgrade of the product software. When initially running the Language Wizard it will generate a new ‘xLanguage’ worksheet. Since the product is always being improved, it is possible that new texts become available for translation in later revisions. In that case the

Language wizard should be invoked in order to add the new translatable texts to the ‘xLanguage’ worksheet. Existing translated texts will always remain unaffected by the Language wizard.

The Language wizard is started from the eXLerate menu as follows:

When the Language wizard is run with ‘Run’, the following dialog appears:

Fig. 4.16 Language wizard completed

The following actions take place:

 Create new ‘xLanguage’ worksheet when it doesn’t already exist.

 Update ‘xLanguage’ worksheet when it already exists. Any new translatable texts that have been added to the new revision will also be added to the ‘xLanguage’ worksheet.

Existing texts will always remain unaffected.

Language

Wizard

Fig. 4.14: Invokation of the Language wizard

When started, the Language wizard looks as follows:

Fig. 4.15 Step 1/1 of the Language wizard

22 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

4.3 Tools

In an application, there are many tasks with which eXLerate assists you. Most tools have an associated pop-up dialog, while other tasks are directly used from the Tool menu in eXLerate.

4.3.1 Shape property tool

This tool helps you in finding shapes over various worksheets, and their properties as required for animations. The shape property tool is created to help you in determining the current properties of a shape for animation purposes.

For example, if you want to animate a bar graph, you will need to determine its current size and location on a display page to add animated data to the shape at the Animation Table.

Using the shape property tool, you are able to copy all parameters required for animation from the shape to the table.

The shape tool is selected from the Tools option in the eXLerate ribbon:

Fig. 4.17 Selection of the Shape tool

The Shape tool looks as follows:

When the user clicks the appropriate button, the associated property may be copied to the animation table, at the corresponding column. All properties may be chosen to copy to the table when the ‘All’-button is clicked.

The Shape tool searches for the appropriate location of the shape in the Animation Table. At the right list-box, a cross-reference shows what other display pages contain the selected shape. At the top, the sheet selection list-box presents all worksheet containing shape properties.

With the ‘Delete’-button, the selected shape may be removed from the selected worksheet.

The ‘Show All Shapes’ check box is used to show only shapes containing non-space names. A shape with one or more spaces in the name is considered as a supporting shape, for example a line (e.g. ‘AutoShape 45’, or ‘Line 67’), whereas shapes for animation purposes are assumed to have a name without space characters (e.g. ‘MOV_123’ etc.).

The ‘Copy to Animation Table’ checkbox is used to either copy the selected (clicked) property directly in the Animation Table, or to copy the value to the clipboard only, where a user may use <Ctrl-V> to retrieve the value from the clipboard. This may be used for indirect usage of the parameter, for example in a formula.

4.3.2 Name definition tool

Prior to Excel 2007, the dialog for managing names in Excel was not so user friendly. Because of this, eXLerate supports its own Name definition tool. In eXLerate you can choose whether to use the standard Excel Names Manager, or the eXLerate

Name definition tool.

The Name Definition tool can be selected from the “Tools” option.

When selected, the following dialog appears:

Fig. 4.19 Names tool

The names list-box may be opened, which looks as follows:

Figure 4-18: Shape properties tool

On the dialog, a list-box is available with which the animation properties of some or all of the present shapes can be viewed.

Each of these properties is presented on a button. The leftposition, top-position, shape width, shape height, rotation angle, and the current shape colors are available for copying.

Using the ‘Hide’-button, visible shapes can be made invisible, and hidden shapes can be made visible.

Fig. 4.20 Names tool with opened name list-box

Using the ‘Go To’- and ‘Go Back’-buttons of this Names tool you are able to jump to the location of the reference, and to eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 23

return to the last position. If you still prefer the Excel names dialog, please feel free to do so. This tool is only optional!

4.3.3 Color palette tool (Ctrl + L)

The Color palette tool is a tool showing you the relation between a color palette index number, and the actual color for shape animations. It is selected using the <Ctrl-L> shortcut key directly, or selected from the eXLerate tools menu, as follows:

4.3.4 Alarm tree tool (Ctrl + M)

This tool allows the user to browse through the alarm directory tree in the application. The alarm directory tree is defined in the tag database, where a tag is associated with an alarm group, and the alarm parent-child definition table, as defined in range

rAlarmGroupsTable

’ on the ‘

xTables

’ worksheet.

To start the tool, press <Ctrl-M>, or use the eXLerate Tools sub-menu:

Fig. 4.21 Selection of the Color palette tool

The following dialog appears:

Fig. 4..23 Starting the Alarm directory tree tool

When selected, a dialog as below appears, with which the user can browse, and verify that the currently defined alarm directory tree has the required parent-/child relation as set up in the Alarm group table.

Fig. 4.24 Alarm directory tool

4.3.5 Generate report

The “Generate report” option displays the list of configured reports which may then be printed or previewed.

Fig. 4.22 Color palette tool

When a color button is clicked, its number is either copied to the clipboard, or copied to the active worksheet cell. The actual action depends on the value of the checkbox on the dialog.

From this dialog, the Color wizard may be also started.

Fig. 4.25 Generate report

Reporting is discussed in detail in the eXLerate

Reference manual volume 1

.

24 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

4.3.6 Generate HTML

The “Generate HTML” option generates the HTML pages for web-server support. You can find the output files in

“C:\XLRX\HTML”.

HTML Generation is discussed in detail in the eXLerate

Reference Manual Volume 1

.

4.3.7 Browse OPC servers

The “Browse OPC servers” option allows you to browse OPC

Servers. This dialog allows you to select OPC Item ID’s and paste them into the application.

OPC and communications are discussed in greater detail in the eXLerate

Reference manual volume 1

.

4.3.8 Communications options

This option opens up the Communications Options dialog. You can use this dialog to enable/disable diagnostic logging of the communication drivers.

The communications options are discussed in greater detail in the eXLerate

Reference manual volume 1

.

4.3.9 Show Control Center

This option Shows the Control Center. The shortcuts, users and global settings may be edited from within the Control

Center which is discussed in eXLerate

Reference Manual

Volume 1

.

4.3.10 Unprotected cells marker (Ctrl + U)

Worksheet cells play a vital role in an application. A user may be enabled to edit the value of a worksheet cell, depending on the settings of the

Worksheet Table

.

Unfortunately it is not very straightforward to see which cells are protected in Excel, and which cells are unprotected. You may select a single cell, and with the tool as displayed at the left, from the eXLerate ribbon you can view the protection status of this cell.

Alternatively, the cell-formatting dialog in Excel displays this status as well:

Fig. 4.26 Cell formatting dialog showing the protection status

Using the ‘Mark Unprotected cells’ (Ctrl + U) option from the eXLerate Tools sub-menu, the protection status of

all

worksheet cells is visualized rather than the individual status.

When activated, each unprotected cell is marked as follows:

Figure 4-27: Marked unprotected cells

Unprotected cells

The marking can be un-done using the ‘Unmark Unprotected cells’ option from the eXLerate tools sub-menu, or using the

<Shift-Ctrl-U> shortcut key.

4.3.11 Remove external links

When cells or entire worksheets are copied between workbooks, Excel might link the copied cells or worksheets to the original workbook. These links can be removed using this option:

Fig. 4.28 Removing external links

Linked applications should be avoided when possible. External links may be also inspected or manually removed using the

Excel ‘Edit Links’ option from the ‘Data’ ribbon.

4.3.12 Reset historical values

This option from the eXLerate Tools sub-menu resets the historical values of the current application. All retentive intermediate results that are maintained and updated in the registry are reset.

Remember, these intermediate values relate to period dependent weighted averages, and latch registers.

This tool does not affect trending and log files, since these files exist on disk, and have another mechanism of monitoring their size. eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 25

4.3.13 Recalculate application (Ctrl + R)

When you modify formulas you may want to re-calculate the application to apply the changes. Many worksheet functions in eXLerate take a trigger-argument of some kind. This trigger argument ensures that a function is called periodically, but not constantly. Some triggers such as ‘xNow.Time’ are executed every second, while others like ‘xAutoRecalc’ are updated only at startup or when starting/stopping communications.

Recalculate Application ensures that all functions which are using the ‘xAutoRecalc’ trigger are re-calculated.

4.3.14 Import sheets

This option display the ‘Import sheets’ dialog which allows you to import sheets into your application.

Fig. 4.29 Import sheets

At the ‘From workbook’ option, select the workbook from which you wish to import the sheets. Use the ‘…’ button to load a workbook if it isn’t already loaded. Select the sheet you wish to import. Hold the ‘Ctrl’ or ‘Shift’ key if you want to select multiple sheets.

4.3.15 Advanced replace

Advanced replace offers the ability to not only find & replace cell values & formulas, but also names, styles, objects (e.g. shapes) and macro names:

Fig. 4.30 Advanced replace

26 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

5 Controls

5.1 Introduction eXLerate supports a set of controls for alarm management and trending purposes. These controls share a lot of functionality, which is described in this chapter.

5.2 Control overview

Viewing trend-data in eXLerate can be done by inserting

Controls on worksheets or VBA forms. These controls can then be linked to each other in a modular fashion. Four types of controls are available which are described in more detail in the following chapters:

Control Description exAlarmSummary exTrendChart

Control which displays the alarm summary.

Chart control which shows the trend-data and allows users to navigate in time. Supports a data cursor for accurately viewing the trend value. exTrendPenSelector Control for viewing and modifying the visible pens of a trend chart control. exTrendNavigator Optional control which can be used to quickly navigate through large amounts of trend data. exListView Generic list-view control.

Table 5.1 Control overview

To insert a trend control on a VBA form, enable the Toolbox and select one of the controls:

Fig. 5.3 Inserting on VBA forms

5.4 Modifying controls

Controls can be customized to a very high extend. The properties of a control can be changed from the Properties

Dialog. This dialog is accessible by clicking the icon in the right-top of the control. The properties button is only accessible when the design-mode is turned off.

Figure 5-4: Properties button

5.3 Inserting controls

To insert a control on a sheet, click one the following buttons on the left toolbar:

In most Controls it is also possible to double-click the control itself to open the Properties Dialog. For instance, doubleclicking the left-axis on an exTrendChart control will open the

Properties Dialog and select the “Left axis” tab.

Fig. 5.1 Inserting Controls on Worksheets

To move or resize a Control, click the design-mode icon at the top of “Insert” section. When finished click the button again to exit design-mode.

Fig. 5.2 Design mode eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 27

5.5 Control Properties

5.5.1 Backgrounds

Backgrounds are used when filling a region with a certain background. A background can consist of a single color, gradient colors, a pattern or a picture. The type can be changed by selecting one of the Type options:

Gradient colors

Gradient colors may be used to create advanced graphical effects. A gradient always consists of 2 or more colors. Each of these colors can be selected in the “Elements” list:

Click to select other gradient color element

Click arrow to rotate gradient 90 degrees

Fig. 5.5 Background types

Solid color

When “Solid color” is selected the following options become available:

Fig. 5.7 Gradient background colors

The “Gradient angle” may be used to change the direction of the color flow. By default the angle is 0 which causes a color to flow from left to right. To change the color flow from top to bottom, change the angle to 90.

Pattern

Patterns consist of both a foreground and background color.

The pattern appearance may be changed by selecting the

“Pattern style” option.

Click to select custom colors

Fig. 5.6 Solid background color

The standard color table can be used to quickly select a color.

The “Red”, “Green” and “Blue” options can be used to change the individual RGB values of the color. Click on the color-bar to open the default Windows Color Picker. When the transparency is changed, the sample shows the results on a white background.

Fig. 5.8 Background pattern

28 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

Picture

When “Picture” is selected the following options become accessible:

Fig. 5.10 Borders & Lines

Fig. 5.9 Background picture

5.5.3 Margins

Margins are used for both the Trend Chart Plot Area and labels:

Click the ‘Browse…’ button to select a picture from disk. The following picture formats are supported: BMP/GIF/JPG and

ICO. Pictures are internally always stored as JPG which reduces the file-size dramatically.

The “Colors” option may be used to draw the picture in

Grayscale rather than full-color.

The “Brightness” and “Contrast” options may be used to lighten or darken the picture. If for instance a picture is used as the background of the chart- or plot-area the trend-lines may become unreadable. In this case the picture can be made lighter by increasing the brightness and decreasing the contrast. Generally speaking the brightness should be increased the same amount as the contrast is decreased. The example above shows a picture with equally increased/decreased brightness and contrast settings.

5.5.2 Borders & lines

Most properties that support a background also support a border. A border consists of a weight, a style, a color and transparency:

Fig. 5.11 Margins

5.5.4 Fonts

The following font properties are supported:

Fig. 5.12 Fonts

5.5.5 Formats

Formats can be used to format numbers and/or date-time values. The example below shows the supported formats of a eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 29

date-time value. The keyword ‘{CR}’ can be used to create a carriage-return or line-break as shown below:

Select a template from the list and click the “Load” button.

To create a new template, click the

“Save As…” button.

Fig. 5.13 Formats

5.5.6 Themes eXLerate supports several themes as shown below:

Fig. 5.15 Templates

5.5.8 List columns

The list shows all the columns of the list control. The properties are shown as columns of the list. Which columns are visible and the width of the columns can be configured in the properties dialog:

Click the option to show or hide the column.

Up and down buttons can be used to sort the columns.

The width can be changed when a column is selected.

Fig. 5.14 Themes

The theme is used for drawing the toolbar and other controls such as list controls. Three font-sizes are supported: Normal (8 pt), Large (10 pt) and Extra Large (12 pt).

5.5.7 Templates

When a control has been configured, its settings may be saved to a template file for re-use purposes.

Fig. 5.16 List columns

30 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

6 Alarm management

Alarm management in eXLerate has already been introduced in the tutorial chapter, in the Application

Reference Manual, and in the description of the tag database, in the section on alarming related fields.

You have perhaps noticed at these introductory pages that alarm functionality may be automatically added to your project when you have alarm fields defined in the tag database.

6.1 Alarm page types

There is a distinct difference between the

Alarm History

, and the

Alarm Summary

, which are the two alarm entities maintained by eXLerate. The alarm history is a log of alarm events that have occurred over a period over time, while the alarm summary contains an actual list of tags with defined alarm properties.

Both types of lists are available in eXLerate as worksheets. In addition, alarm event messages are sent to the system event logger of the eXLerate Control Center where such messages may be printed to the alarm printer, stored on disk, and viewed in the event log.

Alarms may be hierarchically grouped, like a directory structure. There is functionality to acknowledge an alarm or an alarm group, or all alarms.

There may be various alarms simultaneously defined for a single tag. Alarm limits may be entered as constants at the tag database; eXLerate will automatically make these alarms limits retentive.

Best of all is that this alarm functionality is automatically available in your project.

The way the alarm summary and alarm history pages look like may be adapted to your own requirements.

You may add other alarm functionality via the VBA and worksheet interface of Excel, with one of the available procedures and alarming options. For example, during startup you are able to define a delay after which alarming becomes active, or use different alarm settings at startup.

6.2 Alarm components

Alarm management in eXLerate is facilitated by various items:

 The tag database

Since alarm properties of a tag are defined at the tag database, it is the tag database that plays a vital role in alarm configuration. When alarms have been defined at the tag database, the

Tag & Object wizard

should be activated to generate the actual alarm summary list.

 Alarm Group Table

Hierarchical alarm groups are defined in a simple table, the

Alarm Group Table

. This table is located in your project workbook, in worksheet ‘xTables’.

 Alarm Summary Control

This is a control which displays a list of alarms and optionally the alarm tree. Alarms can be acknowledged, suppressed and edited from within the control.

 Worksheet: AlarmHistory

In this worksheet, a history of the latest 40 alarm messages is presented. The alarm history as sent to the system event logger is also available to the user, but this history contains other event messages as well, such as process startup- and shutdown messages.

 VBA and worksheet functions

There are various functions that can be called from VBA, with which alarms can be groups-wise acknowledged. Other functions can be called to define certain alarm options.

 Alarm dead-band

Additional information about the dead-band which can be configured in the tag database.

 Other alarm options

Other options such as auto-acknowledgement and alarm blocking. eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 31

6.3 Tag database

The tag database plays a vital role in alarm definitions for a tag, because an alarm for a tag is configured at the tag database.

The fields at the tag database which are used for alarming are already described in section ‘

Alarming related fields

’ of the Application reference manual.

6.4 Alarm group table

Alarms may be logically grouped together in an

Alarm group

.

User acknowledgement of alarms may be done group-wise.

The internal hierarchy of existing alarm groups is defined in the

Alarm group table

, where a ‘Parent-Child’ relation is defined between alarm groups.

The

Alarm group table

is a standard eXLerate table located in the ‘xTables’ worksheet, and looks as follows:

6.5 Alarm summary control

6.5.1 Introduction

The Alarm summary control can be used to visualize and modify alarms. It consists of three parts, an alarm group tree, a list showing the actual alarms and a toolbar:

Fig. 6.2 Alarm summary control

The control is fully customizable as will be described in the following sections.

The control can be inserted on a worksheet or VBA form by clicking the icon.

6.5.2 Alarm groups

The left part of the control contains all configured alarm groups. The tree can be used for quickly navigating through the alarm groups. Additionally, the icons of the alarm groups indicate whether an alarm is active in the alarm group.

Buttons for expanding or collapsing whole alarm group tree.

Selection indicates which alarms are shown in the alarms list.

Fig. 6.1 Alarm group table

The

Alarm group table

begins with the range name:

‘rAlarmGroups’, followed by a two-column table. At the left hand side of the table, the

Parent

is defined. At the right hand side of the table, the

Child

is defined.

When this table is not present, no hierarchy between alarm groups is defined.

Icons indicate status of all alarms in the group or any sub-groups.

Figure 6-3: Alarm groups tree

When an alarm group is selected, all alarms that are part of that alarm group or any sub-groups are shown in the alarms list.

The following global properties are supported for alarm groups:

32 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

Fig. 6.4 Alarm groups properties

The alarm group indicators can be configured on a per state basis:

6.5.3 Alarm list

The alarm list shows all alarms of the currently selected alarmgroup and filter:

Fig. 6.6 Alarm summary list

Fig. 6.5 Alarm group state properties

When at least one alarm exists in the alarm group, which is in a particular state, the image of that state is used. The priority of the states is shown above. The topmost state (“Active &

Unacked”) has the highest priority.

The columns of the list can be clicked in order to sort the alarm list. When the sort order is set to a specific column, a small arrow appears in that column. When the currently sorted column is clicked, the sort order is reversed.

The following columns are supported by the alarms list:

Column

ID

State

Timestamp

Name

Location

Priority

Type

Description

Limit

Deadband

LastValue

Units

Delay

BlockCount

Format

Description

Unique ID that has been assigned to each alarm.

Set of icons which indicate the status of the alarm:

Alarm is active.

Alarm has been acknowledged.

Alarm is blocked (too many alarm state changes have occurred).

Alarm is being suppressed.

Alarm has been permanently disabled.

Date and time at which the alarm was last changed.

Name of the tag (or alias when specified).

Name of the alarm group

Alarm priority (lower value = higher priority).

One of the following alarm types:

“Status Alarm”

“Low Alarm”

“LoLo Alarm”

“High Alarm”

“HiHi Alarm”

Alarm description when specified, otherwise tag description.

Current limit value (no limit is shown for status alarms).

Deadband value or nothing when no deadband configured in the tag database.

Last value of tag.

Engineering units.

Alarm delay or nothing when no delay configured in the tag database.

Blockcount of the alarm. When max is reached, the alarm is blocked and will stop changing states until acknowledged.

Format of the tag or nothing when no format configured in the tag database.

Table 6-1: Alarm summary columns

The colors used in the alarm list can be configured on a perstate basis:

Fig. 6.7 Alarm list colors eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 33

When alarms are animated, the background and text colors are switched to create a blinking or toggle-effect.

The font used by the alarm list can be changed to any desired font:

6.5.5 Filters

Filters can be used to limit the alarms visible in the alarms list.

The filters can be selected using the pull-down button in the toolbar:

Figure 6-9: Using alarm filters

Fig. 6.8 Alarm list font

6.5.4 Alarm states

Alarm colors and the alarm group indicators can be configured on a per-state basis. A state is a combination of one or more properties (e.g. “In Alarm”, “Acked”, etc..). If an alarm has all the properties which are defined in the state, then that alarm is effectively in that “state”. For instance, if an alarm is in alarm, not acknowledged and not blocked, suppressed or disabled, then it is considered to be “Active & Unacked”. On the other hand, if an alarm is disabled then it is considered to be in the state “Disabled” no matter its other properties.

The order of the states is also used to determine which colors to use when drawing an alarm and also to determine which alarm-group indicator to use.

The following states are supported:

State Rules

Active & Unacked Alarm must be active, not acknowledged, not suppressed, not blocked and not disabled.

Active & Blocked Alarm must be active, blocked, not suppressed and not disabled.

Active & Acked Alarm must be active, acknowledged, not blocked, not suppressed and not disabled.

Inactive &

Blocked

Inactive &

Unacked

Alarm must be inactive, blocked, not suppressed and not disabled.

Alarm must be inactive, not acknowledged, not blocked, not suppressed and not disabled.

Inactive & Acked Alarm must be inactive, acknowledged, not blocked, not suppressed and not disabled.

Active &

Suppressed

Inactive &

Suppressed

Disabled

Alarm must be active, suppressed and not disabled.

Alarm must be inactive, suppressed and not disabled.

Alarm must be disabled.

Table 6.2 Alarm states

Initially 3 filters are available. These filters can be extended and/or modified using the filters property dialog:

Figure 6-10: Configuring alarm filters

To modify an alarm filter, select the filter and click the

“Properties” button. The following dialog shows all the supported properties of a filter:

Figure 6-11: Alarm filter properties

6.5.6 Real-time mode

The alarm summary control can be used in two modes: realtime & diagnostical. The real-time mode can be configured to always show the alarms according to a specific alarm-group, filter and sort-order. When the operator changes one of the previous settings, real-time mode is automatically disabled.

Real-time mode can be configured to automatically activate after x seconds of user-inactivity. This option is useful when making sure that the alarm summary is always showing the

34 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

active alarms even if the operator has selected another alarm group, filter or sort order and left the system like that.

Whether real-time mode is enabled or not can be recognized by state of the button in the toolbar.

The following properties are supported for real-time mode:

When editing one or more alarms, the following dialog is shown:

Fig. 6.12 Real-time mode properties

6.5.7 Acknowledgement

Alarms can be acknowledged using 3 buttons in the toolbar:

Acknowledge selected alarms

Acknowledge all alarms

Acknowledge all alarms of the selected groups

Fig. 6.13 Alarm acknowledgement buttons

The buttons are enabled only when acknowledgement is possible for the alarms. If the buttons are disabled, the alarms have already been acknowledged or no alarms have been selected. When an alarm has been acknowledged, the icon is shown in the state column.

Suppression

Alarms can be suppressed or un-suppressed using the 2 buttons in the toolbar:

Suppresses or unsupresses selected alarms.

Suppresses or un-supresses all alarms of the selected group.

Fig. 6.14 Alarm suppression buttons

Fig. 6.16 Edit alarms dialog

In the top-part of the dialog, the user can enter new limits, a deadband and a delay. Only those features are enabled which have actually been configured in the Tag Database. For instance, if the “Delay” option is disabled it has not been configured in the Tag Database.

The bottom-part of the dialog shows all alarms that have been selected for editing and also shows the current settings of each alarm.

6.5.9 Security

Typically, not all users are allowed to suppress or edit alarms.

The following security settings can be configured:

The buttons are enabled only when suppression/un-supression is possible for the selected alarms. If the buttons are disabled, no alarms have been selected. When the button is enabled and highlighted (see “Unsuppress” button in the picture above), all the selected alarms have already been suppressed. Clicking an already highlighted button, will cause all selected alarms to be un-suppressed.

6.5.8 Editing alarms

Alarms can be edited either by double-clicking them or using the button in the toolbar. Using the button in the toolbar has the advantage that multiple alarms can be selected for editing:

Fig. 6.17 Alarm summary security settings

Fig. 6.15 Editing one or more alarms eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 35

6.6 Worksheet: Alarm History

The alarm history is a worksheet containing an historical list with events related to alarm messages, or alternatively, a list with all events of the system. Both types of event history windows are explained in this section.

A typical alarm history looks as follows:

 Use the <Shift-Down> key to select 10 rows, while on the worksheet function with the cursor

 Press <F2> to edit the formula

Fig. 6.18 Alarm history worksheet

The alarm history in the sample project is a worksheet containing alarm messages in a non-scrollable window. It contains the last 42 messages from the alarm manager. The alarm history may contain any amount of messages, depending on the available window size. Another example is given below:

 Press <Shift-Ctrl-Enter> to enter the array formula

{=

exGetAlarmHistory(10,xAlarm.InternalUp

date)}

,

You now have created an array function containing 10 rows.

Fig. 6.19 An alarm history window with the 4 last alarm messages

A scrollable history window may be created by the application developer, as provided with the Alarm Summary in the

‘MyTemplate’ project.

6.6.1 Alarm History - Theory of operation

The alarm history can be created from the eXLerate worksheet function:

exGetAlarmHistory( n, xAlarm.InternalUpdate )

which returns an array with

n

alarm messages. The second argument to this function ensures updates of the alarm history list. To insert an array formula with 10 rows in a workbook, do the following:

Type the function in a single cell

In this case, type:

=

exGetAlarmHistory(10, xAlarm.InternalUpdate )

, and press <Enter>. The function is available in a single cell only.

36 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

6.7 Worksheet: Event history

An event history is a worksheet containing a historical list with all system events.

A typical event history looks as follows:

Fig. 6.20 Event history worksheet

With the aid of additional buttons, the user can filter the events based on filtered time windows. Additionaly, a report of these

(filtered) events can be generated.

6.7.1 Event history - Theory of operation

All system events are also stored on disk, one file for each day.

Typically, these files are stored in ‘C:\XLRX\Logger’.

The event history can be constructed by extracting information from these files via an eXLerate worksheet function:

exGetEventHistory( n, iStart, strPath, Date, Filter, Retrigger )

, which returns an array with

n

event messages of the specified day.

See the worksheet function reference in the ‘

Advanced Topics

Reference

’ manual for further details on utilizing this worksheet function.

6.7.2 Event history buttons

The special buttons at the bottom of the event history worksheet are defined in the

Button Table

, and contains date browsing functions.

The trending section of the

Button Table

contains the following definitions:

Worksheet Button Button text Key Procedure

AlarmHistory Button3

AlarmHistory Button4

F3~<<

F4~<

AlarmHistory Button5

AlarmHistory Button6

F5~>

F6~>>

{F5} dspAlmHist.Forward

{F6} dspAlmHist.FastForward

AlarmHistory Button7 F7~Select Date {F7} dspAlmHist.PickDate

AlarmHistory Button8 F8~Print Date {F8} dspAlmHist.PrintHistEvent

File

Table 6-3: Event history button definitions

{F3} dspAlmHist.FastBack

{F4} dspAlmHist.Back

Internal VBA code

The procedure definitions from the

Button Ttble

above contain references to the VBA-code at the specific event history worksheet, which is internally called: ‘dspAlmHist’..

The VBA code at this Excel worksheet contains the following

macros/procedures, see Fig. 6.21.

In this code left, which is copied from the ‘MyProject’ sample, various buttons are linked to the above VBA macros.

Sub PickDate()

frmEventDate.Show

End Sub

Sub FastBack()

Range("HistEventDate").Value =

Range("HistEventDate").Value - 7

Range("HistEventCurr").Value = 0

End Sub

Sub Back()

Range("HistEventDate").Value =

Range("HistEventDate").Value - 1

Range("HistEventCurr").Value = 0

End Sub

Sub Forward()

Range("HistEventDate").Value =

Range("HistEventDate").Value + 1

Range("HistEventCurr").Value = 0

End Sub

Sub FastForward()

Range("HistEventDate").Value =

Range("HistEventDate").Value + 7

Range("HistEventCurr").Value = 0

End Sub

Sub Scrollbar_Change()

On Error Resume Next

Shapes("Scrollbar").ControlFormat.Max =

Range("HistEventMax").Value

End Sub

Sub PrintHistEventFile()

Dim sCommand As String

Dim sFileName As String

Dim fs

On Error Resume Next

Set fs =

CreateObject("Scripting.FilesystemObject")

sFileName = Range("HistEventPath").Value &

"\" & _

Format(Year(Range("HistEventDate").Value),

"0000") & _ eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 37

Format(Month(Range("HistEventDate").Value),

"00") & _

Format(Day(Range("HistEventDate").Value),

"00") & ".log"

If fs.FileExists(sFileName) Then

sCommand = "Notepad /p " & sFileName

Call Shell(sCommand, vbHide)

Else

MsgBox "No events available for this

date", vbOKOnly, "Printing Historical

Events"

End If

End Sub

Fig. 6.21 Trending related VBA code

6.8 VBA and worksheet functions

The following functions are available for alarm management.

These functions are described in more detail in the Function

Reference Manual.

exAlarmCount(…)

This is a function returning the number of alarms in a specific mode, such as all active alarms, or all

 unacknowledged alarms, for a specific alarm group.

exSetAlarmDeadband(…)

This is a procedure which allows the user to change an alarm dead-band value. This advanced function is used in cases where alarm dead-band values are set from within

VBA and not directly via the tag database.

exSetAlarmLimit(…) & exSetAlarmLimit2(…)

This is a procedure which allows the user to change an alarm limit without the standard alarm editor. This advanced function is used in cases where alarm limits are set from

 within VBA rather than from the standard alarms worksheet.

exSetAlarmDelay(…)

This is a procedure which allows the user to change the alarm delay without the standard alarm editor. This advanced function is used in cases where alarm delays are set from within VBA rather than from the standard alarms

 worksheet.

exAlarmSetModeByGroup(…)

This procedure which allows a user to programmatically disable or suppress a group of alarms. It may be used for example when a production line is switched off, to disable or

 suppress all related alarms.

exAlarmSetModeByID(…)

This procedure which allows a user to programmatically disable or suppress an specific alarm.

exAlarmShowStatus(…)

This procedure creates a report containing all active alarms, all disabled alarms, or all suppressed alarms, and sends the report to the system event logger (and hence to the printer, if enabled).

38 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

6.9 Alarm dead-band

An alarm dead-band is used to suppress the generation of excessive alarms due to the fact that the process value varies just at the alarm limit value, as in the following example:

Alarm processing

12

10

8

6

The signal drops below the limit value, but not below the dead-band value (yet).

4

2

0

0

A normal alarm state resets, but with a deadband it remains high.

High limit

5

Deadb.Value

10

Alarm State

15

PV Deadband

Fig. 6.22 Alarm dead-band example used for a high limit alarm

20

The process value in the example above is the dark blue dotted line at the top varying between ‘5’ and ‘10’; the alarm limit is the red line set at ‘8’, and a dead-band value, the yellow line, of ‘1.5’ is defined (and hence drawn at 8-1.5, or

6.5).

The thick light blue line above the bottom line represents the alarm state where no dead-band (or a dead-band value of ‘0’) is applicable. As soon as the process value exceeds the alarm limit, then the alarm state is raised, and as soon as the process value drops below the limit value, the alarm state is reset. In the example above, this introduces 10 alarm state changes.

The thick dark blue line at the bottom of the graph represents the alarm state when a dead-band value of ‘1.5’ is applicable.

The smaller changes in the process value are ignored and thus the amount of alarm state changes are only 4.

This is because with a dead-band value, the alarm state is reset when the process value drops below (high limit – deadband).

For a low alarm, or a low-low alarm this process works similarly, but reversed, i.e. the alarm state is reset when the process value exceeds (low limit + dead-band).

A dead-band is entered at the tag database in a column:

“Deadband”, and is entered in engineering units. When the column “Deadband” does not exist, the dead-band mechanism is effectively disabled.

To (re-)enable the dead-band mechanism, insert the column in the tag database, and fill-in a non-zero value at the appropriate tag. The dead-band parameter value entered for a tag is used for all combinations, if any, of a high-high alarm, a high alarm, low alarm, and low-low alarm.

6.10 Other alarm options

There are several additional options that can be configured using the VBA callable procedure

exAlarmSetOptions(…)

. See the function reference manual for details regarding alarm options. Options include:

 AllowBlocking

Alarms may be configured with blocking enabled. When blocking is enabled, no more alarm messages are generated when repeatedly alarms change status from normal to alarm and vice versa without being acknowledged. The amount of times that an alarm changes state before it obtains a

‘blocked’ status is a user-defined parameter.

 AutoAcknowledge

Alarms may be configured for automatic acknowledgement.

This causes an alarm to automatically being acknowledged when occurring, e.g. the user does not need to manually acknowledge an alarm when it occurs.

Note that when

AutoAcknowledge

is enabled, blocking has no effect. eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 39

7 Trending

7.1 Introduction

In eXLerate, the transition between

real-time

trending and

historical

trending is smooth: a real-time trend in eXLerate is a special case of an historical trend: it is simply an historical trend with the current time on the right-hand side of the timeaxis.

Internally in eXLerate, the data recording mechanism is totally separate from the display of trends. Data recording/collection always continues, even when there are no trend displays defined at all in an application. Data recording / collection is defined in the tag database.

7.2 Enabling trending

Trending can be enabled on a per tag basis. This is discussed in

Tag database

of the Application Reference Manual. After the

‘TrendNorm’ property has been specified the Tag & Object wizard should be run to enable trending for the configured tags.

Additionally, for each application shortcut in the Control

Center, the ‘Trending path’ must be specified.

7.3 Trending parameters

There are several parameters for trending, which are maintained at system level at the Control Center:

7.4 Visualizing trend data

Trend-data can be visualized using a set of 3 trend-controls.

These controls may be inserted into your application using the

‘Controls’ option in the ‘Insert’ section of the eXLerate ribbon:

Fig. 7.1 Insert trend controls

Three Trend controls can be distinguished:

Control Description exTrendChart Visualizes the trend-data in a chart. Contains controls for zooming in and out of the trend-data and moving forward and backward in time. exTrendPenSelector Allows the user to select and modify the tags to visualize for trending. This control works in conjunction with the ‘exTrendChart’ control, in that it selects the tags to visualize in the trendchart. exTrendNavigator This control visualizes a larger portion of the trend-data in order to quickly see anomalies in the data. This control also works in conjunction with the ‘exTrendChart’ control, in that it allows you to quickly select the time-period for the trend-chart.

Table 7.1 Trend controls

To start using the Trend controls, insert a “Trend Chart” onto a worksheet or VBA Form and give it a proper name. After this, insert a “Trend Pen Selector” and attach its ‘Target’ to the previously inserted trend-chart.

These controls are discussed in detail further on in this chapter.

The most important is the ‘Retain trends for’ parameter. This setting controls the lifetime of the historical trend data. To prevent your hard-disk from filling up with trend-data after months or years, it is wise to set some kind of limit (e.g. 60 days = 2 months), depending on the size of the disk.

40 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

7.5 exTrendChart control

This is the main control which visualizes the trend-data in the form of a chart. The control is similar in appearance to a Chart as can be found in Microsoft Excel.

7.5.2 Plot area

The Plot area is the region in which the drawing of the trendlines is performed. The region that is not occupied by the plotarea is used by the axes. The following properties are available for the plot-area:

Fig. 7.2 exTrendChart control

7.5.1 Chart area

The Chart Area encapsulates the whole control excluding the toolbar. In the example above the Chart Area has a background picture and no border.

Fig. 7.3 Plot area properties

By default, the plot-area is oriented horizontally which creates horizontal time-axes and vertical value-axes. When oriented vertically, the time-axes become vertical and the value-axes become horizontal.

The margins define the available space for the axes. These can be changed in the “Margins” tab or by clicking on an axis and dragging the edge:

Fig. 7.4 Plot area margins

7.5.3 Navigation

Navigating can be done using the options in the toolbar:

End- date. Forward / backward. Mouse navigation mode.

Start- date. Period.

The toolbar is fully configurable and buttons may be removed when desired.

Button Icon Description

Zoom in / out.

Start-date

End-date

Shows the start-date/time of the chart. When clicked a popup is shown which allows for selecting a specific date/time.

Shows the end-date/time of the chart. When clicked a popup is shown which allows for selecting a specific date/time.

Period

Shows the difference between the start- and the end of the chart. When clicked a list is shown with predefined periods.

Move to Begin

Moves the start of the chart to the first time a value was stored for any of the pens.

Fast Backward

Moves the chart backward fast. By default the fast step-size is set to 100% which causes the chart to move backward a whole page.

Backward

Moves the chart backward. By default the step-size is set to 25% which causes the chart to move backward by a quarter of a page.

Forward

Fast Forward

Move to End

Realtime

Moves the chart forward. By default the step-size is set to 25% which causes the chart to move forward by a quarter of a page.

Mo ves the chart forward fast. By default the fast step-size is set to 100% which causes the chart to move forward a whole page.

Moves the end of the chart to the current date/time.

Enables or disables realtime-mode. When enabled the end-date remains fixed on the current date/time. Also the data -cursor

Zoom In

Zoom Out

Moving Mode

Zooming

Mode remains fixed on the current date/time. When any of the other buttons is pressed, realtime -mode is automatically disabled allowing the user to perform historical viewing.

Zooms in on the current cursor position.

Zooms out. When this button is pressed the value axis-zoom is always reset to 0%-100%.

Enables mouse-moving mode. When enabled, a hand-cursor appears when moving the mouse over the chart plot-area. When the plot-area is clicked a closed hand appears after which the plot-area may be dragged in any direction.

Enabled mouse-zooming mode. When enabled, a cross appears when moving the mouse over the chart plot -area. When the plot-area is clicked a rectangle may be dragged until the mouse button is released. The chart will then zoom onto the selected zoom area.

Table 7.2 Trend Chart Toolbar eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 41

The following properties are available for navigation:

The step size defines the scroll-speed when pressing the Forward or

Backward button.

The fast step size defines the scrollspeed when pressing the Fast Forward or Fast Backward button.

Fig. 7.5 Navigation properties

The Properties dialog also contains an option “Zoom

Selection”. This setting defines the visual appearance when using the mouse zooming-mode to select a zoom-area.

7.5.4 Data cursor

The Data cursor is a tool for accurately viewing pen-values on a specific date/time. The Data cursor can be put on a specific date/time by moving the mouse over it. When a sizing cursor appears the mouse button can be pressed and the cursor may be moved:

Pen labels

By default the value of each pen is shown as a label on the chart itself. This label may also be disabled after which the value will only be visible in the Pen selector control. When enabled, the label can be configured to display additional properties of the tag such as Units & Description:

Fig. 7.6 Data Cursor

The following properties are available for the Data cursor. The background and border tabs define the visual appearance of the cursor:

Fig. 7.9 Pen label properties

By default, the background of the label is displayed in the same color as the pen, this can also be changed so that a fixed color is used instead:

Fig. 7.7 Data cursor properties

Optionally, the date/time may be displayed on the top- or bottom-axis:

Disable the “Use Pen color” option in order to use a fixed background / border color.

Fig. 7.8 Data cursor date/time

42 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

Fig. 7.10 Pen label color

7.5.5 Time axes

Two time axes may be configured. Both the Top & Bottom axis share certain properties that are accessible through the “Time

Axes” properties tab:

Enable options to always show labels for the start- and/or end- date.

Fig. 7.11 Time axes properties Fig. 7.13 Scaling properties

The grid-counts determine how many tickmarks and labels are shown on the axis. The specified number of grid counts is used as a maximum, eXLerate will draw as many tickmarks and labels as properly fit on the chart.

By default, the time flows from the left to the right. By enabling the ‘Reverse order’ option this can be changed so that it flows from the right to the left.

7.5.6 Value axes

Two value axes may be configured. Both the Left & Right axis share certain properties which are accessible through the

“Value axes” properties tab:

By default the minimum and maximum is offset

0.1 inch from the top and bottom.

Custom scaling

Trend-pens may also be scaled manually from VBA. In this case the ‘MaximumScaleType’ property of the TrendPen should be set to ‘ exTrendValueAxisScaleTypeFixed’, and the

‘MaximumValue’ should be set to the desired scaling-value.

The Minimum can be scaled in the same manner: exTrendChart.Pens.Item(1).MaximumScaleType = _

exTrendValueAxisScaleTypeFixed exTrendChart.Pens.Item(1).MaximumFixedValue =

100

Value axis styles

Each of the value axis (left & right) may be configured as either

Percentage or Engineering units:

Fig. 7.12 Value axes properties

The grid-counts determine how many tickmarks and labels are shown on the axis. The specified number of grid counts is used as a maximum, eXLerate will draw as many tickmarks and labels as properly fit on the chart.

By default the minimum is displayed on the bottom and the maximum on the top. By enabling the ‘Reverse order’ option this can be changed so that the minimum is displayed on the top and the maximum at the bottom.

Scaling eXLerate contains an auto-scaling option which determines the upper- and lower scaling boundaries based on the visible trend-values, and optionally the limits. It is also possible to use a fixed value or a so-called dynamic value. When for instance, the dynamic value “Tag minimum” is used, the “Min” property as configured in the xTagDB is used.

Fig. 7.14 Value axis styles

When percentage is selected the axis displayed as 0%-100% and each pen is individually scaled. This means that the minimum of each tag is scaled to 0% and the maximum is scaled to 100%:

Fig. 7.15 Percentage axis

When Engineering units is selected the actual trend values are displayed and the all pens are scaled globally. The maximum and minimum of all pens is determined and the highest eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 43

maximum is used as the top edge and the lowest minimum is used for the bottom edge. In the sample below the same trend values are used as in the Percentage example above.

7.5.8 Markers

Optionally markers can be drawn at the actual data points in the chart. Initially when a pen is added no marker is shown.

The PenSelector control can be used to select a marker for the pen(s). The background and border of the markers can be configured in the properties dialog.

Fig. 7.16 Engineering units axis

Besides showing either Percentage or Engineering units, it is also possible to display both. When one axis is Percentage and the other is Engineering units, each pen is scaled individually and the minimum and maximum of each pen is scaled to 0% - 100%. The Engineering units axis can display the values for only one pen:

Figure 7-20: Markers on the chart

Fig. 7.21 Selecting markers using the PenSelector

Fig. 7.17 Using both Percentage and Engineering units axis

7.5.9 Limits

When a tag has any alarm limits configured, it is possible to display these limits on the chart:

In the example above, the right axis (Engineering units) has been configured to use the pen-color rather than a fixed color.

Which pen is displayed on the Engineering units axis can be selected in the PenSelector control:

Fig. 7.22 Alarm Limits on Chart

The PenSelector control supports a ‘Limits’ option which shows the limits when selected. When the tag is not configured with any limits, the option is automatically disabled.

Fig. 7.18 Showing Engineering units Axis for specific pen

The ‘Axis’ options in the PenSelector are only enabled when the Chart is configured with two different axis.

7.5.7 Pen defaults

The defaults for adding new pens to the TrendChart can be configured in the properties dialog:

By default the ‘Limits’ column is hidden. To show this option open the properties dialog of the PenSelector and enable the appropriate column:

Fig. 7.23 Limits option in PenSelector

Fig. 7.19 Default pen style

After adding a new pen, the plot-style, line-style and color can be changed by the operator.

Fig. 7.24 Add limits column to PenSelector

44 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

7.6 exTrendPenSelector control

The PenSelector control combines both the chart legend and the pen selecting mechanism in a single control.

Option to unselect all selected tags.

Filter area which supports wildcards ‘*’ and ‘?’.

Fig. 7.25 exTrendPenSelector Control

The PenSelector control consists of 3 parts, which can be enabled independently. These 3 parts have been combined in a single control in order to support resizing of the individual panes:

The icon is highlighted when the tag is shown in the chart.

When the icon is clicked the selection is toggled.

Fig. 7.29 Tag selection

Tags Pane

Tag-alias if available otherwise tag-name. When double-cliked toggles the selection.

The following properties are available for the tags pane:

Height resizer Pens Pane

Pen Sets Pane

Fig. 7.30 Tags properties

Fig. 7.26 PenSelector individual panes

7.6.1 Linking to a chart control

The first thing that has to be done after inserting a PenSelector control is to attach it to a TrendChart control. After opening the properties dialog a list is shown with all the existing TrendChart controls. One of these controls should be selected as the target control:

When the Tags-option is unchecked, the whole tags-pane becomes hidden.

7.6.3 Pen sets

The Pen sets pane shows a list of previously saved pen-sets. A pen-set is a collection of pens and their settings.

Header may be used to resize the height.

Deletes the selected penset.

Fig. 7.27 Selecting a Target chart

When multiple TrendChart controls have the same name, they should be renamed to unique names. To rename a Trend

Control, enable design-mode and use the Name-box to specify a different name:

Double-click on a penset to load it.

Fig. 7.31 Pen sets

Saves the currently selected pens to a pen-set.

The following properties are available for the pen-sets pane:

Fig. 7.28 Editing names

7.6.2 Tags

The tags-pane shows a list of all tags configured for trending.

The alias of the tag is shown in the list if available, otherwise the tag-name is displayed:

Fig. 7.32 Pen sets properties

In order to prevent any user from modifying and deleting pensets, the minimal security level for modifying pen-sets can be configured. eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 45

Pen sets can be configured in Run-Time mode, so operators can defined their own pen sets. Pen sets can also be preconfigured and then transferred as a file to the target computer.

The following picture shows the PenSets folder when viewed from the Windows Explorer:

Table 7.3 Pens toolbar

Pens list

The pens list shows all the pens of the chart and additional properties. The properties are shown as columns of the list.

Which columns are visible and the width of the columns can be configured in the properties dialog:

Click the option to show or hide the column.

Figure 7-33: Pen-set files

7.6.4 Pens

The pens-pane shows all currently selected pens and additional properties. A toolbar is provided for modifying the pen properties.

Toolbar

Fig. 7.34 Pens toolbar and list

Pens list

The pens-pane can be shown or hidden using the properties dialog:

The width can be changed when a column is selected.

Fig. 7.4 Pens list columns

Figure 7-35: Pens properties

Pens toolbar

The following options are supported by the pens toolbar:

Button Icon Description

Remove

Color

Line

Marker

Style

Chart Style

Group

Ungroup

Removes the currently selected pens from the chart.

Selects a different color for the selected pens.

Selects a different line style and weight for the selected pens.

Selects a marker for the selected pens.

Select the plot-style for the selected pens.

Selects the automatic pen-grouping mode for the chart.

Groups the selected pens together in the same plotarea.

Ungroups the selected pens and creates the separate plot-areas for each pen.

Move Up Moves the selected pens one position up in the list.

Move Down Moves the selected pens one position down in the list.

46 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

Up and down buttons can be used to sort the columns.

7.7 exTrendNavigator control

The TrendNavigator is an optional control for data inspection and navigation. It shows the same pens as the TrendChart control but for a greater period. The position of the Chart is displayed inside the Navigator and can be moved and resized.

7.7.2 Automatic zooming

The control supports two modes of operation, automatic zooming enabled and automatic zooming disabled. The option can be changed in the properties dialog:

Fig. 7.36 exTrendNavigator control

To a large extent, the TrendNavigator has the same graphical capabilities as the TrendChart control. Because of this reason, these will not be discussed explicitly. This chapter is focused on the unique features of the Navigator only.

Before the TrendNavigator can be used it has to be linked to a

TrendChart control. See Linking to a chart control on page 45

on how to do this.

7.7.1 Selection area

The TrendNavigator shows a transparent rectangle which represents the linked TrendChart control. The background and border of this rectangle can be changed in the properties dialog:

Fig. 7.39 Auto zoom properties

When automatic-zooming is enabled, the period of the

TrendNavigator is linked to that of the TrendChart. Assume that the TrendChart has a period of 1 day and that the Auto

Zoom option is set to a factor of 10. This will cause the

TrendNavigator to show 10 days of data. When either of the controls is zoomed, the period of the TrendNavigator will always be a factor X of the TrendChart.

When automatic zooming is disabled, the period of the

TrendNavigator can be changed without affecting the linked

TrendChart. This mode also makes it possible to move the left- and right edges of the chart selection rect:

Moving the left edge changes the

Chart start-date.

Moving the right edge changes the

Chart end-date.

Fig. 7.40 Moving the left- and right edges

Fig. 7.37 Selection area properties

Optionally it is possible to view the cursor of the TrendChart.

This cursor is not interactive; it merely shows the current position of the cursor within the TrendChart:

Selection area background which can be moved using the handcursor.

Selection area border which can be resized when auto-zoom is disabled.

Chart cursor.

Fig. 7.38 Selection area eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 47

7.8 Accessing trend-data directly

Besides using the TrendChart control to visualize the trenddata it is also possible to programmatically access the trenddata. The following VBA functions are available for accessing raw trend-data:

Function Description exTrendReadTag(…) exTrendReadFile(…) exTrendWriteTagToCSV(

…)

Reads the trend-data for a specific tag over a specific period. The result is returned as an 2 dimensional array which can be directly written to a worksheet.

Reads all the trend-data from a specific trendfile.The result is returned as an 2 dimensional array which can be directly written to a worksheet.

Writes the trend-data for a spefic tag and period to a CSV-file.

Table 7-5: Trend Data Functions

These functions are documented in the “Function Reference

Manual”.

7.9 Data storage

Trend data is stored on disk in folders and binary files. Each tag that is configured for trending a separate folder is created in the “TrendData” folder (e.g. “C:\XLRX\TrendData”):

Each tag-folder contains 3 or more sub-folders. The subfolders “Raw”, “10Days” and “100Days” are used for storing the actual trend-values. Other sub-folders are optional and are used for storing additional data such as limits. These folders are automatically created by eXLerate when necessary. Within these folders, files are created with the extension.xtd (eXLerate

Trend Data File):

The name of the file identifies the start-date of the file based on

UTC (=GMT 0) and has the following layout:

Y<year>_M<month>_D<day>_UTC<summer-correction>.xtd.

The year, month and day fields speak for themselves. The summer-correction field is used when eXLerate is configured for daylight-saving corrections.

7.9.1 Reading trend files

Trend-data files (.xtd) may be read (from eXLerate) using the

‘exTrendReadFile(..)’ function in VBA. See the “Function

Reference Manual” for a description of this function.

48 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

8 Relational Databases

In this chapter, you will learn how to use the embedded relational database in your application, and how to access external relational databases from your application.

MySQL has been selected as the embedded database engine for use in an eXLerate environment, because of its programming power, excellent performance, great support as well as its beneficial economic aspects.

A powerful and yet simple spreadsheet interface is available in eXLerate to define all your real-time SQL statements directly from a worksheet. Together with the extensive support for

VBA, these tools give you the power to build any kind of database application.

Another great feature of the embedded database is redundancy support. Databases are automatically synchronized between multiple servers and it requires no engineering effort whatsoever.

Programming in the SQL language isn’t a nightmare anymore, it’s fun!

8.1 Introduction

A database is a structured collection of data. It may be anything from a simple shopping list to a picture gallery or the vast amounts of information in a corporate network.

A

relational database

stores data in separate tables rather than putting all the data in one big storeroom. This adds speed and flexibility, and fits nicely in the natural spreadsheet concept of rows (records) and columns (fields).

8.2 The embedded database eXLerate uses MySQL 4.1 as its embedded database engine.

Configuration is very easy; just specify the database path in the application shortcut of the Control Center and you’re ready to go:

Fig. 8.1 Embedded database path

The embedded database will be created automatically if it doesn’t already exist.

8.2.1 Table layout

Initially the database consists of only 2 tables. The ‘events’ and the ‘command_log’ tables. The ‘command_log’ table is used internally by eXLerate to keep multiple databases synchronized, which is discussed later on in this document.

The ‘events’ table is used to store the alarms & events history.

It has the following layout:

Column

ID

Data Type

BIGINT

Description

Unique ID of the event.

DATETIME DATETIME

CLASS VARCHAR(32)

Date and time the event was stored.

Event class (e.g. ‘Alarms’, ‘Security’,

TYPE VARCHAR(32)

‘Parameter’)

Event type (e.g. ‘Ack’, ‘Logoff’, ‘Change’)

LOCATION VARCHAR(64) Location (e.g.

‘FC01_PRESPRVIN_LOFAULT’, ‘MSC-A’)

USER VARCHAR(64) Name of the user or ‘System’

MESSAGE VARCHAR(255) Event message

EXTRA1

EXTRA2

VARCHAR(128) Additional event field 1

VARCHAR(128) Additional event field 2

Table 8.1 Embedded database event table

The primary-key is defined for column ‘ID’, which means that the table will never have multiple records with the same ‘ID’.

Furthermore, an index is defined on column ‘DATETIME’. This index ensures the fast operation of queries when sorting records by date-time.

8.2.2 Database identifiers

Every database in eXLerate is identified by a unique database

ID. The embedded MySQL database can be accessed through the unique database ID ‘0’. The ‘0’ database is however a special case. It is designed to ease the development of client/server systems, thus it has a different meaning in different scenarios.

The following scenarios can be distinguished:

 Stand-alone. When the ‘0’ database is used on a standalone server, it identifies the local embedded database.

 Duty server. Same as the stand-alone server, ‘0’ identifies the local embedded database.

 Standby server. The ‘0’ database identifies the embedded database on the duty server.

 Client. Same as the standby-server, ‘0’ identifies the embedded database on the duty server.

There is 1 more database ID available. It should normally not be used, but is provided in the interest of a complete reference list:

Database ID Description

0 See scenarios described above.

Local_embedded Always accesses the database on the local computer.

Table 8.2 Embedded database ID’s

All other database identifiers automatically refer to external databases configured using the worksheet function

‘exConfigureDatabase(…)’ or the worksheet ‘xExtDB’. eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 49

8.2.3 User definable tables eXLerate can be extended with user definable tables. MySQL stores tables in the form of files. This makes it very easy to copy tables from one database to another. A single table consists of the following 3 files:

File-name Description

<table>.FRM

<table>.MYD

<table>.MYI

MySQL Table & Column definitions File

MySQL MyISAM Data File

MySQL MyISAM Index File

Table 8-3: MySQL table files

These tables can be created using MySQL 4.1, which can be downloaded freely at http://www.mysql.com. MySQL stores these files in its default data folder (e.g. “C:\Program

Files\MySQL Server 4.1\Data\<database>\”) unless specified otherwise.

When copying table files from one database to another, make sure that both databases are stopped. In case of the embedded eXLerate database, make sure the application is completely shutdown. When copying to or from an external

MySQL 4.1 database, make sure the MySQL-service is completely stopped.

During startup of eXLerate, the Event Logger will show an event for every user-defined table that has been found.

On redundant systems, user-definable tables are automatically synchronized between the servers. Upon startup each server should contain the same user-defined tables with the same layout. After synchronization, the data in the tables on all servers will be identical.

8.2.4 Driver specific info values

The embedded database contains a set of driver specific value which can be obtained using the worksheet function

‘exSQLLastDriverSpecificInfo(…)’ and the VB function

‘SQLCmd.GetDriverSpecificInfo(…)’. The following info values are supported by the embedded database:

Info value Description mysql_error mysql_time thread

MySQL specific error-code.

Time in seconds it took MySQL to execute the SQL statement.

ID of the thread that executed the SQL statement. affected_rows Number of rows that have been affected. For instance, when executing an INSERT or

UPDATE statement, this info-value can be used to determine how many rows have been affected (e.g. changed by the UPDATEstatement).

Table 8-4: Embedded database driver specific info values

8.2.5 Redundancy & synchronization

When multiple servers are used, the database is automatically synchronized between these servers. Synchronization is very important in order to achieve a solid redundancy implementation.

Two types of synchronization can be distinguished:

 Initial synchronization. Upon startup a server determines whether it is the duty server or not. If not, it will copy the complete database from the duty server over its own database and show the ‘Synchronization’ window. After this, both databases will be identical.

 Run-time synchronization. After the database has been completely synchronized, it is constantly kept up-to-date.

This is done using a very fast and secure mechanism.

Because the standby server(s) always have an up-to-date database, failure of the duty server will not cause any dataloss. At this point the standby server would become duty and start using its own database. Any connected clients will automatically switch to the database on the new duty server.

Clients do not need to and cannot configure an embedded database. Instead, they use the database on the duty server.

8.2.6 Advanced settings

By default, the embedded database is configured for use in both large and small systems. In most scenarios the default settings should provide optimal performance. These defaults can however be changed in order to fine-tune the application.

Changing these settings can be done using the

‘exSetDatabaseProperty(…)’ worksheet function. The following properties are supported by the embedded database:

Property Default Description concurrent_ connections

5 Maximum number of connections that should be used when accessing the embedded database. Increasing this value may improve the ability to process more SQL statements in parallel.

Table 8-5: Embedded database driver properties

Example:

=exSetDatabaseProperty( “local_embedded”,

“concurrent_connections”,10,xEvent1.Trigger)

8.2.7 Corruption & data loss

In certain situations it is possible that database corruption occurs. The most common reason is a sudden power failure. In that case the MySQL database will not be able to flush all the date to disk and close the tables. Another common reason, is manually copying table-files while the database is still running.

When eXLerate starts it will automatically try to repair any corrupted database tables. This may cause some loss of data, depending on when the last flush was executed. These events

50 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

are logged to the Event Logger upon startup. If for some reason, the database corruption could not be repaired, please contact your eXLerate representative.

When using a single server, data loss can never be completely prevented in case of a system failure. To increase reliability, the use of multiple servers is advised. Using 2 servers is commonly considered a good redundant solution and will ensure proper system operation in case of single point of failure.

8.2.8 Troubleshooting

The embedded MySQL database writes any critical errors and warnings to a log file located in the database root folder. The log-file has the following file-name: <computer name>.err

(e.g. “NB01.err”). The file can be opened in any ASCII-viewer such as notepad. Make sure the eXLerate application is completely shutdown before opening the file, otherwise an error message is shown that the file cannot be accessed.

8.3 External databases

8.3.1 Configuration

This chapter does not cover the setup and configuration of 3 rd party database platforms. Instead, it describes the tools supported by eXLerate in order to interface with these 3 rd

party databases.

External databases can be configured using two worksheet functions: ‘exConfigureDatabase(…)’ and

‘exSetDatabaseProperty(…)’.

The easiest way of configuring an external database, is to use the ‘xExtDB’ worksheet. This worksheet provides a template for configuring external databases and can be found in the

‘MyDatabase’ sample application.

Fig. 8.2 External database table

All databases in eXLerate can be accessed through Database

ID’s. When configuring an external database, a unique ID has to be chosen for the database. These ID’s must range from

1..n.

The database type specifies the driver which will be used to communicate with the external database. In the example above, the ‘mysql’ driver is used to communicate with a

MySQL 4.1 database.

All other properties such as ‘Host’, ‘Database’, ‘User’, etc. are driver specific and are explained in the specific driver sections further on in this document.

8.3.2 MySQL database driver

Introduction

MySQL is one of the leading database engines in existence.

With the introduction of MySQL 5.0 it also supports Triggers &

Stored Procedures. eXLerate itself uses MySQL internally as its embedded database engine.

MySQL is freely available and can be downloaded at the following URL: http://www.mysql.com.

Supported versions & platforms

The MySQL driver can be used to access external MySQL databases. It supports the following versions of MySQL (other versions and platforms may also work but have not been tested):

Version Platform

MySQL 4.1

MySQL 5.0

MySQL 5.1

Windows (x86)

Windows (x86)

Windows (x86)

MySQL 5.5 Windows (x86)

Table 8.6 Supported MySQL versions eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 51

Configuration properties

In order to configure an external MySQL database, the following set of properties is supported. These can be configured by either using the ‘xExtDB’ worksheet or by using the ‘exSetDatabaseProperty(…)’ worksheet function directly.

Property Default Description host -

User -

Address of the computer where the MySQL server is located. This can be either the computer-name or an IP-address.

Name of the user used to login into MySQL.

(Please note that MySQL supports a comprehensive security system, which requires all computers that will be accessing the MySQL server to be configured in MySQL.) password

Port

Database

Concurrent_ connections

-

-

-

5

Password that is used to login into MySQL.

Port that is used to communicate with

MySQL. By default when MySQL is installed it uses port 3306.

Name of the database to access at the

MySQL server.

Maximum number of connections that should be used when accessing the MySQL database. Increasing this value may improve the ability to process more SQL statements in parallel.

Table 8.7 MySQL driver properties

Version

SQLServer 2000

SQLServer 2005

SQLServer 2008

Platform

Windows (x86)

Windows (x86)

Windows (x86)

Table 8.9 Supported SQLServer versions

Configuration properties

In order to configure an external SQLServer database, the following set of properties is supported. These can be configured by either using the ‘xExtDB’ worksheet or by using the ‘exSetDatabaseProperty(…)’ worksheet function directly.

Property Default Description host user

-

- password - database - concurrent_ connections

5

Address of the computer where the SQLServer server is located. This can be either the computername or an IP-address.

Name of the user used to login into SQLServer.

(Please note that SQLServer supports a comprehensive security system, which requires all computers that will be accessing the SQLServer server to be configured in SQLServer.)

Password that is used to login into SQLServer.

Name of the database to access at the

SQLServer.

Maximum number of connections that should be used when accessing the SQLServer database.

Increasing this value may improve the ability to process more SQL statements in parallel.

Table 8.10 SQLServer driver properties

Driver specific info values

The MySQL database contains a set of driver specific value which can be obtained using the worksheet function

‘exSQLLastDriverSpecificInfo(…)’ and the VB function

‘SQLCmd.GetDriverSpecificInfo(…)’. The following info values are supported:

Info value Description mysql_error MySQL specific error-code.

Mysql_time Time in seconds it took MySQL to execute the SQL statement.

Thread ID of the thread that executed the SQL statement.

Affected_rows Number of rows that have been affected. For instance, when executing an INSERT or UPDATE statement, this info-value can be used to determine how many rows have been affected (e.g. changed by the UPDATEstatement).

Table 8.8 MySQL database driver specific info values

Driver specific info values

The SQLServer database contains a set of driver specific value which can be obtained using the worksheet function

‘exSQLLastDriverSpecificInfo(…)’ and the VB function

‘SQLCmd.GetDriverSpecificInfo(…)’. The following info values are supported:

Info value Description

Oledb_error OLEDB specific error-code. oledb_time Time in seconds it took the OLEDB driver to execute the

SQL statement. thread ID of the thread that executed the SQL statement. affected_rows Number of rows that have been affected. For instance, when executing an INSERT or UPDATE statement, this info-value can be used to determine how many rows have been affected (e.g. changed by the UPDATE-statement).

Table 8.11 SQLServer database driver specific info values

8.3.3 SQLServer Database Driver

Introduction

SQLServer is one of the leading database engines in existence. eXLerate uses OLEDB to access the SQLServer.

Supported versions & platforms

The SQLServer driver can be used to access external

SQLServer databases. It supports the following versions of

SQLServer (other versions and platforms may also work but have not been tested):

52 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

8.4 SQL worksheet functions

8.4.1 Introduction

The SQL interface in eXLerate can be fully configured from an

Excel worksheet, i.e. no VBA Sub routines are required to connect to a database or to retrieve data from it. However, in some cases it makes more sense to access the database using VBA, this is described in detail in the next section.

This section will cover the usage of the SQL worksheet function in order to read and write from and to a database.

A worksheet is highly suitable for representation of a relational database, where data is organized in records and fields. Using the worksheet functions, these records and fields directly translate into rows and columns, respectively.

8.4.2 Queries

After a database has been configured, it can be accessed using so-called ‘Queries’. A ‘Query’ in eXLerate translates directly to a SQL statement executed on a database.

The following worksheet functions are available for SQL

Queries:

Function Description exSQLCreateQuery(…) exSQLExecQuery(…)

Create a query with a specific ID and options.

Execute the query, and return any result set of the query to the worksheet in rows and columns. This is the

‘workhorse’ function actually executing

SQL statements. exSQLExecRangeQuery(…) exSQLExecRecordQuery(…) exSQLField(…) exSQLRowCount(…) exSQLColumnCount(…)

Execute a query, which is based on a range of values rather than a single value. Fields for a single record have a user-definable name in which an array index is used, e.g. VAL00, VAL01,

VAL02 to write a complete array in the database using a single update function.

Execute a query, which is based on a complete database record rather than on a single value. Each field in the record is named in an argument.

Returns a single field of the result set of the corresponding query.

Returns the number of rows returned by the corresponding query.

Returns the number of columns returned by the corresponding query. exSQLLastError(…) Retrieve the last error of the corresponding query, either as a number or a textual description.

Return the time it took to execute to exSQLLastDurationTime(…) corresponding query. exSQLLastDriverSpecificInfo(…) Returns a driver specific value of the corresponding last executed query. exSQLDiagnosticalValue (…)

This function can be used to obtain for instance, the MySQL specific errorcode if accessing a MySQL database server.

Returns a diagnostical value of the corresponding query. For instance, this function can be used to determine how many times a query has been executed. Such information can be critical when optimizing an application so that no unnecessary queries are executed.

Table 8.12 Implemented SQL query functions

8.4.3 Views

A ‘View’ in eXLerate is a view-port on a previously executed

SQL Query.

Consider the following metaphor. A book contains more than

1000 pages. When reading it, it is only possible to view 2 pages at once. All the information of the book is at your fingertips, but you can only access a small portion at any given time.

SQL View

Row Offset

SQL

Query

SQL View

Column

Offset

Figure 8-3: SQL query & view relation

SQL View

SQL queries sometimes produce large result sets. Such queries can take a lot of time, so minimizing the number of times they are executed can be very important. Such a large result set will usually not fit entirely on the screen. In that case a SQL View can be used to show only a section of the data. In order to scroll through the data, a scrollbar can be used which modifies the offsets of the SQL View. Scrollbars are explained in detail furtheron in this chapter.

The following worksheet functions are available for SQL Views:

Function Description exSQLViewQuery(…) Views a selection of a previously executed SQL query. The selection can be specified by using row- and columnoffsets.

Table 8.13 Implemented SQL view functions eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 53

8.4.4 SQL table

The easiest way of configuring SQL queries, is to use the ‘SQL

Table’. This table is located on the ‘xSQL’ worksheet. This worksheet is located in the ‘MyDatabase’ sample application: worksheet function. This function returns the results of a query in the form of an array.

Fig. 8.5 Example exSQLViewQuery(..) worksheet function

Figure 8.4 SQL table

The ‘SQL table’ consists of the following configurable ‘SQL properties’:

Field Description

ID Unique ID of a query. When an entry in the SQL Table is configured, a query with that particular ID is created. The ‘exSQLViewQuery(…)’ worksheet function can be used to access the result of a SQL statement.

Database ID (0 = Embedded, 1..n = External). See Database

‘exSQLExecQuery(…)’ worksheet function for more details.

SQL Statement SQL Statement to execute (cannot exceed 255 characters). See ‘exSQLExecQuery(…)’ worksheet function for more details.

Update Interval Interval in seconds the query will be executed. Set this value to ‘0’ if the query should only be updated when the SQL statement text itself changes.

Table 8.14 SQL table property fields

The first argument of the function identifies the query ID as configured in the ‘SQL Table’. The other arguments of the function are explained in detail in the next section.

8.4.5 Views

Views can be used in combination with scrollbars to create scrollable views. The row- or column count of a query can be used to set the boundaries of a scrollbar. The scrollbar can then be used to determine an offset for the view on the query.

The worksheet ‘ScrollViews’ in the ‘MyDatabase’ project contains working examples of scroll views.

Before configuring a scrollable view, the following condition must be met:

 The SQL query has been configured, either by using the

‘SQL Table’ or directly by using the ‘exSQLCreateQuery(…)’ and ‘exSQLExecQuery(…)’ functions.

Step 1 : Create worksheet variables

A small set of worksheet variables needs to be created, most of which are self-explanatory:

When an SQL statement is executed, its status information is shown in the ‘SQL Results’ part of the ‘SQL table’:

Field Description

Error Code Returns the error code of the last executed SQL statement. See ‘exSQLLastError(…)’ worksheet function.

Error Description Returns the error description of the last executed

SQL statement. See ‘exSQLLastError(…)’ worksheet

Row Count function.

Returns the number of rows returned by the last executed SQL statement. See ‘exSQLRowCount(…)’ worksheet function.

Column Count

Time

Execute Count

Returns the number of columns returned by the last executed SQL statement. See

‘exSQLColumnsCount(…)’ worksheet function.

Returns the time in seconds the last executed SQL statement took to execute. See

‘exSQLLastDurationTime(…)’ worksheet function.

Returns the number of times the SQL statement has actually been executed. See

‘exSQLDiagnosticalValue(…)’ worksheet function.

Table 8.15 SQL table result fields

=exSQLRowCount(

<QueryID>,<Update Trigger>)

Fig. 8.6 Creating worksheet variables for scrollable view

Step 2 : Create view array using exSQLViewQuery(…)

Select the range where the scollable text should appear:

Fig. 8.7 Select scrollable range

And enter the following formula for the range:

=exSQLViewQuery( <Query ID>, <Update Trigger>,

<Scollbar current position> + 1 )

Because, the formula spans multiple cells, ‘Ctrl+Shift+Enter’ must be used to accept the formula.

Example:

After a SQL statement has been configured using the ‘SQL table’ it can be accessed using the ‘exSQLViewQuery(…)’

Fig. 8.8 Scrollable range formula

54 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

Step 3 : Create a scrollbar next to the data

Insert a scrollbar next to the database and give it a logical name.

Select scroll bar from toolbar

Place scrollbar on worksheet

Data

Fig. 8.9 Creating a scrollbar

Step 4 : Attach scrollbar to current position variable

Right-click the scrollbar and select ‘Format Control…’. above). The easiest way is to create an animation object and use the ‘exShapeMinMax(…)’ worksheet function to update the maximum value of the scrollbar:

=exShapeID(

<Scrollbar name>, xAutoRecalc)

=exShapeMinMax( <Shape ID>,

<Minimum>,<Maximum> )

Fig. 8.12 Update scrollbar maximum value

The minimum-value should remain ‘0’. The maximum value is calculated as follows:

<maximum value> = <query row count>

- <scrollbar window size>

.

Step 6 : Increase scrollbar response (optional)

This step is optional and is not required in order to create a fully functional scroll view.

When the slider on a scrollbar is changed, it may take a little while before the view is actually updated. This is because the view is only updated when a re-calculation is executed, which is normally done once every second. To improve the viewresponse, the scrollbar has to call the following VBA macro whenever its selection changes.

The following VBA macro should be assigned to the scrollbar:

Sub ManualRecalc

exRecalc

End Sub

Fig. 8.10 Formatting the scrollbar

On the ‘Control’ tab attach the ‘Cell link’ to the ‘Scrollbar current position’ value.

Fig. 8.11 Attach scrollbar to variable

Step 5 : Update the scrollbar boundaries

Queries can return result sets with changing row counts. This means that the maximum value of a scrollbar needs to be updated whenever a query returns a different row-count.

Unfortunately, updating the boundaries of a scrollbar (min/max) is not so straight-forward as updating the current position (see eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 55

8.5 SQL VBA functions

8.5.1 The ‘SQLCmd’ object

The ‘SQLCmd’ object is the main interface for VBA to access the database. Unlike other objects such as ‘Trending’ and

‘Comms’, it has to be created explicitly before it can be used.

The following example shows several ways on how to create a

‘SQLCmd’ object:

‘ Declare variable

Dim oSQL As SQLCmd

‘ Create instance of SQLCmd object

Set oSQL = New SQLCmd

It is also possible to combine the declaration and the creation into a single statement:

‘ Declare variable and create it

Dim oSQL As New SQLCmd

When an SQL statement is executed either by using the function ‘Execute(…)’ or ‘ExecuteAsync(…)’, the results are stored inside the ‘SQLCmd’ object. These can be accessed using the other properties and functions of the object. For instance, in order to detect whether the SQL statement was executed successfully, the properties ‘ErrorCode’ and

‘ErrorDescription’ can be used.

8.5.2 Executing SQL statements

This section describes the use of ‘synchronously’ executed

SQL statements. A-synchronously executed SQL statements are explained further on in this document.

The function ‘Execute(…)’ executes a SQL statement on a database. The first argument specifies the database ID

(0=embedded database, 1..n=external database). The second identifies the SQL statement to execute and the third identifies the timeout-value in milliseconds.

The following example executes a SQL statement on the embedded database and waits for a maximum time of 10 seconds for it to complete:

‘ Declare variables

Dim oSQL As New SQLCmd

Dim lErr As Long

‘ Execute SQL statement lErr = oSQL.Execute(“0”,“SELECT COUNT(ID) FROM

EVENTS”,10000)

The return value (

‘lErr’

) will contain ‘0’ if the statement was successfully executed. If an error has occurred, the properties

‘ErrorCode’ and ‘ErrorDescription’ can be used to determine the reason of the error.

8.5.3 Reading SQL results

After a SQL statement has been successfully executed, the results can be accessed using the ‘Field’ property. The arguments for this property identify the row- and column indexes within the result-set. Both are 0-based, so the first element must be accessed using index ‘0’. The following example shows the use of the ‘Field’, ‘RowCount’ and

‘ColumnCount’ properties:

‘ Declare variables

Dim lRow As Long

Dim lColumn As Long

Dim dSum As Double

‘ Iterate through all the fields and count the values dSum = 0.0

For lRow = 0 To oSQL.RowCount - 1

For lColumn = 0 To oSQL.ColumnCount - 1

dSum = dSum + oSQL.Field( lRow, lColumn )

Next

Next

8.5.4 Writing SQL results to worksheets

When a ‘SQLCmd’ object contains any data, these results can be written to a worksheet. The easiest way is to copy the

‘SQLCmd.Field’ property directly to a worksheet cell: oSheet.Range( “A1” ).Value = oSQLCmd.Field( 3,

4 )

This works just fine for a couple of cells but can have a major performance impact when writing large amounts of cells. In that case the ‘GetArray(…)’ function should be used instead.

The ‘GetArray(…)’ function returns a 2-dimensional array containing all the fields in the ‘SQLCmd’ object. This array can be assigned to a worksheet range in a single function call, which makes it extremely fast:

Dim vArray as Variant

‘ Copy all the fields into the array vArray = oSQLCmd.GetArray()

‘ Copy the array to the range oSheet.Range( “A1:C1000” ).Value = vArray

8.5.5 Executing a-synchronous SQL statements

Introduction

Executing SQL statements a-synchronously is a very powerful tool in order to boost performance and increase responsiveness of your application. Especially when executing multiple SQL statements, using the a-synchronous functions can have a profound impact on the performance. The following example shows 5 SQL statements, executed synchronously:

56 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

SQL 1

30 ms

SQL

2

20 ms

SQL 3

SQL 5

The ‘MyDatabase’ sample application contains a working example on a-synchronous SQL statements (Form

‘frmASyncSample’).

The following a-synchronous functions are available for the

‘SQLCmd’ object:

Name Description

45 ms

SQL 4

35 ms

Total

160 ms

Fig. 8.13 Synchronously executed SQL statements

30 ms

When the same SQL statements are executed a-synchronously the following behavior arises:

SQL 1

ExecuteAsync

WaitForAsync

Executes an SQL statement on a database and returns immediately.

Can be called after ‘ExecuteAsync’. Waits x milliseconds for the a-synchronous operation to complete. If the a-synchronous operation is completed before x milliseconds, the function returns immediately. This function can be called

CancelAsync multiple times.

Cancels the last SQL statement executed by

‘ExecuteAsync’.

IsAsyncInProgress Returns ‘True’ when an a-synchronous operation is still in progress.

Table 8.16 SQLCmd a-synchronous functions

SQL 2

SQL 3

SQL 4

SQL-5

Total

45 ms

Fig. 8.14 A-synchronously executed SQL statements

When executed a-synchronously the total time of execution will depend on the slowest SQL statement in the batch.

The example above shows an ‘ideal’ situation. In such a situation all SQL statements are executed in parallel without any performance cost. In reality, the hardware (CPU, harddrive, network) will have more to do at the same time, which has some performance impact. Today’s generation of computers is however increasingly capable of parallel execution (Hyper Threading, Multi-core CPU’s) and thus using a-synchronous SQL statements will ensure that you get the best performance out of your hardware.

Another important criterion for using a-synchronous SQL statements is responsiveness. Imagine that a single SQL statement is executed which takes 30 seconds to complete.

When executed synchronously, it will block the execution of the application for that period. Using the a-synchronous functions will not make it go faster, but when used correctly, will ensure that the application doesn’t become blocked. It is also possible to cancel a-synchronous SQL statements when necessary.

Executing multiple a-synchronous SQL statements

Executing multiple a-synchronous SQL statements can be done using both the ‘SQLCmd’ and ‘SQLCmdBatch’ objects.

L

The following example demonstrates the use of the

‘SQLCmdBatch’ object in combination with the a-synchronous functions of the ‘SQLCmd’ object:

‘ Declare variables

Dim oSQL1 As New SQLCmd

Dim oSQL2 As New SQLCmd

Dim oSQL3 As New SQLCmd

Dim oSQLBatch As New SQLCmdBatch

Dim lErr As Long

‘ Add SQL objects to the batch oSQLBatch.Add oSQL1 oSQLBatch.Add oSQL2 oSQLBatch.Add oSQL3

‘ Execute SQL statements oSQL1.ExecuteAsync “0”, “SELECT ID FROM

EVENTS” oSQL2.ExecuteAsync “0”, “SELECT MESSAGE FROM

EVENTS” oSQL3.ExecuteAsync “0”, “SELECT LOCATION FROM

EVENTS”

‘ Wait for all statements to complete. Let

Excel

‘ process any events every 100 milliseconds. lErr = oSQLBatch.WaitForAsync(100)

While lErr <> 0

DoEvents

lErr = oSQLBatch.WaitForAsync(100)

Wend

‘ Check the error codes of the SQL command objects eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 57

If oSQL1.ErrorCode <> 0 Then …

If oSQL2.ErrorCode <> 0 Then …

If oSQL3.ErrorCode <> 0 Then …

The example shown above is one of many techniques which can be used for a-synchronous SQL statements. It is also possible to use Timers or delays to construct wait-loops.

58 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

9 Servers, clients & printers

In this chapter, you will learn how to add client/server support to your application.

Using multiple servers is discussed in 10 Redundancy.

9.1 Introduction

You may have multiple computers with the same functionality to protect against a single failure or to allow operation control on different locations. An eXLerate project configuration allows this functionality by the Server & Client configuration. You can have the following types of computers in an eXLerate environment: Standalone, Servers and Clients. A standalone computer communicates directly with IO devices, generates reports and maintains an internal database for alarms & events but does not connect to or shares data with other computers.

Servers can communicate directly with IO devices, generate reports and maintain an internal database for alarms & events and can connect to other servers and client to share and synchronize data. A Client visualizes the data and allows user interactions, but it doesn’t communicate directly with an IO device or generate reports periodically. For all the functions a client doesn’t perform, it reads the results from the Servers.

From the end-user point of view, all servers as well as all clients provide full operator functionality.

For the servers, a duty/standby concept is used. Only one server is the “duty” server, the others are considered

“standby”. If the “duty” server fails, a standby server will take over the role of “duty” server without any hiccups. The standby server(s) continuously synchronize all the data from the duty server such as reports, averages, and database.

Client computers can be either dedicated client or nondedicated client. A dedicated client is explicitly configured in the application and can be monitored by others. A nondedicated client is configured in the application but still can connect to the servers and participate, however it cannot be monitored by the other. A non-dedicated client can for instance, be a service- or engineering laptop which is only used when necessary.

When using eXLerate to develop server/client systems it is not necessary to create separate applications for these different types. Instead, a single application will serve all these different functions. Most of this “conditional” behavior is done by eXLerate internally, such as generating reports periodically.

Application specific functionality should however be implemented conditionally. For instance, when periodic reports are generated manually, the VBA code in question should only be run on the duty server.

9.2 Network configuration sheet (xNet)

All network related functionality in an application can be configured through a set of worksheet functions. In order to simplify client/server implementation a separate worksheet has been developed which has all these worksheet functions preconfigured. This worksheet is called ‘xNet’ and is considered the primary means of configuring client/server functionality.

The ‘xNet’ worksheet can be found in the ‘MyNet’ sample application. If you want to implement client/server functionality and your application does not contain the (latest) ‘xNet’ sheet, you insert it by opening the ‘MyNet.xlrx’ as a second workbook in the eXLerate application you want to add/update the functionality (so both files are open in the same excel instance).

The ‘xNet’ sheet and related functionality will be automatically inserted into your application. If an old ‘xNet’ worksheet is already available in the application, it will be updated.

The ‘xNet’ worksheet automatically detects the installed license:

V2.4

License: Server Network Configuration Sheet

Fig. 9.1 xNet license detection

In order to use server / client functionality, one of the following licenses should be installed:

 Server license

 Client license

In case of a single computer with no Client/Server functionality required, the stand-alone license shall be used. eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 59

9.3 Server/Client configuration

To configure servers and clients, you should execute the following steps. These steps apply to both single server systems and multi-server systems with duty/standby selection.

Step 1 : Configure ‘xNet’ worksheet

Specify the Computer Name of the computers and optionally specify the IP-addresses in the Project Configuration section.

Default the sheet supports up to 4 Servers and 8 Clients - up to 4 network addresses each.

Project Configuration

Server 1

Server 2

Server 3

Server 4

Client 1

Client 2

Client 3

Client 4

Client 5

Client 6

Client 7

Client 8

Name

SERVER01

SERVER02

CLIENT01

CLIENT02

IP1

192.168.1.1

192.168.1.2

192.168.1.11

192.168.1.12

IP2

192.168.2.1

192.168.2.2

192.168.2.11

192.168.2.12

IP3 IP4 AllowDuty

TRUE

TRUE

TRUE

TRUE

Fig. 9.2 Server configuration

Status

Not started

Not started

Not started

Not started

Status 1

Not started

Not started

Not started

Not started

Status 2

Not started

Not started

Not started

Not started

Fig. 9.3 Server communication statuses

Status 3 Status 4

Status

4

Description

No computer / IP address configured

3 Not started eXlerate communication has not been started

2 Not connected IP address cannot be found on the network

1

0

No heartbeat

Running

IP address is valid, but the application can’t connect to the remote application

The application can connect to and communicate with eXLerate application on the IP address specified

Table 9.2 Network status

The columns can be configured as follows:

Column Description

Name

IP #1

Computer name as configured in Windows (Control

Panel\System and Security\System).

Note: this is not the system name as configured in the eXLerate Control Center

Optional IP address by which the computer can be accessed.

It is highly recommended to specify an IP address explicitly.

Accessing computers on a network merely by using their computer-name is not guaranteed to work. This is especially true for systems that don’t use name-servers such as WINS or

DNS.

IP #2..4 Optional IP addresses of redundant network cards.

A server will always try to communicate over the primary connection unless it fails, then it will try connection 2, 3 and eventually 4.

Allow

Duty

Specifies if a server can become the Duty Server.

Only Duty Servers are allowed to communicate directly with IO devices. If this is set to FALSE, the Server cannot become duty, but it will have the synchronized databases and reports locally, in contrast with clients that retrieve the data from the

Duty server and not retain it locally.

Table 9.1 Server/Client configurable fields

Step 2 : Share reports for clients

Clients do not have the reports locally. Clients do not generate these files; instead they read them from the duty server. The same is true for database and trend files. For the reports, the location of the files need to be shared by the use of a drivemapping to the server(s).

First create a file-share should for the eXLerate Report folders on the servers:

The ‘xNet’ worksheet has a second section Test configuration to set-up computers and IP addresses for testing purposes. When enabling

‘Alternative config. for testing’

, these computer names and IP addresses will be used instead of the project set-up. It allows you to test the application without having to change the project configuration.

Whether the server IP address configuration is correct can be validated using the ‘xNet’ worksheet. The Network configuration table shows the status for every IP address that is configured.

Fig. 9.4 Share Report folder on server

Then on the Client, create a network drive-mapping for each server to which the client can connect to:

60 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

If the communication is running and the printer is available, eXLerate will determine the printer status from Windows.

Status Description

4 No printer / IP address configured

3 Not available The computer cannot connect to the printer

2 Warning Printer is available, but reports a warning/error

1 Busy

0 Ready

Printer is available and busy printing

Printer is available and ready for printing

Table 9.4 Printer status

Fig. 9.5 Client network drive mapping

The final step is to configure these network locations in the

Control Center shortcut of the Client:

Server 1 ‘|’ character separates the servers

Fig. 9.6 Client shortcut configuration

Server 2

If multiple servers are used, each server should have its own set of network drive mappings. These drive-mappings should be separated using a ‘|’ character as shown above. Any spaces that are used before or after the ‘|’ character are ignored. The order is always as Server 1 | Server 2 and so on.

9.4 Printers configuration

The ‘xNet’ worksheet also allows to configure up to 4 printers.

Specify the name of the printer and optionally specify the IPaddresses in the Project configuration section. You have to select if the printer is used as a Report or as an Event printer.

When for a type multiple printers are available, the printer which has the best status will be selected as the "in use" printer (priority from Printer 1 down to Printer 4).These "in use" printers can be referred by the names Net.ReportPrinter and

Net.EventPrinter in your application.

Name

PRINTER01

IP1

192.168.90.100

IP2 IP3

Printer 1

Printer 2

Printer 3

Printer 4

IP4

Reports

None

None

None

Fig. 9.7 Printer configuration

The columns can be configured as follows:

Column Description

Name

Printer name as configured in Windows.

IP #1..4

Optional IP address by which the printer can be accessed.

Type

Specifies the printer to be used as Report printer or as Events printer

Table 9.3 Server configurable fields eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 61

9.5 Advanced settings

The ‘xNet’ worksheet contains a separate section for advanced settings.

Advanced settings

Net.Port

Net.UpdateInterval

Net.SwitchOverPeriod

Net.LocalOverride

Net.TimeSync.Hour

Net.TimeSync.Minute

Net.CellNaming

Net.MaxPrintJobs

Fig. 9.8 Advanced settings

9666

3

10

0

3

30

Single cell names

5

The following advanced settings are supported:

Setting Default Description

Port 9666

Update Interval 3

Switchover period

10

Local Override 0

Time synchronization

Hour

Time synchronization

Minute

Cell Naming

3

30

Single cell names

Max. Print Jobs 5

TCP/IP port that is used for communicating with other clients and servers.

Calculation cycle time in seconds for

Network functions on this sheet.

Time in seconds the system is forced in a duty-selection when switching over (minimal

3 times the update interval).

When a value is set, the computer is forced in a fixed duty selection, e.g. when set to ‘2’ the 2nd server will be forced to be the duty server.

Hour of the day at which periodic time synchronization between clients and server should occur. If this cell is left empty, time synchronization is performed every hour or not at all, depending on the ‘Minute’ setting below.

Minute of the hour at which periodic time synchronization between clients and server should occur. If this cell is left empty, no time synchronization is performed at all.

Cell naming used for reference in application: "Range names" (ref with INDEX function) OR "Single cell names" (more names, for backwards compatibility) – see

section Application development below for

detailed explanation.

Maximum number of print jobs allowed for the printers.

Table 9.5 Advanced settings

9.6 Application development

9.6.1 Names

The ‘xNet’ worksheet provides an elaborate set of names which can be used in your application. All the names provided by the ‘xNet’ worksheet are read-only. The names available depends on the

Cell Naming

setting.

When set to

Single cells names

the following names are available:

Name Description

Net.Server{x}.Name

Computer name of the Server {x}, with {x} being the server number 1, 2, …

IP addresses for Server {x} . Net.Server{x}.IP1

Net.Server{x}.IP2

Net.Server{x}.Status

Net.Server{x}.Status1

Net.Server{x}.Status2

Net.Server{x}.Duty

Overall communication status of the server

{x}, as a number between 0 and 4

See Table 9.2 Network status for explanation

of the values

Communication status of a specific IP address

(network adapter).

Net.Client{x}.Name

ID of the duty server which is selected by that particular server;

‘0’ if no duty is selected by the server.

Computer name of the Client {x}, with {x} being the Client number 1, 2, …

IP addresses for Client {x} . Net.Client{x}.IP1

Net.Client{x}.IP2

Net.Client{x}.Status

Net.Client{x}.Status1

Net.Client{x}.Status2

Overall communication status of the Client {x}, as a number between 0 and 4

Communication status of a specific IP address

(network adapter).

Net.Client{x}.Duty

Net.Printer{x}.Name

ID of the duty server which is selected by that particular Client;

‘0’ if no duty is selected by the Client.

Computer name of the Printer {x}, with {x} being the Printer number 1, 2, …

IP addresses for Printer {x} . Net.Printer{x}.IP1

Net.Printer{x}.IP2

Net.Printer{x}.Status

Net.Printer{x}.Status1

Net.Printer{x}.Status2

Overall communication status of the Printer

{x}, as a number between 0 and 4

See Table 9.4 Printer status for explanation of

the values

Communication status of a specific IP address

(network adapter).

Table 9.6 Single Cell Names

When using the single cell names, you can directly refer to the individual cell values. For example, if you want to refer to the overall status of server 2, use a formula like:

=Net.Server2.Status

62 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

When set to

Range names

the following names are available:

Name Description

Net.Servers

Net.Servers.Status

Range with the Computer names and IP address of the Servers

Range with the communication status of the

Servers, as a number

Net.Servers.StatusTxt Range with the communication status of the

Servers, as text

Net.Servers.Duty Range with the IDs of the duty server as selected by the individual servers;

Net.Servers.DutyName Range with the names of the duty server as selected by the individual server;

Net.Clients

Net.Clients.Status

Range with the Computer names and IP address of the Clients

Range with the communication status of the

Clients, as a number

Net.Clients.StatusTxt

Range with the communication status of the

Clients, as text

Net.Clients.Duty Range with the IDs of the duty server as selected by the individual clients;

Net.Clients.DutyName Range with the names of the duty server as

Net.Printers selected by the individual clients

Range with the Computer names and IP address of the Printers

Net.Printers.Status Range with the status of the Printers, as a number.

Net.Printers.StatusTxt Range with the status of the Printers, as text.

Table 9.7 Range Names

When using the range names, you can refer to the individual cell values using the

INDEX

function. For example, if you want to refer to the overall status of server 2, use a formula like:

=INDEX(Net.Servers.Status,2,1)

Independent if the

Cell naming

setting, the following global names are available:

Name Description

Net.Configured

Net.Started

Net.StartTime

Net.UpdateTime

Net.WaitTimeExpired

Net.Local.ServerID

Check if the license is eXLerate Server

Edition or eXLerate Client edition

Check if network is configured and if the communication is started

Time when the communications were started

Time of last calculation cycle for network functions

Checks if the system is still waiting for Duty

Server determination

The Wait Time is related to the defined

Switchover period and the Server ID and is different for each server.

ID of the local server or ‘0’ if the local computer is not a server.

Net.Local.ClientID ID of the local client or ‘0’ if the local computer is not a client.

Net.Local.IsClient

Net.Local.IsDutyServer

Net.Duty.ID

Net.Duty.Name

TRUE when the local computer is a client.

TRUE when the local computer is the duty server.

ID of the currently selected duty server, or

‘0’ if no duty is selected.

Computer name of the currently selected duty server, or ‘None’ if no duty is selected.

Net.Duty.SwitchOver.Timer Timer counting when Duty switch-over occurs to prevent 2 nd switch-over occurring within the Switchover period

Table 9.8 xNet global names

9.6.2 Pre-defined animations

The ‘xNet’ sheet contains pre-defined animations for the status of the Servers, clients and printers. The animations are based on grouped shapes: 1 grouped shape for each

Server/Client/Printer.

Name Description

Server{x}

Server{x}.Link1

Server{x}.Link2

Server{x}.Flt1

Server{x}.Flt2

Client{x}

Client{x}.Link1

Client{x}.Link2

Client{x}.Flt1

Client{x}.Flt2

Main name of the (grouped) object for server {x}, with {x} being the server number 1, 2, …

Set visible when name is set for corresponding

Server, else set to invisible

Sub-shape of the main object to show a specific link.

Set visible when an IP address is set for this network, else set to invisible.

Sub-shape of the main object to show the status of a specific link.

Set visible when communication over an IP address fails for this network, else set to invisible

Main name of the (grouped) object for Client {x}, with {x} being the Client number 1, 2, …

Set visible when name is set for corresponding

Client, else set to invisible

Sub-shape of the main object to show a specific link.

Set visible when an IP address is set for this network, else set to invisible.

Sub-shape of the main object to show the status of a specific link.

Set visible when communication over an IP address fails for this network, else set to invisible

Printer{x} Main name of the (grouped) object for Printer {x}, with {x} being the Printer number 1, 2, …

Set visible when name is set for corresponding

Printer, else set to invisible

Printer{x}.Flt Sub-shape of the main object to show the status of a specific link.

Set visible when communication over an IP address fails for this network, else set to invisible

Printer{x}.Status Sub-shape of the main object to show the status of a specific link.

Status indication set to RED when printer reports an error / YELLOW when printer reports a warning, else set to invisible eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 63

Printer{x}.Busy Sub-shape of the main object to show the status of a specific link.

Status indication set to visible when printer is busy, else set to invisible

Table 9.9 Single cell names

The following example shows a network overview of 2 servers and 2 clients. Both the servers and the clients have 2 redundant network adapters.

Server1 Server2 Client1 Client2

For worksheets it is recommended to not use the functions mentioned above but to instead use the

‘Net.Local.IsClient’ and the ‘Net.Local.IsDutyServer’ names as defined on the ‘xNet’ worksheet. The main reason for this is to improve the Excel calculation performance by minimizing trigger based functions.

Worksheet function example:

Fig. 9.11 Conditional worksheet function

Figure 9.9 Network overview example

The names from the ‘xNet’ worksheet can be used to animate the network adapters on the overview:

Animated using name:

“Server1.Link1”

Animated using name:

“Server1.Flt1”

Animated using name:

“Server1.Link1”

Server1

Fig. 9.10 Network adaptor animation

Animated using name:

“Server1.Flt2”

Animated using name:

“Server1.Link2”

9.6.3 Conditional development

When developing a client/server application, it is important to know that all VBA code is executed on both the servers and clients. During development, you have to keep in mind that only the duty server should perform specific tasks, such as generating automatic reports, controlling valves, etc… Since the application runs on both the servers and the clients, certain functionality should be prevented from running on anything but the duty server.

A set of tools is required for conditional development. These tools are provided in the form of worksheet/Visual Basic functions and the names defined on the ‘xNet’ worksheet.

The following functions are supported for both worksheets and

VBA:

Function Description exIsClient Checks whether the local system is either a client or server. exIsDutyServer Checks whether the local computer is the duty server or not.

Table 9-10: Conditional development tools

Visual basic example:

' Check required position of the prover 4-way valves

' but do this only the duty server

If exIsDutyServer Then

CheckPrvValves

End If

9.6.4 Event logging

In client/server systems all events are logged to the database.

This database is stored servers and all the servers have a synchronized copy of this database. Events are also locally logged in the eXLerate Control Center. These local logs are however not synchronized and differ on the individual computers. The database should be considered the primary location for storing events, not the local event log.

Many functions/mechanisms in eXLerate log events to the database. This is all done transparently and does not require any additional engineering effort. There are however some functions which have been tailored for client/server support.

The following functions behave in a particular manner when logging events:

Function Description exLogChange

(Worksheet) exStoreValue

(Worksheet) exLogEvent

(Visual Basic)

When this function is configured to log to the database, it will only do this when executed on the duty server.

When this function is configured to log to the database, it will only do this when executed on the duty server.

When this function is used to log to the database, it will always do this.

Table 9.11 Conditional event logging

9.6.5 Writing to IO devices

Writing to IO devices is possible from both servers and clients.

Using the functions ‘exUpdateEx(…)’, ‘exUpdateStrEx(…)’ and

‘exUpdateVarEx(…)’ it is possible to write a value to an IO device. These functions are available both on worksheets as in

VBA.

When these functions are used on a worksheet they will be executed on all servers and clients, causing each server and client to write the data to the specific IO device. To restrict the

64 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

writing to the duty server the following statement can be used for worksheet writes:

Stand-alone usage:

=exUpdateEx( iQuery, iItem, dValue, UpdateMode )

Client/server; only write on duty server:

=IF(Net.Local.IsDutyServer, exUpdateEx( iQuery, iItem, dValue, UpdateMode ), FALSE)

In VBA the function exUpdateForce is available and commonly to write values to an external device. This function is not available on worksheets.

9.6.6 Synchronized parameters

The ‘exStoreValue(…)’ worksheet function serves a dual role in client/server systems. Not only is it responsible for retentive storage of parameters to the local registry, it also synchronizes parameters between clients and servers.

Parameters are initialized on startup with the value last stored in the registry of the duty server:

Server 1 Client 1

9.6.7 Shared values

Shared values are synchronized values which are shared by all clients and servers in a system. They can be read/written conditionally from worksheets and Visual Basic. When compared to synchronized parameters, they have the following different characteristics:

 Synchronized parameters are always written; Shared values are only written when the write-condition is ‘True’, otherwise they are read.

 Synchronized parameters are retentive; Shared values are not retentive.

Much like a synchronized parameters, a shared value is also identified by a unique name (e.g. “MySharedValue”). No functions are required to register the unique shared value name. Instead, the name is implicitly registered by the shared value functions.

The following example shows the use of shared values on worksheets. Assume that cell ‘L30’ contains a calculated value, which is different on all computers. The

‘exShareValue(…)’ worksheet function can be used to write that specific value on a specific system after which it can be read on all others. exStoreValue(

MyParam,

“MyParam”,

xRegKey & "\AutoLoad",

,,,,

xAutoRecalc )

A new parameter value is entered on “Server 1”:

The parameter value on all other servers/clients is automatically updated.

Figure 9-13: Shared value worksheet function

The second-argument, which is the ‘write-condition’, compares the current computer with a specific computername. This will only evaluate to ‘True’ on computer ‘SVC-1’.

The return-value of the function is the shared value. On ‘SVC-

1’, this will be always the same as value as cell ‘L30’, on all other computers this will be the ‘L30’ cell as written by ‘SVC-

1’.

The following example illustrates this mechanism using

‘Net.Local.IsDutyServer’ as the write-condition:

SVC-1

SVC-2

Fig. 9.12 Synchronized parameters

Parameters can be modified on both clients and servers, after which the changed parameter is distributed to all other clients and servers.

When using the ‘exStoreValue(…)’ worksheet function in client/server systems it is essential that the ‘Trigger’ argument contains the value ‘xAutoRecalc’. If this is not the case, it is possible that the parameter is not correctly initialized and thus no synchronization will happen. exShareValue(

“MySharedValue”,

Net.Local.IsDutyServer,

L30, xNow.Time)

Fig. 9.14 Shared value on multiple computers eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 65

Shared values can also be used from VBA. The following Visual

Basic functions are supported for reading and writing shared values: ‘exGetSharedValue(…)’ and

‘exUpdateSharedValue(…)’. The following example illustrates the use of these functions:

' Write shared value on duty server and read on others

If Net.exIsDutyServer Then

Net.exUpdateSharedValue “MySharedValue1”, strValue

Else

Net.exGetSharedValue “MySharedValue1”, strValue

End If

66 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

10 Redundancy

In this chapter, you will learn how to add redundancy support to your application.

10.1 Introduction eXLerate has an extensive support for redundancy. This allows you to build fail safe systems. Since “A chain is only as strong as its weakest link”, all supported levels of redundancy can be extended with multiple backups. For instance, if 2 network cards don’t provide enough redundancy, additional network cards can be added in a breeze.

In a typical system, four hardware levels are subject to redundancy:

 Device redundancy

In case a device fails (e.g. flow computer, PLC); a backup device may take its role. Although eXLerate cannot play an active role in this scenario, it will have to interface with these devices.

These devices will have a communication channel to the eXLerate server so all data is available. eXLerate can be configured to choose the data of a preferred device or it can calculate its own values based on the data received by multiple devices. Data of such devices may be stored in a single tag in the database using multiple columns.

 Device communication channel redundancy

Some devices support redundant communication channels. This makes the device less vulnerable to broken cables, electrical problems, etc… eXLerate can be configured to take full advantage of this device feature. The application engineer is in full control over the flow of data. Whether the redundant communication channel is only used in the event of a failure, or used for continuous communication, it’s all possible. If the communication protocol supports it, the data-flow can also be divided over multiple communication channels to increase overall bandwidth (e.g. load-balancing).

 Server redundancy

To protect against a server failure, one or more backup servers may be configured. All servers in an eXLerate environment are identical. A duty/standby concept is used to distinguish between the servers. Only one server is the “duty” server, the others are considered “standby”. If the “duty” server fails, a standby server will take on the roll of “duty” server. The standby server(s) continuously synchronize all the data from the duty-server such as reports, averages, database, etc… These synchronized servers allow for bumpless switchovers without any hiccups.

Additionally, standby servers can also be used as IO servers. If the “duty” server has a communication problem with a device, it can be configured to use the IO channel of a standby server, which is called

IO routing

. This is all possible without having to switch to another “duty” server.

 Network redundancy

Clients and servers may be equipped with multiple network cards in order to communicate over a single or multiple networks. The configuration involves merely specifying the IP address of the network card. The rest is handled transparently by eXLerate.

10.2 Device redundancy

10.2.1 Introduction

In case a device fails (e.g. flow computer, PLC), a backup device may take its role. Although eXLerate cannot play an active role in this scenario, it will have to interface with these devices. These devices will have a communication channel to the eXLerate server so all data is available. eXLerate can be configured to choose the data of a preferred device or it can calculate its own values based on the data received by multiple devices.

10.2.2 Configuration

Please refer to Reference Manual I, Chapter 6 – Data

Communications on how to configure communications.

When configuring multiple redundant devices, each device has its own set of protocols and queries. In the tag database, there is however only a single row per redundant IO point:

Fig. 10.1 Tag Database with redundant IO eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 67

The ‘Value’ column represents the in-use data point. ‘Value2’ and ‘Value3’ represent the actual data received by two redundant devices. Additional devices can simply be added by adding new columns to the Tag Database.

The ‘Query Table’ also needs to be modified so that the tags are written to the proper column in the Tag Database:

10.3 Device communication channel redundancy

10.3.1 Introduction

Some devices support redundant communication channels.

This makes the device less vulnerable to broken cables, electrical problems, etc… eXLerate can be configured to take full advantage of this device feature. The application engineer is in full control over the flow of data.

Two typical scenarios can be distinguished which are discussed in the following sections.

First redundant device writes to column 8

(Value2) in xTagDB

Second redundant device writes to column 9

(Value3) in xTagDB

Figure 10-2: Query Tables write to multiple columns in Tag DB

The in use IO point (Value) can be determined using a formula.

The application engineer is left free in his/her choice of this formula. For instance, a device may report whether it is the master- or slave device. In that case the following formula may be used:

“Calc.FC01.Master” contains the ‘master’ status of the device.

If the first device is master; the first column is used, otherwise the second column is used.

If desired, it is also possible to calculate the average value of both devices:

This would however not work if one device failed. In that case the average should only be calculated if both devices are valid.

In all other cases, the valid device should be used:

10.3.2 Multiple active communication channels

In this setup, all communication channels of a device may be configured as separate protocols. This will cause all data to be transported over all redundant communication channels. eXLerate can be configured to select from one of the incoming sets of data. This setup puts however more strain on the server and IO device because it effectively doubles the number of IO communication points.

This setup is very straightforward because each communication channel is configured as a separate device.

Please refer to “Device redundancy” on how to configure this type of redundancy.

10.3.3 Single active communication channel

This setup uses only one active communication channel per device. The redundant communication channels are used only when the active communication fails. This setup puts much less strain on the system and device while providing the same level of redundancy as

“Multiple active communication channels”

.

For each communication channels (e.g. COM port) a separate protocol needs to be configured:

68 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

Fig. 10.3 Primary and secondary protocols

The primary protocol should have all the communication queries configured. The secondary protocol should only

contain a ‘validation’ query which is necessary for checking the availability of the line: configured ‘Device’ column of the protocol table, or to an alternate device:

Protocol ID

Fig. 10.4 Primary and secondary protocol queryes

The final and most complicated step is to configure the device switching mechanism. This mechanism should behave in the following manner:

Whenever the primary protocol looses its connection, it should check the status of the secondary protocol. If the status is OK, the primary protocol should switch to the device in use by the secondary protocol (e.g. COM12). Alternatively, the secondary protocol should switch to the device previously in use by the primary protocol, so it can monitor the status of that device.

Basically, the protocols exchange devices in such a fashion that the primary protocol always uses the first valid device. In the following example, assume that the primary protocol is using device COM11 and the secondary protocol is using

COM12. COM11 is part of Port Server 1, and COM12 is part of

Port Server 2. If Port Server 1 fails, COM11 will also fail:

Primary protocol stops receiving/sending data.

Secondary protocol still receives/sends data.

Fig. 10.5 Primary protocol device failure

Cell containing device index to select:

0 = no device (disabled)

1 = primary device

2..n = alternate device

Fig. 10.8 Protocol device selection

The end result would be the following protocol table with 3 additional columns on the end:

Fig. 10.9 Protocol table with device selection

When looked at in detail, the new columns contain the following worksheet functions:

=exSetAlternateDevice(

1,

2,

"COM12:19200,n,8,1", xNow.Time )

Fig. 10.10 Device selection columns

Device index, written by VBA.

=exSelectDevice(

1,

AE4, xAutoRecalc )

The primary and secondary protocols should now swap their devices:

Fig. 10.6 Swapping protocol devices

Since the protocol table is static, swapping the devices cannot be done by writing a new value into the device column.

Instead, two worksheet functions are available for this purpose.

The ‘exSetAlternateDevice(…)’ worksheet function can be used to add ‘alternate’ devices to a protocol:

Protocol ID

Alternate device index

Alternate device

Fig. 10.7 Alternate protocol device

The device index needs to be written from VBA. It is impossible to do this using worksheet functions because it will always result in a circular reference. The resulting VBA code needs to be periodically executed. A good place to do this is the

‘OnEvent(…)’ event handler defined in the ‘modEvents’ module:

Public Sub OnEvent(iEventID As Integer, strPeriodName As String, iPeriod As Long)

Select Case iEventID

' 5 seconds timer

Case 3:

'Check redundant communication lines

CheckComPorts

End Select

Exit Sub

Fig. 10.11 Protocol device selection periodic handler

Secondly, the ‘exSelectDevice(…)’ worksheet function can be used to switch a protocol to either its primary device, which is

The determination of the selected device index is best explained using the following Visual Basic code: eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 69

Sub CheckComPorts

‘ Local data

Dim iCurrentPrimaryDevIndex As Integer

Dim iNewPrimaryDevIndex As Integer

‘ Read currently selected device index from worksheet

iCurrentPrimaryDevIndex =

Range(“xComms!AI4”).Value

iNewPrimaryDevIndex = iCurrentPrimaryDevIndex

‘ Check primary protocol status

If Range(“xProtocol.1.Status”).Value = 0

Then

‘ Status ok, no need for switching

Else

‘ Status not ok, determine whether to switch or not

‘ Only switch if secondary status is Ok

If Range(“xProtocol.2.Status”).Value = 0

Then

‘ Swap devices

If iCurrentPrimaryDevIndex = 1 Then

iNewPrimaryDevIndex = 2

Else

iNewPrimaryDevIndex = 1

End If

End If

End If

‘ Write new device index to worksheet

If iCurrentPrimaryDevIndex <> iNewPrimaryDevIndex Then

‘ Switch primary protocol to other device

Range(“xComms!AI4”).Value = iNewPrimaryDevIndex

‘ Switch secondary protocol to other device

Range(“xComms!AI5”).Value = iNewPrimaryDevIndex

End If

End Sub

Figure 10-12: Protocol device selection code

10.4 Server redundancy

10.4.1 Introduction eXLerate supports fully synchronized servers. This means that standby servers continuously update themselves with the data stored/calculated on the duty server. This also means that standby servers do not: generate reports, calculate totals/averages, etc… Instead, they copy the data from the duty server when it becomes available. This allows eXLerate to perform “bump less” transitions when switching from one duty server to another.

In a nutshell, an eXLerate standby server is always identical to the duty-server. When the duty server fails, the standby server can immediately take over and ensure data consistency since it was identical to the duty server. When the failed server comes back online, it will synchronize itself with the duty server and take its role as a standby server. The big advantage of fully synchronized servers is data integrity. If for instance, two servers would calculate a time-weighted average, it would be nearly impossible for them to come up with exactly the same result. Both values would be correct, but they would still be marginally different. If in such a case a duty switch would occur; all calculated data would be overwritten by the results of the new duty server, which is undesirable.

No additional configuration is required for multiple servers as opposed to a single server. The application can however be developed in such a way that it performs specific tasks only on the duty server (or a standby server if desirable).

10.4.2 Duty selection

The duty selection consists of a set of priorities on the ‘xNet’ worksheet:

Fig. 10.13 Duty selection

The selection is done in a “first served” fashion. If a server detects that another server is already duty, it will respect the other server and will not become duty itself. If no server is duty, the server who’s “Startup wait-time” expires first, will automatically become duty.

It is therefore essential that the “Startup wait-time” of the servers is at least 10 seconds apart. Assume there is a power-

70 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

drop and all servers are shutdown. When the power comes back online all the servers are turned on at the same time. To prevent multiple servers from becoming duty (even though it is just for a short time) at the same time, the “Startup wait-time” has to be at least 10 seconds apart.

Local duty status

Each server (and client) has its own local duty status which is communicated to all other servers and clients in the system.

Therefore, each server and client knows the local duty status of all the others. The local duty status of a particular server can be viewed in the server section of the ‘xNet’ worksheet:

The following figure shows a scenario with 2 points of failures which are not mutually exclusive:

Fig. 10.15 IO routing

Fig. 10.14 Local Duty status

This local duty status is used to determine whether a different server is already the duty server. In that case the other servers respect the duty status and won’t become duty themselves.

Manual duty switching

It is also possible to manually switch to another duty server using the ‘exDutySwitch(…)’ VBA function which is part of the

‘wksNet’ module. This function can be called from either a client or a server. It forces all servers into a temporary duty status. By default, the time is 10 seconds but this can be changed in the ‘Advanced’ section of the ‘xNet’ worksheet.

This period is required to ensure that all servers receive the new duty selection properly. During this time, the server cannot automatically switch to another duty. After the time has expired, the servers remain in the new duty selection.

Custom duty selection

Since the duty selection is part of a worksheet, it can be customized to the fullest extent. The ‘xNet’ worksheet is provided as a tool to make life easier, but it is not intended to force anyone to use it. Other duty selection strategies may be considered. For instance, an external device may be used which determines who will be duty.

IO routing

In client/server systems, eXLerate uses the IO on the duty server by default. This means that all non-duty computers

(clients & standby servers) read and write IO through the duty server. If however, the duty loses communication with a device, a duty switch would be required to restore communication. If this newly selected server also has a communication problem, the system would be crippled. If both servers have the same problem (e.g. No communication with a particular modbus device), then there is no way to work around this problem. However, if the servers have different problems (Server 1 can’t communicate with device 3; Server 2 can’t communicate with device 5) the system availability is not necessarily in danger. eXLerate supports a mechanism which can re-route IO communication from the duty server to any other server.

By default all IO is handled by the duty server, but since the duty lost its connection with FC1 (Failure 1), that IO is being re-routed through the standby server. Failure 2 has no effect on the system availability because it exists only on the standby server.

IO routing is possible at the query level as opposed to protocol level. In some scenarios, multiple devices are attached to a single protocol. For instance, RS-485 multi-drop systems support such architecture. Every communication query is therefore re-routable.

Two worksheet functions are available for query routing. The function ‘exQueryStatus(…)’ can be used to monitor the status of a query on a particular server. The function

‘exQueryServer(…)’ function can be used to re-route the query to a particular server. When the function ‘exQueryServer(…)’ is omitted, eXLerate assumes that the query should be routed through the duty server. This is the default behavior and if no query routing is necessary, no additional configuration work is required.

The following figure shows a Query table with 4 additional columns which implements the routing mechanism. An example of this is provided in the ‘MyNet’ sample application:

Fig. 10.16 Query table with routing support

The additional columns contain the following formulas:

=exQueryStatus(

<Query ID>,

<Server ID>,

<Trigger> )

Fig. 10.17 Query table routing columns

=exQueryServer(

<Query ID>,

<Server ID>,

<Trigger> )

=<routing formula>

(see below) eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 71

The routing formula implements the actual routing behavior.

The following example shows a formula which uses the duty server as the primary route and the standby server as the backup route. If no duty server is selected, it will always use the local IO:

Fig. 10.18 Query table routing formula

In pseudo code the formula would look like this:

‘ If no duty server is selected

If( Net.Duty.ID = 0 ) Then

‘ Then always use the local IO

result = 0

Else

‘ Is server 1 duty? and it is communicating

OK?

If( Net.Duty.ID = 1 And Query.Status.Server1

= 0 )

‘ Yes it is, lets route the query through that server

result = 1

Else

‘ Is server 2 duty? and is it communicating OK?

If( Net.Duty.ID = 2 And

Query.Status.Server2 = 0 )

‘ Yes it is, lets route the query through that server

result = 2

Else

‘ No valid query found, use local IO instead

result = 0

End If

End If

End If

Fig. 10.19 Query table routing formula pseudo code

10.5 Network redundancy

10.5.1 Introduction

Clients and servers may be equipped with multiple network cards in order to communicate over multiple networks. The configuration involves merely specifying the IP address of the network card. The rest is handled transparently by eXLerate.

Please refer to the previous chapter on how to configure a client or server with multiple IP addresses.

Fig. 10.20 Network redundancy

10.5.2 Network considerations

When using multiple network cards there are some considerations to be made. For instance, should both network cards be in the same IP range? Typically two network architectures can be distinguished:

Redundant network cards on a single network

Fig. 10.21 Redundant network cards on a single network

This setup provides redundancy in the form multiple network cards. If a network card fails, the other network card can take over. However if the switch or router fails, all communication fails as well.

In this setup, all network cards can be either in the same network range or in 2 separate ranges.

If the communication between the servers is completely lost, both servers will become duty because they both think the other server has failed. This behavior is inevitable and can only be prevented by using separate networks.

Redundant network cards on separate networks

72 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

Fig. 10.22 Redundant network cards on separate networks

This setup provides redundancy in the form of multiple network cards and routers/switches. If a network card of router/switch fails, the backup may be used to resume communication.

In this setup, the redundant network cards need to be on separate IP ranges. For instance, NCA-1 should use IP address 10.0.0.1 and NCB-1 should use 10.0.0.2. NCA-2 and

NCB-2 should be in a non-conflicting IP range such as

(192.168.0.1 & 192.168.0.2). eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 73

11 Multiple languages

In this chapter, you will learn how to add multi-lingual support to your application.

11.1 Introduction

Microsoft Excel already supports multiple languages natively. eXLerate however takes this support for multiple languages to the next level.

This chapter will describe how to implement multi-lingual support into applications and how to setup Microsoft Windows for use with these multiple languages.

When using East-Asian languages make sure that the

Supplemental language support is installed before installing the language packs:

eXLerate

Setup Microsoft Windows to use multiple languages

The first step in using multiple languages is to setup Microsoft

Windows correctly. Dependant on the installed version of

Windows, additional languages need to be installed.

It is not necessary to have a localized version of Windows installed (e.g. German, Russian, etc…). Instead, any version

(e.g. English) of Windows will do. The localized versions of

Windows additionally translate texts such as: Start-Menu,

Control Panel, Print dialogs, etc… into a specific language. eXLerate does require that additional language packs are installed. These language packs can be installed from the

Regional and Language Option

option in the Control Panel.

Figure 11-2: Supplemental language support

The language packs can be installed from the ‘Advanced’ tab on the ‘Regional and Language Options’ dialog:

Fig. 11.1 Regional and language options

Fig. 11.3 Installing language packs

Choose the language that you want using the ‘Language for non-Unicode programs’ option. In case of multiple foreign

74 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

languages (e.g. Chinese and Russian), the language with the code-page containing the characters for both languages should be selected. For instance, the Russian code-page does not include any Chinese characters, but the Chinese codepage does include Russian characters. The code-pages supported by Windows can be found at the Microsoft website

(http://www.microsoft.com/globaldev/reference/WinCP.mspx).

These code-pages are divided into character sets (e.g. Latin,

Cyrillic, Arabic, etc…). Russian for instance, uses the Cyrillic character set. So when selecting ‘Russian’ or any other Cyrillic language, only the characters in that code-page will be supported. The English characters are supported in all codepages, so whichever language is selected, English will always work.

After having selected a different language, Windows may or may not prompt with the following message. Select ‘Yes’ if the message is shown:

Fig. 11.4 Skip file copying during language pack install

11.2 Application support eXLerate supports multiple languages through a worksheet called ‘xLanguage’. This worksheet is a special case in that it does not contain any worksheet functions. eXLerate recognizes the worksheet by its name, so it is therefore essential that the worksheet is called ‘xLanguage’. The layout of this worksheet is also fixed, but can nevertheless be extended with additional languages and custom texts.

Fig. 11.6 Multi -ingual worksheet ‘xLanguage’

11.2.1 Adding multi-lingual support

There are two ways to add multi-linguage support to an application. The easiest way is to copy the ‘xLanguage’ worksheet from a sample application such as ‘MyTemplate’. It is also possible to let the Language wizard generate a fresh

‘xLanguage’ worksheet:

After a new language has been installed the computer needs to be restarted:

Fig. 11.5 Restart computer after installing language pack Fig. 11.7 Creating a new language

When ‘Run’ is pressed, the ‘xLanguage’ worksheet is automatically created:

Fig. 11.8 Language wizard ourput

The newly created worksheet will however have no default formatting, so this will have to be applied manually:

Fig. 11.9 Language worksheet without formatting eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 75

11.2.2 Language worksheet layout

The layout of the ‘xLanguage’ worksheet is as follows:

Class Language Key

Header

Class

Fig. 11.10 Language worksheet layout

Default text

(English)

Additional languages

Multi Lingual texts

The first three columns are fixed. Each column that follows and has a non-empty value in row 1 is considered an additional language. The country flags ( ) are merely informational and have no functional purpose. The first two rows are also fixed.

Generally speaking, each language consists of its own column in the language worksheet. A row on the other hand can be either a class row:

Or a language row:

After that, the actual language texts need to be specified. In case a text is not filled in, the text from the “Default” column will be used. eXLerate is outfitted with a set of default languages which can be easily copied into the language worksheet. If your desired language is not included, please contact your eXLerate supplier. These languages are placed in the ‘Languages.xls’ file which is stored in the application directory (e.g.

C:\XLR\Languages.xls’). The following steps show how to copy a language into your application. These steps assume that your eXLerate application is open and in design mode:

Open the ‘Languages.xls’ file:

Fig. 11.12 Opening the ‘Language.xls’ file

A class rows starts with a text in the first column identifying the class to which the succeeding language rows belong. The language worksheet always starts with the ‘System’ class and succeeding language rows.

Language keys usually consist of several words separated by

‘\’ characters (e.g. “Alarms\Dialogs\Suppress\NoValidRow”).

This syntax is not obligatory but it is recommended because it improves readability and extensibility. All the keys in the

‘System’ class are fixed and cannot be changed.

Some language texts support dynamic keywords which are replaced by specific values when the text is displayed. For instance, the language key

“Alarms\Dialogs\Suppress\SuppressGroup” supports the keyword ‘%GROUP%’, which when displayed is replaced by the actual name of the alarm group.

11.2.3 Adding languages

Languages can be easily added to the application by creating a new column in the language worksheet and giving it the name of the language:

Select the worksheet containing the desired language:

Fig. 11.13 Select desired language

Select the column containing the language and copy it to the clipboard:

Fig. 11.14 Select language column

Go back to the original application and select the ‘xLanguage’ worksheet:

Fig. 11.15 Select ‘xLanguage’ worksheet

Select the first empty column:

Fig. 11.11 Adding languages

Fig. 11.16 Locate first empty column in language worksheet

76 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

Use ‘Paste’ to add the language to the worksheet. The endresult is a language worksheet with the desired language:

Fig. 11.17 Succesfully added language

After any modifications to the language worksheet, use “Apply

Worksheet Changes” before testing the new language:

After any modifications to the language worksheet, “Apply

Worksheet Changes” should be used before testing the modifications.

11.2.5 Multi-lingual tag database

The Tag database supports multi-language texts for its tag descriptions and alarm descriptions. These additional language texts can be added to the Tag Database directly and don’t have to be configured through the ‘xLanguage’ worksheet. To add multi-lingual descriptions to the Tag database, insert a column into the Tag database after the “Description” column:

Fig. 11.18 Use ‘Apply Worksheet Changes’ after adding a language

Fig. 11.22 Insert column into the Tag database

11.2.4 Adding user defined texts

By default, the language worksheet contains only ‘System’ texts. These texts are used for dialogs, log texts, notifications, etc… which are generated by eXLerate rather than the application. It is also possible to extend the language worksheet with user defined texts, which can be used in worksheets and VBA. User defined texts must always start with a new class:

Rename the column into “Description_<Language>”. The

“<Language>” section should be replaced by the name of the language (e.g. “Dutch”, “Russian”, “Chinese”):

Fig. 11.19 User defined texts in Language worksheet eXLerate will interpret all user defined texts until two or more empty rows are encountered:

Two empty rows causes eXLerate to stop processing any further user defined texts.

Fig. 11-20: User defined texts are terminated by two or more empty rows

Tip: After adding user defined texts, the ‘Sort’ option can be used to quickly sort keys within a group:

Fig. 11.23 Rename column to proper language

If the currently selected language is “Russian”, the tag descriptions from the column “Description_Russian” will be used for event logging and displaying. The column

“Description” is used if the selected language is not explicitly configured or “Default” is selected.

The same mechanism applies to alarm descriptions. If alarm descriptions are explicitly configured using the “AlarmDesc” column, the additional languages can be added by adding new columns and appending the “_<Language>” postfix (e.g.

“AlarmDesc_Russian”, “AlarmDesc_Dutch”).

11.2.6 Multi-lingual buttons

The Button table does not use the ‘xLanguage’ worksheet for its button texts. Instead, it uses the CHOOSE(…) function to select from multiple columns containing language texts.

Fig. 11.24 Multi-lingual button table

Fig. 11.21 Sorting user defined texts eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 77

In the example above, columns I and J contain the texts for the

English (Default) and Dutch language. Column C uses the

CHOOSE(…) function to select from one of those languages:

Fig. 11.28 Linking a control to a cell or name

Fig. 11.25 Choosing a multi-lingual button text

The ‘xLangIndex’ -name contains the 1-based index of the currently selected language. This index is automatically updated whenever a new language is selected.

For this mechanism to work properly, the order of the language-columns in the Button Table should be identical to the order of language columns in the ‘xLanguage’ worksheet. If this is not the case, the indexes will be different and the wrong language text will be selected.

After a new language is selected, the actual texts on the buttons should be updated. The ‘exSetButtonText(…)’ Visual

Basic function can be used to update the texts on all the buttons from the Button Table:

Sub SelectLanguage_Dutch()

Range("xLangSelection").Value = "Dutch"

exSetButtonText

End Sub

Fig. 11.26 Selecting a new language

11.2.7 Multi-lingual worksheets

Worksheets can be extended with multi-lingual support via the

‘exLanguageText(…)’ worksheet function. This worksheet function returns the text associated with a Language Key in the currently selected language. If the text is not available in the currently selected language, the default text is returned. The

‘Legend’ worksheet of the ‘MyProject’ application contains working examples of this feature.

Since it is not possible to enter the ‘exLanguageText(…)’ function directly into the formula, an additional reference is required. An easy way is to use a cell on a non-visible part of the worksheet and then refer to it from the control. This cell should contain the ‘exLanguageText(…)’ function:

(Cell Z36)

=exLanguageText(

“Legend\Coriolis”, xLangRecalc )

Fig. 11.29 Language text referenced by a control

11.2.8 Multi lingual VBA code and forms

Forms and VBA code can be extended with multi-lingual support using the ‘exLanguageText(…)’ Visual Basic function.

This worksheet function returns the text associated with a

Language Key in the currently selected language. If the text is not available in the currently selected language, the default text is returned. This function is identical in functionality to the worksheet function ‘exLanguageText(…)’ except that is does not have the trigger-argument.

The following example illustrates the use of the

‘exLanguageText(…)’ to show a multi-lingual message box.

‘ Ask user to open the valve or not? strPrompt = exLanguageText(

“Messages\OpenValve” ) iRes = exMsgBox( strPrompt, vbYesNo,

“eXLerate” )

Default (English) Dutch

Fig. 11.27 ‘exLanguageText’ worksheet function

Figure 11-30: Multi-lingual VBA code

The following example shows the result of the

‘exLanguageText(…)’ worksheet function:

Default (English) Dutch

The function uses the trigger ‘xLangRecalc’ which causes the function to be re-calculated every time a different language is selected.

In case of group- and text boxes an additional step is required.

The text of a control can be linked to a name or a cell by pressing ‘F2’ while the control is selected:

When a form is activated, the texts on the form are dynamically filed in with the currently selected language. The following example illustrates the use of ‘exLanguageText(…)’ to fill in the text upon form activation. The ‘frmReports’ user-form in the

‘MyProject’ application contains the following working example:

Private Sub UserForm_Activate()

'Set multi-lingual texts

Caption = exLanguageText("Dialogs\Reports\Caption")

frmFrame.Caption = exLanguageText("Dialogs\Reports\Select")

78 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

btnMonthly.Caption = _ exLanguageText("Dialogs\Reports\PrintMonthlyRe ports")

btnDaily.Caption = _ exLanguageText("Dialogs\Reports\PrintDailyRepo rts")

Figure 11-31: Multi-lingual user form

11.2.9 Language selection

The currently selected language can be read/written using the

‘xLangSelection’ name. This name is part of the ‘xWizard’ worksheet. If the name is not available, run the ‘Tag & Object wizard’ to create the name. To display the currently selected language on a worksheet, the following formula can be used:

Figure 11-32: Obtain currently selected language

To select a language, the name of the language needs to be written to the ‘xLangSelection’ name:

Sub SelectLanguage_Russian()

Range("xLangSelection").Value = "Russian"

exSetButtonText

End Sub

Fig. 11.33 Selecting a new language

Fig. 11.35 Assign language selection macro to picture

In order to make the selection possible from a worksheet, a button or picture can be used:

Picture object

Fig. 11.34 Language selection buttons/pictures

This button or picture should be assigned to the language selection macro: eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 79

12 Terminal services

12.1 Introduction

Terminal Services, also known as “Remote Desktop Services”, offers the ability to view and manage an eXLerate system remotely using one or more remote desktop sessions (RDP).

With Remote Desktop, the eXLerate program runs on the

Server, but is visible on a Client computer. This gives the benefit that you do not need to install any software on your

Client computer in order to view or manage the eXLerate system.

The following overview gives an example of a terminal services setup:

12.2.3 eXLerate license

In order to use eXLerate in combination with Terminal Services, a license option is required. Please make sure you have purchased the ‘eXLerate Terminal Services’ license-option prior to configuring Terminal Services with eXLerate.

12.3 Configuration

Using eXLerate in combination with Terminal Services requires configuration at both the Operating System level and the eXLerate level.

12.3.1 Operating system

In order to setup Microsoft Windows to use Terminal Services, make sure the following requirements are met. It is outside the scope of this document to describe these steps in detail, please consult the Internet if you need information about a particular topic.

# Step

1

Install ‘Remote Desktop Services’ role on Windows Server.

2

Purchase and install ‘RDS CALs’ for the users or computers which are to connect to the server.

3 Set the remote desktop services setting ‘Restrict each user to a single session’ to ‘No’.

4 Create a Windows User called ‘eXLerate_Remote’ and give it

‘Administrator’ rights.

Table 12.2: Operating System Configuration

Fig. 12.1 Terminal Services Setup

12.2 Requirements

In order to use the eXLerate Terminal Services, the following software and licenses are required.

12.2.1 Operating system eXLerate Terminal Services Mode can be used with any supported version of Microsoft Windows. The Desktop operating systems Windows 7, Windows 8, Windows 8.1 and

Windows 10, however only support 1 simultaneous remote desktop connection and are therefore not suited for running multiple remote desktop instances. In order to do this, you need either Windows Server 2008 R2 or Windows Server

2012 or Windows Server 2012 R2 with the Terminal

Services Role enabled and the appropriate licenses (TS

CAL’s).

12.2.2 Microsoft office

All supported Microsoft Office versions can be used in combination with Terminal Services. The licensing is however different for these versions.

Office Editions & Licenses

Office 2016 In order to use Office 2016 or Office 2013 or Office 2010

Office 2013

Office 2010 in combination with Terminal Services you need a

Volume License. (http://www.microsoft.com/licensing)

Table 12.1 Required Microsoft Office licenses for Terminal Services

12.3.2 eXLerate

Now that Windows is configured correctly, setup the user

‘eXLerate_Remote’ so that it automatically starts eXLerate and launches the appropriate application

(see eXLerate Reference

Manual Volume I).

In the eXLerate Control Center, select the ‘Enable Terminal

Services Mode’ option from the ‘Options’ dialog:

When this option is enabled, every eXLerate application that is started on the system runs in ‘Terminal Services Client Mode’.

Using this mode, a single application shortcut may be started multiple times (one in each terminal services session) on the same computer.

Terminal Services on a Duty/Standby/Standalone server

You may run a separate server for Terminal Services Clients, but you may also combine a Duty/Standby server, or a

Standalone system with Terminal Services support. In this case you can use the ‘Run first login of the current user as a regular eXLerate session’ option to ensure that your first launched session runs as a regular eXLerate session (i.e. eXLerate

Server Mode or eXLerate Standalone Mode).

80 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

Client/Server support

In order to use Terminal Services, your application needs to contain client/server support. In short this means that it requires a ‘xNet’ sheet and the server table should contain the names and IP-addresses of the server(s) you which to connect

to. Please read

9 Servers, clients

& on how to add

client/server support to your application.

12.4 Using terminal services

After Terminal Services is correctly configured you can start using it. To remotely access the eXLerate Terminal Services system, start the ‘Remote Desktop Client’. You can find the remote desktop client by typing “remote desktop” in the search-bar of the Windows 7 start-menu:

Fig. 12.2 Locating the remote desktop client

After pressing ‘Enter’ the ‘Remote desktop connection’ window appears:

Fig. 12.3 Remote Desktop Connection Window

After you click ‘Connect’ it will connect to the eXLerate

Terminal Services system. By default the size of the desktop will be adjusted to the screen resolution of the client computer.

The eXLerate application may however have been developed for a specific resolution. To open a remote desktop connection with a specific screen resolution you can use the following command-line: mstsc /v:<IP-address/host> /w:<width>

/h:<height>

Example: mstsc /v:10.0.0.105 /w:1680 /h:1050 eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 81

13 Troubleshooting

13.1 Introduction

This chapter is meant for troubleshooting of not-so-trivial problems that an application developer may run into.

Trivial problems in this context are issues like: ‘why doesn’t the animation of my shape work ass I expected?’ or ‘Why is the outcome of my calculations not correct?’ You will not find answers on such questions in this section, or any section for that matter.

The types of problems you may run during application development into are perhaps far more diverse and complex than can ever be solved for you in this “cookbook” style chapter. Fortunately, you have an excellent development tool with Excel to dig into such issues. If you need assistance in application development/engineering you might consider obtaining external help.

Defensive programming is a good remedy against getting problems in the first place. This manual is not a learning book for defensive programming, but the instructions in this reference manual should help you out to solve the problems discussed below.

There are problems known while working with Excel; try the internet and you will find such issues, although Microsoft has solved all issues in the specified Excel versions that are needed for eXLerate to operate correctly, reliably, and stable.

If you have some doubt in working with Excel in an industrial environment, you should be reassured because of the fact that today a myriad of applications throughout the world are running in harsh industrial environments for 24 hours per day,

365 days per year with only a minimum system administration or maintenance requirements. Excel and other Office components are by its millions of user a very well tested application suite!

If you might need further help, please contact your local distributor or Spirit

IT

at ([email protected]).

13.2 Real-time data communications problems

One of the most challenging issues during application development are problems encountered with real-time data communications.

Unfortunately it is not possible to predict what the solution would be in your case. Please notice the following remarks about data-communication issues:

 You should preferably have Spirit

IT confirm your communication requirements prior to purchasing eXLerate to make sure that your requirements can be properly dealt with.

 There is a low-level debugging tool built-in in eXLerate, the

data-scope

, with which you are able to see data-messages back and forth. Utilize the data-scope, and carefully examine messages and associated replies from external devices.

 There are various communication samples available that are ready-to-run, and may be of help for your situation. Please open the workbook samples, and take a look if these samples indeed solve your problems.

 In many cases, the available parameters in the

Protocol

Table

and

Query Table

are not correctly setup for the job.

Carefully examine the requirements for your external devices, and check the corresponding functionality in the example drivers of eXLerate and the documentation.

 If you still doubt the fact that the available communication drivers in eXLerate are equipped for the job that you have in mind, you should contact Spirit

IT

, or your local distributor directly to discuss your special requirements.

 Spirit

IT offers help to novice users in training courses, and in various maintenance and support programs. If required, onsite technical support is further possible. Check your price list for the available options.

82 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

13.3 Worksheet functions are excessively called

In Excel, worksheets are recalculated as efficient as possible to optimize system performance.

Due to the resulting behavior of these advanced recalculation optimizations and associated strategy in Excel, parameters to

VBA functions should be entered as

expressions

rather than single parameters.

When parameters are directly passed without being expressions, the worksheet functions may and will be called multiple times in a single recalculation cycle, with null arguments rather than the actually supplied arguments.

In its simplest form, an expression constructed with argument

iArgument

is ‘

iArgument+0

’.

A simple expression for a string argument would be

strArgument & “”

’ or equivalent.

Such expressions are sufficient to avoid multiple ‘idle’ recalculations.

These expressions for arguments are applicable especially in user-defined VBA functions, such as functions

GetxxxIndex(…)

in module

modRange

.

Example:

=MyFunction($A$1,$B$2,$C$3, 2)

Fig. 13.1 Example of a VB function causing excessive calling

Instead, the function should be called as follows:

=MyFunction($A$1+0,$B$2+0,$C$3+0, 2)

Fig. 13.2 Example of a correct VB function avoiding excessive calling

13.4 The application does not start up properly

When installing a new version of eXLerate, where your existing applications should be running with, occasionally, existing applications do not start up properly. This problem may occur due to a library version issue in Microsoft Excel. All you have to do is to change the existing reference to the eXLerate ActiveX

DLL, in a quick procedure as described below.

The complete procedure is done in less than 10 seconds.

In most cases, Windows automatically recognizes the new library, in which case your existing applications will run without any problems.

If this is not the case however, you will have started your application in the Control Center, and after the startup command (Runtime or Design), nothing happens. If this is the case, then follow the steps below:

Step 1

Minimize the main window of the control center.

Minimize the Control Center when your application does not start up properly.

Visual Basic for Applications is stopped at the first command it does not recognize. You can quickly switch to the VBA environment using the F11 key. Most likely this is in the

Workbook_Open() built-in macro. VBA highlights both the procedure and the offending statement.

Step 2

Stop Visual Basic for Applications by clicking on the VBA toolbar ‘Reset’ button.

Reset VBA, by clicking on the square button. The yellow color will disappear from

‘Workbook_Open()’.

Step 3

Open the referenced modules in VBA, by opening the

‘References’ dialog from the ‘Tools’ menu in Visual Basic, as below: eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 83

Step 4

Remove the reference to the apparently unknown module:

‘eXLerate.DLL’, by turning off the checkbox at the line:

MISSING: eXLerate ActiveX DLL, as shown below:

Step 6

Scroll down in the reference list and find the eXLerate ActiveX

DLL:

Step 7

Enable the eXLerate ActiveX DLL by enabling the checkbox:

Step 5

Close the dialog again. Then, re-open the References dialog again:

Step 8

Close the dialog, and now execute manually the

‘Workbook_Open()’ macro in VBA. Your application now will startup properly after all.

84 COI/eXL2016-EN | eXLerate 2016 | Advanced topics reference manual

Run the ‘Workbook_Open()’ macro manually. This causes eXLerate to start up normally after all.

Step 9

Save your application when in design mode. Your problem should have been solved. If the problem still persists, please contact your technical representative. eXLerate 2016 | Advanced topics reference manual | COI/eXL2016-EN 85

Contact us

ABB - Spirit IT

Prof. Dr. Dorgelolaan 20

5613 AM Eindhoven

The Netherlands

Tel: +31 (0)40 236 94 45 www.spiritit.com www.abb.com

Note

We reserve the right to make technical changes or modify the contents of this document without prior notice. ABB does not accept any responsibility whatsoever for potential errors or possible lack of information in this document.

We reserve all rights in this document and in the subject matter and illustrations contained therein.

Any reproduction, disclosure to third parties or utilization of its contents - in whole or in parts – is forbidden without prior written consent of ABB.

Copyright© ABB

All rights reserved

COI_eXL2016_B0_12_2016

Sales Tech Support

advertisement

Was this manual useful for you? Yes No
Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Related manuals