Universal File and Stream Loader Interface to the PI System



Universal File and

Stream Loader

Interface to the PI System

Version 3.0.3.16

Revision D

Copyright © 2006-2009 OSIsoft, Inc.

|OSIsoft, Inc. | |OSIsoft Australia |

|777 Davis St., Suite 250 | |Perth, Australia |

|San Leandro, CA 94577 USA | |Auckland, New Zealand |

|(01) 510-297-5800 (main phone) | |OSI Software GmbH |

|(01) 510-357-8136 (fax) | |Altenstadt, Germany |

|(01) 510-297-5828 (support phone) | |OSIsoft Asia Pte Ltd. |

| | |Singapore |

|techsupport@ | |OSIsoft Canada ULC |

|Houston, TX | |Montreal, Canada |

|Johnson City, TN | |Calgary, Canada  |

|Longview, TX | |OSIsoft, Inc. Representative Office |

|Mayfield Heights, OH | |Shanghai, People’s Republic of China  |

|Philadelphia, PA | |OSIsoft Japan KK |

|Phoenix, AZ | |Tokyo, Japan  |

|Savannah, GA | |OSIsoft Mexico S. De R.L. De C.V. |

|Yardley, PA | |Mexico City, Mexico |

| | |OSIsoft do Brasil Sistemas Ltda. |

| | |Sao Paulo, Brazil   |

| | | |

|Sales Outlets/Distributors | | |

|Middle East/North Africa | |South America/Caribbean |

|Republic of South Africa | |Southeast Asia |

|Russia/Central Asia | |South Korea Taiwan |



All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, mechanical, photocopying, recording, or otherwise, without the prior written permission of OSIsoft, Inc. 

OSIsoft, the OSIsoft logo and logotype, PI Analytics, PI ProcessBook, PI DataLink, ProcessPoint, Sigmafine, Analysis Framework,  PI Datalink, IT Monitor, MCN Health Monitor, PI System, PI ActiveView, PI ACE, PI AlarmView, PI BatchView, PI ManualLogger, PI ProfileView, ProTRAQ, RLINK, RtAnalytics, RtBaseline, RtPortal, RtPM, RtReports and RtWebParts are all trademarks of OSIsoft, Inc. All other trademarks or trade names used herein are the property of their respective owners.

RESTRICTED RIGHTS LEGEND

Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph I(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013

Table of Contents

Terminology vii

Introduction 1

Reference Manuals 2

Supported Features 2

Configuration Diagram 6

Principles of Operation 9

Interface Startup 9

Runtime Operations 10

Use of PI SDK 12

Performance Considerations 13

Installation Checklist 15

Data Collection Steps 15

Interface Diagnostics 16

Interface Installation 17

Naming Conventions and Requirements 17

Interface Directories 18

PIHOME Directory Tree 18

Interface Installation Directory 18

Interface Installation Procedure 18

Installing Interface Service with PI ICU 19

Installing Interface Service Manually 22

Digital States 23

PointSource 25

PI Point Configuration 27

Point Attributes 27

Tag 27

PointSource 27

PointType 28

Location1 28

Location2 28

Location3 28

Location4 28

Location5 28

ExDesc 29

InstrumentTag 30

Convers 30

Scan 30

Shutdown 31

Output Points 31

Configuration File 33

General 33

[INTERFACE] 34

[PLUG-IN] – ASCII Files 35

[PLUG-IN] – Serial Port 38

[PLUG-IN] – POP3 40

Principles of Operation 40

[SETTING] 47

[FIELD] 50

[MSG] 54

Message Structure Definitions: [MSG(n)] 56

Data Extraction to Fields 59

Data Manipulation 61

Arithmetic and Logical Operators 61

Mathematical Functions 62

String Functions 62

DateTime and Time Functions 63

IF Statement 64

Arithmetic and Logical Operators - Examples 64

MSG(n).Action 68

Graphical User Interface (GUI) Facilitating the INI File Creation 75

Startup Command File 85

Configuring PI_UFL Interface with PI ICU 85

UFL Interface page 87

Command-line Parameters 91

Sample PI_UFL.bat File 94

Interface Node Clock 95

Security 97

Windows 97

Starting / Stopping PI_UFL Interface 99

Starting Interface as a Service 99

Pausing Interface 99

Stopping Interface Running as a Service 99

The service can be removed (uninstall) by: 99

Buffering 101

Which Buffering Application to Use 102

How Buffering Works 102

Buffering and PI Server Security 103

Enabling Buffering on an Interface Node with the ICU 104

Choose Buffer Type 104

Buffering Settings 105

Buffered Servers 107

Installing Buffering as a Service 110

Interface Diagnostics Configuration 113

Scan Class Performance Points 113

Performance Counters Points 113

Interface Health Monitoring Points 113

Creating Health Monitoring Points Using the PI Tag Configurator 113

I/O Rate Point 117

For Users of Previous (2.x) Interface Versions 121

Appendix A: Error and Informational Messages 125

Appendix B: CSV (Comma Delimited) Data Files 127

For Users of the PI Batch File Interface 127

Data File Example 127

Configuration File Example 127

Bat File Example 129

Explanation 129

Appendix C: XML Document Files 131

Data File Example 131

Configuration File Example 132

Bat File Example 133

Explanation 134

Appendix D: Reading Data from Serial Port 135

Streams Patterns from Serial Port 135

Configuration File Example 135

Bat File Example 136

Explanation 136

Appendix E: Reading Data from POP3 Server 137

Email Text 137

Configuration File Example 137

Bat File Example 138

Explanation 139

Appendix F: More Advanced Examples 141

Data File Example 141

Configuration File Example 141

Point Configuration 142

Bat File Example 142

Explanation 143

Appendix G : ASCII Codes Supported 145

Appendix H : Tested Operating Systems 147

Revision History 149

Terminology

In order to understand this interface manual, you should be familiar with the terminology used in this document.

Buffering

Buffering refers to an Interface Node’s ability to store temporarily the data that interfaces collect and to forward these data to the appropriate PI Servers.

N-Way Buffering

If you have PI Servers that are part of a PI Collective, PIBufss supports n-way buffering. N-way buffering refers to the ability of a buffering application to send the same data to each of the PI Servers in a PI Collective. (Bufserv also supports n-way buffering to multiple PI Server however it does not guarantee identical archive records since point compressions specs could be different between PI Servers. With this in mind, OSIsoft recommends that you run PIBufss instead.)

ICU

ICU refers to the PI Interface Configuration Utility. The ICU is the primary application that you use in order to configure and run PI interface programs. You must install the ICU on the same computer on which an interface runs. A single copy of the ICU manages all of the interfaces on a particular computer.

You can configure and run an interface by editing a startup command file. However, OSIsoft discourages this approach. Instead, OSIsoft strongly recommends that you use the ICU for interface management tasks.

Interface Node

An Interface Node is a computer on which

• the PI API and/or PI SDK are installed, and

• PI Server programs are not installed.

PI API

The PI API is a library of functions that allow applications to communicate and exchange data with the PI Server. All PI interfaces use the PI API.

PI Collective

A PI Collective is two or more replicated PI Servers that collect data concurrently. Collectives are part of the High Availability environment. When the primary PI Server in a collective becomes unavailable, a secondary collective member node seamlessly continues to collect and provide data access to your PI clients.

PIHOME

PIHOME refers to the directory that is the common location for PI client applications. A typical PIHOME is C:\Program Files\PIPC. PI interfaces reside in a subdirectory of the Interfaces directory under PIHOME. For example, files for the PI_UFL Interface are in C:\Program Files\PIPC\Interfaces\PI_UFL.

This document uses [PIHOME] as an abbreviation for the complete PIHOME directory. For example, ICU files in [PIHOME]\ICU.

PI SDK

The PI SDK is a library of functions that allow applications to communicate and exchange data with the PI Server. Some PI interfaces, in addition to using the PI API, require the use of the PI SDK.

PI Server Node

A PI Server Node is a computer on which PI Server programs are installed. The PI Server runs on the PI Server Node.

PI SMT

PI SMT refers to PI System Management Tools. PI SMT is the program that you use for configuring PI Servers. A single copy of PI SMT manages multiple PI Servers. PI SMT runs on either a PI Server Node or a PI Interface Node.

Pipc.log

The pipc.log file is the file to which OSIsoft applications write informational and error messages. While a PI interface runs, it writes to the pipc.log file. The ICU allows easy access to the pipc.log.

Point

The PI point is the basic building block for controlling data flow to and from the PI Server. For a given timestamp, a PI point holds a single value.

A PI point does not necessarily correspond to a “point” on the foreign device. For example, a single “point” on the foreign device can consist of a set point, a process value, an alarm limit, and a discrete value. These four pieces of information require four separate PI points.

Service

A Service is a Windows program that runs without user interaction. A Service continues to run after you have logged off from Windows. It has the ability to start up when the computer itself starts up.

The ICU allows you to configure a PI interface to run as a Service.

Tag (Input Tag and Output Tag)

The tag attribute of a PI point is the name of the PI point. There is a one-to-one correspondence between the name of a point and the point itself. Because of this relationship, PI System documentation uses the terms “tag” and “point” interchangeably.

Interfaces read values from a device and write these values to an Input Tag. Interfaces use an Output Tag to write a value to the device.

Introduction

This document describes OSIsoft’s Universal File and Stream Loader (PI_UFL) interface to the PI System. It describes how to configure it as well as how to use it effectively.

PI_UFL interface reads data from various ASCII stream data sources. Its modular concept is built on the functionality division – the core part of the interface does the stream parsing and data forwarding to PI, while the actual data reading, which is proprietary to each data source, is implemented in dynamically loaded libraries (DLLs). These data sources must produce readable (ASCII) data; that is, ASCII streams with (repeatable) patterns. The interface parses those patterns and extracts the information the user specifies in a configuration file.

As mentioned above, the interface is shipped with three DLLs, which implement the actual communication to the sources of ASCII text data:

• ASCII files: PI_UFL cyclically processes a given directory while looking for file names that match the user defined criteria (the directory and the file name pattern is one of the interface’s parameters). The interface thus scans the specified directory and if a file name matches the specified pattern, it opens the file, reads its content and looks for lines that pass the specified filters. After a file is processed, the interface renames the file and, optionally, deletes it.

• Reading data from Serial Ports (RS 232) works similarly. The interface continuously reads the specified serial port and when it encounters a character(s) that signals the end-of-the-line, it stores this line in a (memory) container. In the defined intervals, this memory is emptied and the lines processed, again looking for the specified patterns.

• The POP3 PlugIn periodically checks emails sent to the specified POP3 user on the given POP3 server. Emails are downloaded, processed and, finally, they are deleted.

As stated in the previous paragraph, the ASCII streams from the data sources need to be processed and parsed. A mandatory startup parameter the PI_UFL interface needs is therefore the path to the configuration file. This config. (INI) file actually controls how the interface identifies and manipulates the retrieved lines. The basic principle is very simple. The data is examined line by line. Each line is checked to see whether it matches one of the several sets of criteria (filters) and in case a line ‘satisfies’ a given filter, it is assigned a certain message type and is further broken into fields.

The content of these fields is then assigned to variables, which can take part in arithmetic expressions. The results are finally forwarded to PI.

[pic]Note: The PI UFL Interface is a replacement for the PI Batch File interface. Users of the PI Batch File interface should read Appendix B: CSV (Comma Delimited) Data Files before upgrading to PI UFL.

Note: To operate the interface effectively, users must thoroughly read the Configuration File section of this manual which describes in detail the required syntax for that file.

The Interface runs on Intel machines with Microsoft Windows operating system (2000, XP, 2003, Vista, Windows 2008 Server). See Appendix H : Tested Operating Systems for a full list of tested operating systems.

The Interface Node may be either a PI home or PI Interface node – see the Configuration Diagram section of this manual.

This document contains the following topics:

• Brief design overview

• Installation and operation details

• PI points configuration details (points that will receive data via this interface)

• Configuration file specifications

• Supported command line parameters

• Examples of various configuration files (including a brief explanation of each presented feature) in appendices B,C and D

[pic] CAUTION! See chapter For Users of Previous (2.x) Interface Versions

that lists all the changes implemented in PI_UFL 3.x!

Reference Manuals

OSIsoft

• PI Server manuals

• PI API and PI SDK Installation manual

• UniInt Interface User Manual

Supported Features

|Feature |Support |

|Part Number |PI-IN-OS-UFL-NTI |

|*Platforms |Windows 2000 SP3 & SP4 / XP / 2003 / Windows Vista, |

| |Windows 2008 Server |

|APS Connector |No |

|Point Builder Utility |No |

|ICU Control |Yes |

|PI Point Types |PI 3: int16 / int32 / float16 / float32 / float64 / |

| |digital / string |

|Sub-Second Timestamps |Yes |

|Sub-Second Scan Classes |No |

|Automatically Incorporates PI Point Attribute Changes |Yes |

|Exception Reporting |Yes |

|Outputs from PI |No |

|Inputs to PI |Scan-Based |

|Supports Questionable Bit |Yes |

|Maximum Point Count |Unlimited |

|Supports Multi-character PointSource |Yes |

|*Uses PI SDK |Yes |

|PINet String Support |No |

|* Source of Timestamps |Current time or from the input stream(s). |

|* History Recovery |Yes |

|Failover |No |

|* UniInt-based |No |

|Disconnected Startup |No |

|SetDeviceStatus |Yes |

|Vendor Software Required on PI API / PINet Node |Not applicable |

|Vendor Software Required on Foreign Device |Not applicable |

|Vendor Hardware Required |Not applicable |

|Additional PI Software Included with Interface |Not applicable |

|Device Point Types |Not applicable |

|* Serial-Based Interface |Yes |

* See paragraphs below for further explanation.

Platforms

The Interface is designed to run on the above mentioned Microsoft Windows operating systems and their associated service packs.

Uses PI SDK

The PI SDK and the PI API are bundled together and must be installed on each PI Interface Node. This Interface specifically makes PI SDK calls to create PI Points, and write PI Annotations. See section Use of PI SDK for more details.

Source of Timestamps

Timestamps are read from the input file or, when not specified, the current (Interface Node local time) is used.

History Recovery

History recovery is automatically included with a file-based interface. After the interface has been down for some reason, and, as long as the data files were not deleted, PI_UFL will process them during the 1st scan cycle after the start; no matter how much data is stored in these files and no matter how long the interface has been down.

In case the interface communicates with data sources that do not persist the data (e.g. into ASCII files), there is nothing to recover from. This is the case when the interface communicates with a serial port.

UniInt-based

Note: PI_UFL is NOT a UniInt-based interface!

There are several relevant reasons:

• PI_UFL can operate without the PointSource; the /PS= start-up parameter is not mandatory.

• PI_UFL stores values to PI Annotations

• PI_UFL automatically creates new PI Points and Digital Sets/States

• PI_UFL is designed with the modular concept of PlugIns

At the time of writing, neither of the above listed features was applicable to UniInt.

[pic] PI_UFL is, to the maximum possible extent, designed as if it were built on the UniInt library. However, it must be recognized that 100% compatibility with all UniInt features has NOT been achieved.

SetDeviceStatus

Since version 3.0.3.16 PI_UFL implements Health Points. One of them is marked by [UI_DEVSTAT] in the Extended Descriptor and represents the status of the source device. The following events are written into the Device Status Health Point:

a) “Starting” – The interface has been started, has initialized the given PlugIn and is waiting for the first scan class.

b) “Good” – the interface is properly communicating and gets data from a data source (that is, from a directory with files, from a serial port or POP3 server).

c) “Intf Shutdown” – the interface was shut down.

Note: Please use PI ICU (Interface Configuration Utility) to configure

PI Health Tags. See more details in chapter Interface Health Monitoring Points.

Serial-Based Interface

This interface can run with a serial connection.

Server class machines often have inferior serial ports.  Server class machines are not required for most interfaces and should not be used, especially not when serial port connections are required.

• Recent Dell server class machines are using only 3 volt power supplies to drive the serial port – IEEE RS232 specification requires at least +/- 4.7 volts for a valid RS232 signal.

• Some recent model HP and Dell server class machines have been observed to have serial port circuitry which overheat and experience thermal shutdown after a few minutes or hours of operation over long cables or high speeds.

(So called self-powered serial port extenders should not be used for interfaces.)  Customers often attempt to extend serial port ranges using twisted pair wire devices or fiber optic cable devices.  Devices with their own external power source (e.g. a wall wart transformer or other power source) should be the only types used.  Devices which leach power from the PC’s serial port will have difficulty at high data speeds (baud rates) or long cables.  In some applications a cable more than 20-50 feet long may be considered “long”.  Higher speeds and/or longer cables translate to sharply increased power supply demand by the serial port hardware.

Configuration Diagram

The drawing below depicts the basic configuration of the hardware and software components in a typical scenario used with the PI_UFL Interface:

[pic]

Figure 1. PI_UFL Configuration Diagram – PI Home Node with PI Interface Node

Or

[pic]

Figure 2 – Hardware Diagram – All PI Software installed on one node

Principles of Operation

A brief description of the basic principles has been given in the Introduction chapter. Following paragraphs have more details:

Interface Startup

At startup, the PI_UFL interface checks the correctness of the specified start up parameters and continues with processing of the configuration (INI) file. As mentioned in the Introduction chapter, the configuration file tells the PI_UFL interface how to extract and interpret data streams from the given data source. After the interface is started, it performs a series of syntax checks on the message parsing constructions and expressions specified in the INI file – that is, it compiles it. If errors are found, detailed info about them is written to the output log file and the interface halts. Once the configuration file has been read and successfully compiled, the interface accesses the PI Point database according to the specifications found on the startup command line. The following paragraphs describe various modes depending on the presence of the following startup parameters - /ps and /tm.

• If the /ps parameter was specified, all PI points with that PointSource will be loaded into the interface’s memory and this list will be continuously updated through the signup for points’ update mechanism. The same is true for points that fit the /tm

pattern. Both parameters (/ps and /tm) thus define the PI points that are loaded while the interface starts.

If neither of the two was specified, no PI points will be loaded at startup. However, the interface will then ‘continuously build’ its internal tag list out of the TagNames that appear in the data files ‘as they arrive’; that is, the list will be created dynamically.

Note: the /ps (as well as the /tm) startup parameters are optional. Sending data to any PI tag is a feature that differentiates PI_UFL from the majority of OSIsoft interfaces!

• When used, both parameters also make sure the interface will write values only to tags that comply with the given specification. That is, if for instance, the /tm is set and a TagName arrives that does not fit the /tm specified pattern, the interface will NOT send the data to this tag. Neither will it create it.

• Simultaneous use of /ps and /tm is NOT supported!

Note: If the configuration file specifies the value should be sent to PI via the string pattern found in the InstrumentTag (see section InstrumentTag) – such a tag has to already be loaded into the internal interface’s tag-list. In case it is not, the value for this tag will be skipped (it will NOT be sent to PI). The reason is that PI Point database is not indexed by the InstrumentTag attribute and any on-line searching via this attribute is potentially expensive.

The /ps or the /tm are thus required for addressing via the InstrumentTag.

If all the configuration steps and checks during the start-up phase are completed, the interface continues with run-time operations:

Runtime Operations

During the run-time, the PI_UFL interface checks, at regular time intervals, whether new input files, emails have been created/received, or whether new lines have been identified on a serial port. This frequency is specified as the start-up parameter /f=hh:mm:ss on the command line (for more information on command-line parameters, see the Command-line Parameters section of this manual).

Note: The PI_UFL interface supports just ONE scan class.

The following bullets discuss what steps the runtime operations consist of:

• PI_UFL interface checks each input line against the filter declarations given in the configuration file. As soon as the input line ‘satisfies’ any of the specified filters (see the description of the keyword MSG(n).Filter), the line is assigned a certain message type and is consequently broken into individual fields. These fields can be named and treated as variables. They can optionally take part in expressions. Fields (variables) are finally sent to PI via the StoreInPI() function:

StoreInPI (Tag, InstrumentTag, Timestamp, Value, Status, Questionable, [Annotation]).

Following is an example, showing the described principles and used terminology:

[field]

field(1).name = “time”

field(2).name = “value”

field(3).name = “tag”

[msg]

msg(1).name = “message1”

[message1]

message1 = C1==”Line containing *”

time=C27-C46

value=C54-C56

tag=C62-C69



[pic]

message1.action = StoreInPi(tag,,time,value,,)



Note: If the input message does not satisfy any filter definition, it is skipped and NO error is reported.

• The text lines are thus processed by the INI file as if it were a procedure and the lines input parameters.

Which data source will the interface talk to; that is, which DLL it will load is specified in the PLUG-IN entry of the INI file in section [INTERFACE]. The following bullets list the main features (and corresponding run-time steps) implemented in the three installed DLLs – AsciFiles.DLL, Serial.DLL and POP3.DLL.

ASCII Files:

• Data files are processed in ‘settable order’ – they can be sorted according to the creation date, modification date and according to the actual file name. The sorting mode is given via the INI file (see the description of the IFS keyword).

Note: Before the interface opens a data file, it moves it into the directory with the PI_UFL executable and temporarily renames it by prefixing the original name by the underscore. Then the whole file is read into the memory and the lines are processed. Thus new files (with the same name) can be copied into the data directory even if the interface is currently processing a file.

• After an input file has been processed, it is renamed with an extension indicating successful or erroneous processing. By default, the extension indicating a successful processing is ‘._OK’; any runtime error causes the processed file is added the ‘.ERR’ suffix. Both extensions can be explicitly specified. See chapter Configuration File for more details.

• After the given time period, files that have been processed without errors will be deleted. This purge interval is specified by the PURGETIME keyword in the section [PLUG-IN] of the configuration file. Files that were given the ‘.ERR’ suffix are NOT purged. The default purging period is one day (PURGETIME = 1d) and the purge time period represents the interval .

Serial Ports data source:

• ASCII characters from the serial port are continuously collected. The interface continues reading them until it encounters the marker character that signals the end of a line. Lines are stored in the interfaces’ memory – in a container. The container is periodically emptied with the specified frequency - /f=hh:mm:ss. Collected lines are then processed by the interface.

POP3 data source:

• The POP3 PlugIn connects to the specified POP3 server as the specified user.

• Emails are periodically downloaded (at the specified frequency - /f=hh:mm:ss) and handed over to the PI_UFL parsing engine for processing.

• The processed emails are then deleted from the POP3 server.

• The POP3 PlugIn allows for forwarding the downloaded emails to the specified SMTP server.

Note: The POP3 PlugIn works over a TCP/IP connection using TCP port 110. Communication over the SSL (Secure Socket Layer) on an alternate port 995 (also known as POP3S) is not supported.

Note: All operations and evaluations PI_UFL interface performs are

CASE INSENSITIVE!

The exceptions to this rule are timestamp formats (shown in Table 5 in chapter describing the Field(n).Format) and pattern based extractions, see sections MSG(n).Filter , Data Extraction.

Use of PI SDK

The scope of tasks PI_UFL interface does is wide; for some features it also requires functionality, which is only implemented in PI SDK. The interface therefore maintains two links to the PI Server – one based on PI API, the other on PI SDK. Following are the tasks the PI SDK is used for:

1) Automatic point(s) and digital set(s) and digital state(s) creation.

That is, if a non-existing PI tag-name appears (in the data file) or a digital tag that does not have the given state in its state table, PI SDK is used to create these objects automatically.

2) Writing to PI annotations.

Next to the value and status, PI_UFL allows sending the annotations to PI tags.

For more information about both above mentioned features, see appropriate section in chapter Configuration File.

Note: Use of PI SDK requires the PI Known Server’s Table contains the PI Server name the interface connects to.

Note: The PI SDK link (connection) is created only when needed. If StoreInPI() is used WITHOUT the Annotation argument and the EPC (Enable Point Creation) keyword IS NOT specified the interface will only establish a PI API link.

[pic] CAUTION! When PI_UFL interface runs against High Availability PI Servers, events containing PI Annotations will NOT make it to non-primary PI Servers.

Performance Considerations

Especially in scenarios where PI_UFL is used for extracting data from bigger text files, the interface performance (ratio how many events can be sent to PI Archive per second) plays an important role. Moreover, thanks to the overall interface flexibility and configuration richness, it is essential not only to know how many events the interface can send to PI per second, but also which parameters have considerable impact onto the performance. The table below lists the above mentioned ratios as well as it depicts which parameters are relevant.

Note:  As benchmarking is always influenced by many aspects, please treat the performance numbers just for reference and orientation purposes!

PI Server (version 3.4.375): Dual CPU Intel Xeon 3 GHz, 3GB RAM

Interface Node: Dual Core Intel 2.13 GHz, 1GB RAM

The destination Float32 PI point had exception and compression switched off.

| |PI Archive rate |PI Archive rate |

|Data sent through: |PI_UFL Interface configured |PI_UFL Interface configured with the /Q|

| |with the /LB start-up parameter |start-up parameter |

| |Interface on PI Server: |Interface on PI Server: |

|StoreInPI() does NOT contain the |8.000 events/second |10.000 events/second |

|annotation parameter. | | |

| |Interface on a separate node: |Interface on a separate node: |

| |10.000 events/second |16.000 events/second |

| |Interface on PI Server: |Interface on PI Server: |

|StoreInPI() contains |2.000 events/second |850 events/second |

|the annotation parameter. | | |

| | | |

| |Interface on a separate node: |Interface on a separate |

| |5.000 events/second |node: |

| | |800 events/second |

Table 1. PI_UFL StoreInPI()[1]) ratios (the numbers are for version PI_UFL 3.0.3x+)

Explanation

- The first column shows the rate when the events are sent through the PI API bulk archive call piar_putarcvaluesx(). The second column shows the rate when events are achieved with the (bulk) PI API snapshot call pisn_sendexceptionqx() (See the PI API help for more information on the referenced function calls.)

These archive and snapshot ratios (~10.000 events/sec) are similar and, depending on the hardware, can even be slightly better; the difference between running the interface on the PI Server and on an Interface Node stems from CPU utilization. In general, running the UFL interface on an Interface Node (and using the bulk PI API calls) will always be faster.

- The second (

- bottom) part of the table shows ratios when the StoreInPI() contains the annotation column. This means, events are sent through PI SDK calls.

Note: In case the interface is configured WITHOUT the /lb or the /q startup parameters (these two switches actually enable the bulk PI API calls) the ratios become significantly slower, because then the events are sent to PI one by one (allowing for per point settings; see Location5 for more).

Note: See the start-up parameters /ws and /wd. These can be used to throttle the throughput.

Installation Checklist

If you are familiar with running PI data collection interface programs, this checklist helps you to get the Interface running. If you are not familiar with PI interfaces, return to this section after reading the rest of the manual in detail.

This checklist summarizes the steps for installing this Interface. You need not perform a given task if you have already done so as part of the installation of another interface. For example, you only have to configure one instance of Buffering for every interface that runs on an Interface Node.

The Data Collection Steps below are required. Interface Diagnostics and Advanced Interface Features are optional.

Data Collection Steps

1. Confirm that you can use PI SMT to configure the PI Server. You need not run PI SMT on the same computer on which you run this Interface.

2. If you are running the Interface on an Interface Node, edit the PI Server’s Trust Table to allow the Interface to write data.

3. Run the installation kit for PI Interface Configuration Utility (ICU) on the Interface Node. This kit runs the PI SDK installation kit, which installs both the PI API and the PI SDK.

4. Run the installation kit for this Interface.

5. If you are running the Interface on an Interface Node, check the computer’s time zone properties. An improper time zone configuration can cause the PI Server to reject the data that this Interface writes.

6. Run the ICU and configure a new instance of this Interface. Essential startup parameters for this Interface are:

PI Server (/host)

Scan Class (/f)

Configuration File (/cf)

7. Configure the Interface configuration .INI file. See chapters:

Configuration File and Graphical User Interface (GUI) Facilitating the INI File Creation

8. If you will use digital points, define the appropriate digital state sets.

9. Build input tags and, if desired, output tags for this Interface. Important point attributes and their use are:

Location1 is not used

Location2 is not used

Location3 is not used

Location4 is not used

Location5 specifies if exception reporting is used and/or the archive mode

ExDesc is not used (except for Health Points).

Convers defines the coefficient that multiplies the PI numeric tags.

InstrumentTag defines the TagName alias.

PointSource defines the PI points that are loaded at interface startup

10. Start the Interface interactively and confirm its successful connection to the PI Server without buffering.

11. Confirm that the Interface collects data successfully.

12. Configure the Interface to run as a Service. Confirm that the Interface runs properly as a Service.

13. Restart the Interface Node and confirm that the Interface restarts.

Interface Diagnostics

1. Configure Scan Class Performance point; Scan Class Performance Points

2. Configure UniInt Health Monitoring Points; Interface Health Monitoring Points

3. Configure the I/O Rate point; Enable IORates for this Interface

Interface Installation

Interface on PI Interface Nodes

OSIsoft recommends that interfaces be installed on a PI Interface Nodes instead of directly on the PI Server node. A PI Interface Node is any node other than the PI Server node where the PI Application Programming Interface (PI API) has been installed (see the PI API manual). With this approach, the PI Server need not compete with interfaces for the machine’s resources. The primary function of the PI Server is to archive data and to service clients that request data.

On the PI Interface nodes, OSIsoft’s interfaces are usually installed along with the buffering service (see chapter Buffering later on in this manual).

In most cases, interfaces on PI Interface Nodes should be installed as automatic services. Services keep running after the user logs off. Automatic services automatically restart when the computer is restarted, which is useful in the event of a power failure.

Interface on PI Server Nodes

The guidelines are different if an interface is installed on the PI Server node. In this case, the typical procedure is to install the PI Server as an automatic service and install the interface as an automatic service that depends on the PI Update Manager and PI Network Manager services. This typical scenario assumes that Buffering is not enabled on the PI Server node. Bufserv can be enabled on the PI Server node so that interfaces on the PI Server node do not need to be started and stopped in conjunction with PI, but it is not standard practice to enable buffering on the PI Server node. The PI Buffer Subsystem can also be installed on the PI Server. See the UniInt Interface User Manual for special procedural information.

Naming Conventions and Requirements

It is customary for the user to rename the executable and the startup command file when multiple copies of the interface are run. For example, PI_UFL1.exe and PI_UFL1.bat would typically be used for interface number 1, PI_UFL2.exe and PI_UFL2.bat for interface number 2, and so on. When an interface is run as a service, the executable and the command file must have the same root name because the service looks for its command-line parameters in a file that has the same root name.

Note: The interface is installed along with the .pdb file (file containing the debug information). If you rename the PI_UFL.exe to PI_UFL1.exe, you also have to create/rename the corresponding .pdb file. That is for example, PI_UFL.pdb to PI_UFL1.pdb

Interface Directories

PIHOME Directory Tree

The PIHOME directory tree is defined by the PIHOME entry in the pipc.ini configuration file. This pipc.ini file is an ASCII text file, which is located in the %windir% directory. A typical pipc.ini file contains the following lines:

[PIPC]

PIHOME=c:\PIPC

The above lines define the \PIPC directory as the root of the PIHOME directory tree on the C: drive. OSIsoft recommends using \PIPC as the root directory name.

The PIHOME directory does not need to be on the C: drive.

Interface Installation Directory

The interface install kit will automatically install the interface to:

PIHOME\Interfaces\PI_UFL\

PIHOME is defined in the pipc.ini file located in Windows directory.

Interface Installation Procedure

The PI_UFL interface setup program uses the services of the Microsoft Windows Installer. Windows Installer is a standard part of Windows 2000. To install, run the PI_UFL_#.#.#.#.exe installation kit.

Note: If the interface cannot be started interactively, one will usually not be able to run the interface as a service either. It is easier to debug the interactively started processes because all error messages are echoed directly to the screen.

The PI_UFL Interface service can be created, either with the PI Interface Configuration Utility (PI ICU), or can be configured manually. Next sections have more information:

Installing Interface Service with PI ICU

The PI Interface Configuration Utility provides a user interface for creating, editing, and deleting the interface service.

[pic]

Service Configuration

Service name

The Service name box shows the name of the current interface service. This service name is obtained from the interface executable.

ID

This is the service id used to distinguish multiple instances of the same interface using the same executable.

Note: For PI_UFL, the service ID must be a number!

Display name

The Display Name text box shows the current Display Name of the interface service. If there is currently no service for the selected interface, the default Display Name is the service name with a “PI-” prefix. Users may specify a different Display Name. OSIsoft suggests that the prefix “PI-” be appended to the beginning of the interface to indicate that the service is part of the OSIsoft suite of products.

Log on as

The Log on as text box shows the current “Log on as” Windows User Account of the interface service. If the service is configured to use the Local System account, the Log on as text box will show “LocalSystem.” Users may specify a different Windows User account for the service to use.

Password

If a Windows User account is entered in the Log on as text box, then a password must be provided in the Password text box, unless the account requires no password.

Confirm Password

If a password is entered in the Password text box, then it must be confirmed in the Confirm Password text box.

Startup Type

The Startup Type indicates whether the interface service will start automatically or needs to be started manually on reboot.

• If the Auto option is selected, the service will be installed to start automatically when the machine reboots.

• If the Manual option is selected, the interface service will not start on reboot, but will require someone to manually start the service.

• If the Disabled option is selected, the service will not start at all.

Generally, interface services are set to start automatically.

Dependencies

The Installed services list is a list of the services currently installed on this machine. Services upon which this Interface is dependent should be moved into the Dependencies list using the [pic] button. For example, if PI API Buffering is running, then “bufserv” should be selected from the list at the right and added to the list on the left. To remove a service from the list of dependencies, use the [pic] button, and the service name will be removed from the “Dependencies” list.

When the PI Interface is started (as a service), the services listed in the dependency list will be verified as running (or an attempt will be made to start them). If the dependent service(s) cannot be started for any reason, then the PI interface service will not run.

Note: Please see the PI Log and Operating System Event Logger for messages that may indicate the cause for any server not running as expected.

[pic] - Add Button

To add a dependency from the list of Installed services, select the dependency name, and click the Add button.

[pic] - Remove Button

To remove a selected dependency, highlight the service name in the Dependencies list, and click the Remove button.

The full name of the service selected in the Installed services list is displayed below the Installed services list box.

Create

The Create button adds the displayed service with the specified Dependencies and with the specified Startup Type.

Remove

The Remove button removes the displayed service. If the service is not currently installed, or if the service is currently running, this button will be grayed out.

Start or Stop Service

To Start or Stop an interface service, use the Start button [pic] and a Stop button [pic] on the ICU toolbar. If this interface service is not currently installed, these buttons will remain grayed out until the service is added. If this interface service is running, the Stop button is available. If this service is not running, the Start button is available.

The status of the Interface service is indicated in the lower portion of the PI ICU dialog.

[pic]

Installing Interface Service Manually

Help for installing the interface as a service is available at any time with the command:

PI_UFL.exe –help

or

PI_UFL.exe -?

Change to the directory where the PI_UFL.exe executable is located. Then, consult the following table to determine the appropriate service installation command.

|Windows Service Installation Commands on a PI Interface Node or |

|a PI Server node WITH Bufserv implemented |

|Manual service |PI_UFL.exe –install –depend “tcpip bufserv” |

|Automatic service |PI_UFL.exe –install –auto –depend “tcpip bufserv” |

|Automatic service with service |PI_UFL.exe –serviceID x –install –auto –depend “bufserv” –display “PI_UFL” |

|id | |

|Windows Service Installation Commands on a PI Interface Node or |

|a PI Server node WITHOUT Bufserv implemented |

|Manual service |PI_UFL.exe –install –depend tcpip |

|Automatic service |PI_UFL.exe –install –auto –depend tcpip |

|Automatic service with service |PI_UFL.exe –serviceID x –install –auto –display “PI_UFL” |

|id | |

Note: For PI_UFL, the serviceID must be a number!

Check the Microsoft Windows services control panel to verify that the service was added successfully. The services control panel can be used at any time to change the interface from an automatic service to a manual service or vice versa.

Digital States

For more information regarding Digital States, refer to the PI Server documentation.

Digital State Sets

PI digital states are discrete values represented by strings. These strings are organized in PI as digital state sets. Each digital state set is a user-defined list of strings, enumerated from 0 to n to represent different values of discrete data. For more information about PI digital tags and editing digital state sets, see the PI Server manuals.

An interface point that contains discrete data can be stored in PI as a digital tag.

A Digital tag associates discrete data with a digital state set, as specified by the user.

System Digital State Set

Similar to digital state sets is the system digital state set. This set is used for all tags, regardless of type to indicate the state of a tag at a particular time. For example, if the interface receives bad data from an interface point, it writes the system digital state bad input to PI instead of a value. The system digital state set has many unused states that can be used by the interface and other PI clients. Digital States 193-320 are reserved for OSIsoft applications.

PI_UFL Interface and Digital States

The PI_UFL interface uses the /des=# startup parameter, where # is the number from the PI System digital set in case it is NOT possible to translate a string into the particular digital state (e.g. the arrived string does not exist in the corresponding digital set).

Note: Next to the dynamic tag creation, the interface is also able to dynamically extend the digital sets (that means, it will automatically add new digital states at run-time). See section [MSG] later in the manual.

PointSource

PI_UFL differentiates from other OSISoft interfaces in its ability to operate on all tags that exist in the PI Point database. Moreover, the interface dynamically creates PI tags as it encounters a TagName that cannot be located in the PI Point database; more about creating points can be found in chapter [MSG] later in the manual.

At the beginning of this document, in chapter Principles of Operation, it was shortly described how the interface behaves in relation to the startup parameters /ps and /tm. Both are meant to optimize the runtime performance in terms of minimizing the access to the PI Point database as well as they restrict sending data to the specified tags.

Note: As the interface maintains its internal cache of TagNames, which consists of names that were already used in data files, the run-time performance overhead stemming from accessing the PI point database is not that significant and the interface can easily operate without startup the parameters /ps, /tm.

The PointSource is a unique string of one or more alphanumeric characters that is used to identify the PI point as a point that belongs to a particular interface. For example, the letter U may be chosen to identify points that belong to the PI_UFL Interface. To implement this, set the PointSource attribute to U for every PI Point that is configured for the PI_UFL Interface. Then, /ps=U is used on the startup command-line of the PI_UFL interface, the Interface will search the PI Point Database upon startup for every PI point that is configured with a PointSource of U. Before an interface loads a point, the interface usually performs further checks by examining additional PI point attributes to determine whether a particular point is valid for the interface. For additional information, see the /ps parameter.

Case-sensitivity for PointSource Attribute

The PointSource character that is supplied with the /ps command-line parameter is not case sensitive. That is, /ps=U and /ps=u are equivalent.

Reserved Point Sources

Several subsystems and applications that are shipped with PI are associated with default PointSource characters. The Totalizer Subsystem uses the PointSource character T, the Alarm Subsystem uses G and @, Random uses R, RampSoak uses 9, and the Performance Equations Subsystem uses C. Do not use these PointSource characters or change the default point source characters for these applications. Also, if a PointSource character is not explicitly defined when creating a PI point; the point is assigned a default PointSource character of Lab (PI 3). Therefore, it would be confusing to use Lab as the PointSource character for an interface.

Note: Do not use a point source character that is already associated with another interface program. However it is acceptable to use the same point source for multiple instances of an interface.

PI Point Configuration

The PI point is the basic building block for controlling data flow to and from the PI Server. A single point is configured for each measurement value that needs to be archived.

Point Attributes

Use the point attributes below to define the PI Point configuration for the Interface, including specifically what data to transfer.

Tag

The Tag attribute (or tagname) is the name for a point. There is a one-to-one correspondence between the name of a point and the point itself. Because of this relationship, PI documentation uses the terms “tag” and “point” interchangeably.

Follow these rules for naming PI points:

• The name must be unique on the PI Server.

• The first character must be alphanumeric, the underscore (_), or the percent sign (%).

• Control characters such as linefeeds or tabs are illegal.

• The following characters also are illegal: * ’ ? ; { } [ ] | \ ` ‘ “

Length

Depending on the version of the PI API and the PI Server, this Interface supports tags whose length is at most 255 or 1023 characters. The following table indicates the maximum length of this attribute for all the different combinations of PI API and PI Server versions.

|PI API |PI Server |Supported Length in PI_UFL i/f |

|1.6 or higher |3.4.370.x or higher |1023 |

|1.6 or higher |Below 3.4.370.x |255 |

|Below 1.6 |3.4.370.x or higher |255 |

|Below 1.6 |Below 3.4.370.x |255 |

Table 2. TagName Length

PointSource

The PointSource is a unique, single or multi-character string that is used to identify the PI point as a point that belongs to a particular interface. For additional information, see the /PS command-line parameter and the PointSource section.

While the PI_UFL interface may collect data without regard to the PointSource, this attribute is NOT required to be set when creating the point. However, it is recommended to assign a certain PointSource to a point that is known to receive data through the PI_UFL interface. For additional information, see the /ps command-line parameter described in the Command-line Parameters section of the manual.

PointType

Typically, the types of values read from the data files do not need to correspond to PI point types. For example, integer values read from a file can be sent to a Float32 point or to Digital PI tags. Similarly, a float value read from a file can be sent to integer or Digital PI tags, although the values will be usually truncated. The following types are supported:

float16, float32, float64, int16, int32, digital, string.

For more information on the individual point types, see PI Data Archive for NT and UNIX.

Note: Blob and Timestamp types are NOT supported by the PI_UFL interface!

Location1

Location1 is not used by this interface.

Location2

Location2 is not used by this interface.

Location3

Location3 is not used by this interface.

Location4

Location4 is not used by this interface.

Location5

Location5 determines how the value will be sent to PI. Two modes are recognized:

In-order data and Out-of-order data:

In-order data: newvalue.timestamp >= prevvalue.timestamp

Out-of-order data: newvalue.timestamp < prevvalue.timestamp

The table below summarizes the supported options:

|Location5 |Behavior |

|0 |In-order data – the interface does the exception reporting in the standard |

| |way. |

| |Out-of-order data is supported, but existing archive values cannot be |

| |replaced; there will be the -109 error in the pimessagelog when the same |

| |timestamp is used. |

|Location5 |Behavior |

|1 |In-order data – the interface gives up the exception reporting – each |

| |retrieved value is sent to PI; |

| |Out-of-order data – the existing archive values (same timestamps) will be |

| |replaced and new events will be inserted. For PI3.3+ servers the existing |

| |snapshot data (the current value of a tag) is replaced. For PI3.2 (or |

| |earlier) systems the snapshot values cannot be replaced. In this case the new|

| |value is added and the old value remains. |

| |Note: When there are more events in the PI archive at the same timestamp, |

| |only one event is overwritten – the first in the succession |

|2 |If the data comes in-order – the behavior is the same as with Location5=1 |

| |Out-of-order data – values are always inserted; that is, multiple values at |

| |the same timestamp can occur. |

Table 3. Location5 Settings

Note: Location5 is only taken into account when NO /lb start-up parameter is used. See the /lb description in the Command-line Parameters section of the manual.

Note: When StoreInPI() does have the annotation parameter (PI SDK calls), the exception reporting does NOT occur!

ExDesc

Length

Depending on the version of the PI API and the PI Server, this Interface supports an Extended Descriptor attribute whose length is at most 80 or 1023 characters. The following table indicates the maximum length of this attribute for all the different combinations of PI API and PI Server versions.

|PI API |PI Server |Maximum Length |

|1.6.0.2 or higher |3.4.370.x or higher |1023 |

|1.6.0.2 or higher |Below 3.4.370.x |80 |

|Below 1.6.0.2 |3.4.370.x or higher |80 |

|Below 1.6.0.2 |Below 3.4.370.x |80 |

For PI_UFL, the extended descriptor is checked for the string “PERFORMANCE_POINT”. If this character string is found, the Interface treats this point as a performance point. See the section called Scan Class Performance Points.

InstrumentTag

PI_UFL interface references data either by Tag or by InstrumentTag. If the InstrumentTag attribute is used, the point must belong to the point source specified through the /ps startup parameter, or the Tag must match the tag mask specified by the /tm.

Length

Depending on the version of the PI API and the PI Server, this Interface supports an InstrumentTag attribute whose length is at most 32 or 1023 characters. The following table indicates the maximum length of this attribute for all the different combinations of PI API and PI Server versions.

|PI API |PI Server |Supported Length in PI_UFL i/f |

|1.6 or higher |3.4.370.x or higher |1023 |

|1.6 or higher |Below 3.4.370.x |32 |

|Below 1.6 |3.4.370.x or higher |32 |

|Below 1.6 |Below 3.4.370.x |32 |

Table 4. InstrumentTag Length

Convers

Coefficient applied against the value of the PI numeric tags; that is:

float16, float32, float64, int16, int32.

Their value is multiplied by the Convers parameter.

Scan

By default, the Scan attribute has a value of 1, which means that scanning is turned on for the point. Setting the scan attribute to 0 turns scanning off. If the scan attribute is 0 when the interface starts, SCAN OFF will be written to the PI point. If the scan attribute is changed from 1 to 0 while the interface is running, SCAN OFF will also be written to the PI point after the point edit is detected by the interface.

There is one other situation, which is independent of the Scan attribute, where the interface will write SCAN OFF to a PI point. If a point that is currently loaded by the interface is edited so that the point is no longer valid for the interface, the point will be removed from the interface, and SCAN OFF will be written to the point. For example, if the Point Source of a PI point that is currently loaded by the interface is changed, the point will be removed from the interface and SCAN OFF will be written to the point.

Shutdown

The Shutdown attribute is 1 (true) by default. The default behavior of the PI Shutdown subsystem is to write the SHUTDOWN digital state to all PI points when PI is started. The timestamp that is used for the SHUTDOWN events is retrieved from a file that is updated by the Snapshot Subsystem. The timestamp is usually updated every 15 minutes, which means that the timestamp for the SHUTDOWN events will be accurate to within 15 minutes in the event of a power failure. For additional information on shutdown events, refer to PI Server manuals.

SHUTDOWN events can be disabled from being written to PI when PI is restarted by setting the Shutdown attribute to 0 for each point. Alternatively, the default behavior of the PI Shutdown Subsystem can be changed to write SHUTDOWN events only for PI points that have their Shutdown attribute set to 0. To change the default behavior, edit the \PI\dat\Shutdown.dat file, as discussed in PI Server manuals.

Bufserv and PIBufSS

It is undesirable to write shutdown events when buffering is being used. Bufserv and PIBufSS are utility programs that provide the capability to store and forward events to a PI Server, allowing continuous data collection when the Server is down for maintenance, upgrades, backups, and unexpected failures. That is, when PI is shutdown, Bufserv or PIBufSS will continue to collect data for the interface, making it undesirable to write SHUTDOWN events to the PI points for this interface. Disabling Shutdown is recommended when sending data to a Highly Available PI Server Collective. Refer to the Bufserv or PIBufSS manuals for additional information.

Output Points

This Interface does not support Output Points.

Configuration File

PI_UFL interface uses the configuration file to describe how to interpret the individual input files. The configuration file is referenced by the mandatory startup parameter /cf=full_path. Its content is divided into sections (enclosed in square brackets) and each section can contain any number of parameters (parameters begin with a key, followed by the equals sign and a value) underneath. The configuration file thus resembles the structure of a standard Windows INI file[2]). Refer to Appendices B-D for configuration examples and further discussion. Configuration files examples, data files examples and batch startup files are also included with this interface in the directories PIHOME\Interfaces\PI_UFL\Examples and PIHOME\Interfaces\

PI_UFL\Examples\Data\).

In the following paragraphs we will discuss the individual sections and key definitions in detail:

General

As stated in the Introduction chapter, the configuration file allows the interface to process a variety of ASCII patterns. Examples are comma separated (csv) files, data files with tabular content, inputs with (simple) XML structures, ASCII streams from serial ports and emails from POP3 servers. The interface design assumes the input streams must have a coherent and consistent structure that can be described by means of the configuration file. A repeating part of the input stream is a message; if a particular message is recognized, it is assigned a certain message type. Such a message is further on divided into (one or more) fields, which must be sufficiently described so that the interface can treat them as variables; that is, variables need a data type (DateTime, String, Number,..); some also need a format (e.g. DateTime). See the picture in section Runtime Operations.

For example, a field that contains a date/time string needs further information that tells the interface how to transform this string pattern into a valid timestamp. All these declarations and format specifications must be stated in the configuration file.

Besides the data extraction directives, the configuration file contains additional (optional) sections that influence the interface behavior; e.g., definition of the line termination characters, interface logging, etc. All the configuration file sections and their keywords are detailed in this chapter and more complex examples (with detailed description on how the interface processes them) can be found in the appendices to this document.

Comments

Both, comment lines and blank lines can be included in a configuration file. Such comment lines placed in the configuration file are there for the benefit of the person doing the configuration, and for other people who might examine the file later. The PI_UFL interface ignores both, blank lines as well as all characters following a comment character on a line (comment characters within a string, double quotes, are ignored) through the line end. The comment character is the apostrophe ‘ (ASCII code: 39).

Example of Comment Lines

‘-----------------------------------------------------------------

‘ Get QUANTITY DETAILS

‘-----------------------------------------------------------------

‘ QTY+46:-140:KWH

‘ ¦-‘¦--‘¦--‘¦--‘

‘ ¦ ¦ ¦ +> Units, KWH

‘ ¦ ¦ +> actual quantity

‘ ¦ +> Delivered quantity code

‘ +> QUANTITY DETAILS

Line Continuation

Data in the configuration file can be split over several lines. For this purpose, the line continuation character _ (underscore, ASCII code: 95) must be used.

Example of Line Continuation

message1.filter = C1==”Line containing *” And _

C56==”DateTime*”

The following paragraphs will give a detailed overview of the individual sections and keywords the INI file consists of:

[INTERFACE]

PI_UFL interface has a modular design. It consists of a generic frame, responsible for parsing the ASCII data patterns and stream handling and of a module that takes care of communication with the PI Server. In addition, the modules for accessing the individual data sources (ASCII files, serial ports,..) are implemented in separate Dynamically Linked Libraries (DLLs). In the [INTERFACE] section of the configuration file, one has to specify the appropriate DLL name, which contains the logic for communication with the given data source. The individual keywords are listed below.

In its basic configuration, PI_UFL interface is shipped as the actual executable PI_UFL.exe and three DLLs. One implements communication with ASCII files ASCIIFiles.dll, the second one with serial ports Serial.dll and the third one implements downloading emails from POP3 servers POP3.DLL. The following keyword is recognized:

PLUG-IN

One instance of the interface can only talk to one data source. That means, the interface either scans a directory looking for the ASCII files of the given pattern in their names, or it communicates with (one) serial port or POP3 server. Default setting is ASCIIFiles.dll.

Plug-In Example:

Plug-In = ASCIIFiles.dll

Note: The specified DLL has to be in the same directory as the PI_UFL.EXE

[PLUG-IN] – ASCII Files

This section gives additional information that is specific to a data source. The following keywords are used to read and extract the content of ASCII files:

ERR

File extension in case of an error. Any run-time problem, like a file cannot be open, read or renamed will cause the interface marks the data file with the specified suffix.

The default error suffix is ERR.

Err Example:

Err = BAD

IFM

Input File Mask. The keyword points to a directory with data files. The file name pattern can contain the wild-card character *, or be without it.

Examples below show some of the supported constructs:

Example Ifm

Ifm = C:\PIPC\Interfaces\PI_UFL\Data\data.txt

‘ or

Ifm = C:\PIPC\Interfaces\PI_UFL\Data\data*.txt

‘ or

Ifm = \\computerName\shareName\PIPC\Interfaces\PI_UFL\Data\*.txt

Note: This keyword is mandatory.

Note: One interface instance can scan files in only one directory!

IFS

Input File Sort. The order of the data files can be changed by the IFS keyword.

The interface can read the data files sorted according to:

Creation date (default) IFS=C

Modification date IFS=M

File Name IFS=N

Ifs Example:

Ifs = N

PFN

Prepend File Name. If this keyword is present, the PlugIn will add the filename as the first line read. The filename is included as the first line in the read stream.

For better filtering of such line, the filename can be prefixed with the specified string pattern. See the keyword Pfn_Prefix below.

Default value is false.

Pfn Example:

‘ Data File Name: Data.txt



‘ UFL_Tag1, 01-Feb-2007 15 :00 :00, 123

‘ UFL_Tag2, 01-Feb-2007 15 :00 :00, 456

‘ …

‘ The interface will get :

‘ Data.txt

‘ UFL_Tag1, 01-Feb-2007 15 :00 :00, 123

‘ UFL_Tag2, 01-Feb-2007 15 :00 :00, 456

‘ …

Pfn = true

PFN_PREFIX

This may be useful when the filename is included with the PFN keyword. It may be of use to add a prefix to distinguish the filename line from the other lines in the data file.

Default value is FileName>

Pfn_Prefix Example:

‘ Data File Name: Data.txt

‘ …

‘ The interface will get :

‘ FileName>Data.txt

‘ …

Pfn_Prefix = FileName>

PURGETIME

Purge Time. Specify the amount of time to wait before purging processed data files. The time specified is relative to the current (local) time on the Interface Node and is compared against the to-be-purged file processed time. Default is one day – 1d. The minimum value is 1s (one second). The other recognized patterns are:

#s – number of seconds

#m – number of minutes

#h – number of hours

#d – number of days

Purgetime Example:

Purgetime = 10m

Note: Only those renamed files that were processed without any error will be purged. That is, if the file is renamed with the suffix specified via the ERR keyword, it will NOT be purged!

NEWLINE

By default, a stream is read until the carriage return–linefeed (CRLF, ASCII codes: 13 and 10) – the default line termination for ASCII files is encountered. However, it is useful to have the possibility to specify ‘whatever’ marker for the line end.

The NEWLINE keyword allows the user to specify a different set of line-end character(s):

NewLine Example:

NEWLINE = “event end>”

‘ or

NEWLINE = “STOP” OR “END” OR “EndOfLine”

‘ or

NEWLINE = 39,62

‘ or

NEWLINE = 13,10 OR 83,84,79,80

The following rules apply:

• The NEWLINE keyword is followed by one or more characters (characters can be enclosed in double quotes). The combination of all specified characters is then interpreted as the line end.

• Multiple OR-ed strings (enclosed in double quotes)

• The string comparisons are case SENSITIVE.

• Numbers are interpreted as ASCII codes separated by commas. Between commas, there cannot be any whitespaces.

• Multiple successions of ASCII codes (comma separated).

Successions can be OR-ed

• It is not possible to combine the characters and ASCII codes; that is, the following definition is NOT valid:

NEWLINE = “event end> 13,10”

• The default is CRLF; that is: 13,10

• The specified (line-end) characters are excluded from the message.

This way it is possible to configure the non-printable characters or characters that have a special meaning, like a white space, a single quote (‘), etc.

Note: See Appendix G: ASCII Codes Supported for a list of supported ASCII codes.

Note: The maximum line length supported by PI_UFL interface is

10K (10240) characters!

REN

File extension in case of successful file read. After the file is read, it thus gets this defined suffix. In addition, the original filename is suffixed with the time of reading; that is, local time when the file was processed by the interface. The default suffix is _OK. This time format is not configurable by the user.

Ren Example:

Ren = SUCC

‘The original file; e.g., data.txt is thus renamed to

‘data_20-Jan-2007_10-10-41.416.SUCC

WORDWRAP

Defines the fixed line size. If defined, it has higher priority than NEWLINE;

WordWrap Example:

‘ Data file content:

‘ TagName1 1 TagName2 2 TagName3 3 TagName4 4



‘ Lines recognized using WORDWRAP=11:

‘ TagName1 1

‘ TagName2 2

‘ TagName3 3

‘ TagName4 4

WORDWRAP = 11

Note: The maximum line length is 10K (10240) characters. Any attempt to define bigger WORDWRAP will end up with WORDWRAP=10240.

[PLUG-IN] – Serial Port

In case the Serial.dll is specified in the [INTERFACE] section, the following keywords are used to configure the specified serial port (RS 232) on the Interface Node.

BITS

Number of bits. Acceptable values:

4,5,6,7,8

Default value is 8.

Bits Example:

Bits = 8

COM

The serial port number; default value is 1.

Com Example:

Com = 1

COMDATA

Full path to a file storing raw data read from the serial port. When this parameter is specified, the interface stores all incoming characters from the serial port to a file. This is mostly useful for verification and troubleshooting purposes.

ComData Example:

ComData = c:\PIPC\Interfaces\PI_UFL\Logs\rawdata.txt

NEWLINE

See the NEWLINE description in chapter [PLUG-IN] – ASCII Files.

Note: The NEWLINE keyword definition does NOT support the Ors operators for the Serial Port PlugIn!

Default value is CRLF; that is: 13,10

NewLine Example:

NEWLINE = “event end>”

‘ or

NEWLINE = 13

PARITY

Parity. Acceptable patterns are:

EVEN

ODD

NO

MARK

SPACE

Default value is NO.

Parity Example:

Parity = even

SPEED

Baud Speed. Default value is 9600.

Speed Example:

Speed = 9600

STOPBITS

Number of stop-bits. Acceptable values and matching:

0 = 1 stop bit

1 = 1.5 stop bit

2 = 2 stop bits

Default value is 0.

StopBits Example:

StopBits = 0

Note: In case the Serial Port PlugIn fails to initialize, the interface prints the relevant error codes in the specified OUTPUT file. These errors are Microsoft Windows system error codes and their list can be found on Microsoft support Web sites (search for the results of the Windows function call GetLastError()).

Because the number of possible errors is big, we list just a few that occur most often:

2 – The system cannot find the file specified - the specified serial port probably does not exist.

5 – Access denied – the specified serial port is probably used by some other driver.

87 – The parameter is incorrect – one of the port parameters is not properly specified.

[PLUG-IN] – POP3

Principles of Operation

The POP3 PlugIn allows connecting to a specified POP3 server and periodically reading emails, which were sent to the specified user. The emails can contain attachments, but both – the email body as well as attachments, must be ASCII text. The PlugIn supports emails that comply with MIME format[3]). After processing, the emails are deleted from the POP3 server. However, there is a backup option available.

Note: The POP3 PlugIn works over a TCP/IP connection using TCP port 110. Communication over the SSL (Secure Socket Layer) on an alternate port 995 (also known as POP3S) is not supported.

If the POP3.dll is specified in the [INTERFACE] section, the following keywords are used to configure reading from the POP3 mail server.

POP3_SERVER

Address of the POP3 server. You must specify either the direct IP address or the name of the POP3 server.

Default value is localhost.

Example:

POP3_Server = mail.

POP3_PORT

Specify the Port number of the POP3 server.

Default value is 110.

Example:

POP3_Port = 110

POP3_USER

Email account / user name on the POP3 server.

Note: This keyword is mandatory.

Example:

POP3_User = ufl

POP3_PASSWORD

Specify the password for the given POP3 user.

Example:

POP3_Password = LetMeGo2PI

Note: The interface must be run in interactive mode in order to input the password and store it in the encrypted form. This encrypted password is persisted in the directory where the interface’s INI file is located and the name of the file is POP3.PWD. In case such a file exists, and there is no password defined in the INI file, the interface takes the password from this file. This allows starting the interface as a Windows service without the necessity to specify the POP3 password in the INI file.

[pic]

Figure 3. Entering the POP3 Password in Interactive Mode.

SMTP_SERVER

Address of the SMTP server which is then used to optionally forward incoming emails. Here you either specify the direct IP address or the name of the SMTP server.

See the FORWARD_TO description for more details.

Default value is the specified POP3 server.

Example:

SMTP_Server = mail.

SMTP_PORT

Specify the port number of the SMTP server.

Default value is 25.

Example:

SMTP_Port = 25

FORWARD_TO

Optionally specify a backup email address. This may be useful when emails need to be available after being processed or in case of errors.

When the keyword (FORWARD_TO) is NOT specified, all emails (for the specified user, see the keyword POP3_USER in this section) will be read, their content parsed by the interface and consequently deleted from the specified POP3 server.

With FORWARD_TO specifying a concrete email address, the content of the email (including the content of the attachments) is forwarded to this specified address.

The SMTP server and port number (through which the email is forwarded) are specified through keywords SMTP_SERVER and SMTP_PORT.

Default is no forwarding; see the keyword FORWARD_AS_UFLSTREAM below. In case the forwarding is enabled and no FORWARD_TO is specified, the interface will use the sender’s email address for FORWARD_TO.

Example:

Forward_To = uflBackup@

FORWARD_AS_UFLSTREAM

Enables email forwarding.

Default is False – means no forwarding.

Example:

Forward_As_UflStream = True

FILTER_FROM

This keyword causes the emails from specified address(es) to be processed. Emails from other sources will be ignored (but optionally forwarded to the backup address).

If more addresses are needed, they have to be divided by semicolons.

In case this keyword is not present, all emails (for the specified user, see the keyword POP3_USER in this section) will be examined by the interface.

Example:

Filter_From = me@;lab@

Note: Even if these emails are not processed, they will be deleted!

MAIL_FROM

Prepend From. The address from which the email arrived will be prepended at the beginning of the email body.

Default value is True.

Example:

‘ email lines will begin with

‘ [From] :mail4ufl@

‘ …

Mail_From = True

FROM_PREFIX

This may be useful when the email “From” is included with the MAIL_FROM keyword to distinguish the “From” entry from the other lines in the email.

Default value is [From]:

Example:

‘ email lines will begin with

‘ [Message From] :mail4ufl@

‘ …

From_Prefix = [Message From]:

MAIL_DATE

Prepend Date. The date, when the email was sent will be prepended at the beginning of the email body.

Default value is True.

Example:

‘ email lines will begin with

‘ [Date] :Thu, 15 May 2008 07 :16 :40 +0200

‘ …

Mail_Date = True

DATE_PREFIX

This may be useful when the email Date is included with the MAIL_DATE keyword to distinguish the Date entry from the other lines in the email.

Default value is [Date]:

Example:

‘ email lines will begin with

‘ [Message Date] :Thu, 15 May 2008 07 :16 :40 +0200

‘ …

Date_Prefix = [Message Date]:

MAIL_SUBJECT

Prepend Subject. The email Subject will be prepended at the beginning of the email body.

Default value is True.

Example:

‘ email lines will begin with

‘ [Subject] :4ufl

‘ …

Mail_Subject = True

SUBJECT_PREFIX

This may be useful when the email “Subject” is included with the MAIL_SUBJECT keyword to distinguish the “Subject” entry from the other lines in the email.

Default value is [Subject]:

Example:

‘ email lines will begin with

‘ [Message Subject] :4ufl

‘ …

Subject_Prefix = [Message Subject]:

MAIL_BODY

If set to false, the PlugIn will not take the email text lines and will thus not send them to the interface for parsing.

Default value is True.

Example:

Mail_Body = True

BODY_PREFIX

This may be useful when the keyword MAIL_BODY is True.

Default value is [Body]:

Example:

‘ email lines will begin with

‘ [Message Body] :

‘ 4ufl

‘ …

Body_Prefix = [Message Body]:

MAIL_ATTACHMENT

If set to false, the PlugIn will not read the attachments and will not send the attachment- content to the interface for parsing.

Default value is True.

Example:

Mail_Attachment = True

ATTACHMENT_PREFIX

This may be useful when the keyword MAIL_ATTACHMENT is True.

Default value is [Attachment]:

Example:

‘ email lines will begin with

‘ [Message Attachment] :

‘ 4ufl

‘ …

Attachment_Prefix = [Message Attachment]:

PFN

Prepend File Name. When set to True, the name of the attachment will be included as a separate line, the first line of the attachment content.

Default value is False.

PFN Example:

‘ Attachment File Name: attachedfile.txt

‘ …

‘ [FileName] :attachedfile.txt

‘ first line

‘ …

PFN = True

PFN_PREFIX

This may be useful when the attached filename is included with the PFN keyword. It may be of use to add a prefix to distinguish the filename line from the other lines in the attached file.

Default value is [FileName]:

Pfn_Prefix Example:

‘ Attachment File Name: attachedfile.txt

‘ …

‘ [Attached File Name] :attachedfile.txt

‘ first line

‘ …

PFN_Prefix = [Attached File Name]:

[SETTING]

This section is intended for various (generic) settings which are NOT data-source-specific. The following keywords are recognized:

DEB

Debug level. The interface maintains its own log file, where it redirects all kinds of messages – errors, as well as debug, or information messages (see the description of the OUTPUT keyword below). The higher the debug level the more detailed is the printout. The following table summarizes what is covered by individual levels:

|DeBug Level |Meaning |

|0 |No debug output. |

|Default | |

|1 |Tasks that are normally performed once; e.g. startup and shutdown messages, points added into the |

| |interface’s cache, etc. |

|2 |Same as 1, but with more details. |

|3 |Tasks that are performed regularly; with deb=3, the interface will e.g. print out (raw) data, |

| |extracted from the data streams. Raw data obtained from the PlugIn; |

|4 |Tasks that are performed regularly; with deb=4, the interface will e.g. print out data before |

| |sending it to PI. |

|5 |High level of reporting; e.g. read scan cycles start and end times; interface internal cache |

| |refresh cycles starts and ends times, etc. |

|6 |The most detailed level of reporting, including raw data lines read by PlugIn (before sending them |

| |to the main interface frame). |

Table 5. PI_UFL Interface Debug Levels

Note: The debug levels are cumulative; that is, the higher levels contain the info covered by the lover levels.

In case the OUTPUT keyword is omitted, the printout is redirected to the pipc.log located in the \PIPC\DAT directory.

Deb Example:

Deb = 4

MAXLOG

Maximum number of log files in the circular buffer. The interface starts overwriting the oldest log files when the MAXLOG has been reached. When not specified, the log files will be indexed indefinitely (see the OUTPUT keyword).

Maxlog Example:

Maxlog = 10

MAXLOGSIZE

Maximum size of the log file in MB. If this parameter is not specified, the default MAXLOGSIZE is 20 MB.

MaxLogSize Example (10 MegaBytes):

MaxLogSize = 10

The interface will create a new log-file (during the run-time), when the size reaches the specified number of megabytes.

[pic] CAUTION! Since version 3.0.3.16. the default MAXLOGSIZE has changed from 2 GigaBytes to 20 MegaBytes.

MSGINERROR

Defines the full path to the file, which stores not successfully processed messages.

MsgInError Example:

MsgInError = c:\pipc\interfaces\PI_UFL\logs\errors.txt

If, for instance, a certain item (message field) could not be sent to PI, because the PI Server was not reachable, or there was a bad format recognized during parsing of the input stream, the corresponding message is appended to the aforementioned file. In addition, such a message is prefixed with the current time and the error code (in square brackets) indicating the reason of the failure. Messages in this file can be re-processed later on.

Note: When no MSGINERROR keyword is used, the default error file is created in the directory where the configuration file is placed (/cf startup parameter);

the default name is MsgInError.log.

Note: See the /lb start-up parameter how it influences storing erroneous messages into this file.

OUTPUT

Defines the path to the interface specific log-file. This keyword works in conjunction with the DEB keyword. Upon startup, the interface always renames the specified log-file and creates the new one. The renaming mechanism suffixes the log-file name by the increasing ordinal number. The following example demonstrates how it works:

Output Example:

Output = c:\pipc\interfaces\PI_UFL\logs\PI_UFL.log

Should the above directory already have the file named pi_ufl.log, the next interface start will rename it to:

c:\PIPC\Interfaces\PI_UFL\logs\PI_UFL.log;1

and the next restart will rename it to .. PI_UFL.log;2

Note: When no OUTPUT keyword is used, all the messages are redirected to the pipc.log file.

LOCALE

Specifies how the interface transforms the string representation of numbers to the native numeric form; that is, which locale it will use. Thus, different decimal separators can be accepted. The list of all locale codes can be found at:



One can use the long as well as the short form, or directly through the numeric identifier (LCID) All three forms are equivalent. Following examples demonstrate it:

Example Locale

LOCALE = “German – Germany” ‘long form

or

LOCALE = “de-de” ‘short form

or

LOCALE = 1031 ‘LCID

Note: The default Locale is English – United States.

Example of the Configuration File Sections

‘---------------------------------------------------------------

[INTERFACE]

PLUG-IN = asciifiles.dll

[PLUG-IN]

ERR = BAD

IFM = “C:\PIPC\Interfaces\PI_UFL\Data\*.txt”

IFS = N

PURGETIME = 10d

[SETTING]

DEB = 1

MAXLOG = 50

MAXLOGSIZE = 10240

MSGINERROR = c:\pipc\interfaces\PI_UFL\logs\errors.txt

OUTPUT = c:\pipc\interfaces\PI_UFL\logs\pi_ufl.txt

LOCALE = de-de

‘---------------------------------------------------------------

[FIELD]



[FIELD]

The [FIELD] section is required and specifies the fields’ data types. In the [FIELD] section, one can also name the individual fields and/or to specify their format.

Note: The [FIELD] section starts the area of the Configuration File that describes the actual messages. Do not place any of the above stated sections ([INTERFACE], [PLUG-IN], [SETTING]) after the [FIELD] section!

In the [FIELD] section, the following keywords are recognized:

FIELD(n).Name

Depending on the input stream structure, users can specify as many field definitions as necessary. Like the [MSG] section (see the [MSG] chapter below), the fields can remain unnamed (the field’s indexed is taken instead; that is, FIELD(1), FIELD(2), ..). However, it is recommended users always give the field a descriptive name and use it in all references to the particular field later on.

Field(n).Name Example:

FIELD(n).Name = Value1

or

FIELD(n).Name = “Value 1”

A valid name starts with a letter (A-Z), followed by letters, digits (0-9) or an underscore characters. Letters are NOT case sensitive and the name with spaces needs to be enclosed in double quotes.

Note: Avoid any names that match the reserved keywords, like “FIELD”, “MSG”, “TIME”...

FIELD(n).Type

By default each field is of the type string. However, in certain cases, it is required the field is of certain data type. The following types are supported:

• String (default)

• Number (float type)

• Int32 (integer type)

• DateTime (Replacement for the data type Time used in PI_UFL 2.x; See chapter For Users of Previous (2.x) Interface Versions)

• Time

Note: DateTime is an instant in time; Time is an interval. Example: DateTime = 30-Mar-2007 08:00:00; Time = 08:00:00

• DSTFlag

Field(n).Type Example:

[FIELD]

FIELD(1).Type = String

If no type is specified, the String is the default – data is copied “as is”, no transformation is done.

FIELD(2).Type = Number

In this case the input data is converted to a number (internally it is Float64).

If the transformation cannot be done, an error is logged.

Note: Certain functions return and/or require the integer representation, use Int32 (instead of Number) in these cases.

FIELD(3).Type = DateTime

This is particularly useful when reading and interpreting DateTime (full Timestamp) strings from an input message. The expected DateTime format attribute can be specified via the FIELD(n).Format definition. See Table 6 below for more on supported keywords.

FIELD(4).Type = Time

Defines the Time data type. The FIELD(n).Format defines the pattern. See Table 6 below for more on supported keywords.

FIELD(n).Type = DSTFlag

This field type translates into the marker telling whether the timestamp is in Standard Time – ST, or in Daylight Savings Time – DST.

The FIELD(n).Type=DSTFlag also requires a FIELD(n).Format definition (see the description below in Field Type DSTFlag).

Note: Variables of type DSTFlag will internally be converted into an integer number 0 or 1. Any later calculations specified in the configuration file therefore must treat these variables as Number. Default value is 0, meaning Standard Time. See example below Field Type “DSTFlag”

FIELD(n).Format

The field types Time, DateTime and DSTFlag require a format specification. Only one format is allowed per field. If the format in the data file does not match the one specified and the field thus cannot be evaluated the runtime-error occurs.

Field(n).Format Example:

[FIELD]

Field(1).Name = Timestamp

Timestamp.Type = DateTime

Timestamp.Format = “dd-MMM-yy hh:mm:ss”, _

“Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec”

Note: The month’s names can be omitted when the month number is used in the timestamp pattern. The default for months’ abbreviations is as specified in the example above; that is, the first three letters of months in English.

Note: The format definition has to be enclosed in double quotes!

Assume an input line containing the following pattern:

‘ Data example:

‘ 27-Jul-06 13:11:10

As this timestamp pattern matches the format specification shown in the example above, the string pattern is transformed into the DateTime data type.

The following characters are recognized in the time format definition:

|Characters in format |Accepts the following from the input file |

|‘yy |Year, two digits. |

|‘yyyy |Year, four digits. |

|‘‘MM |Month, two digits. |

|‘M |Month, one or two digits. |

|‘‘MMM |Month, in string format. The exact spelling of the months is specified by the value of |

| |an additional parameter MonthList: |

| |“dd-MMM-yy”, “MonthsList”. In “MonthList”, each month has to be ‘named’ and separated by|

| |a comma. See examples below this table. |

| |The “MonthList” is optional. When not specified, the Us-En months abbreviations |

| |“Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec” |

| |are assumed. |

|‘dd |Day of the month, two digits. |

|D |Day of the month, one or two digits. |

|Hh |Hour, two digits. By default a 24-hour clock is assumed, unless p or pp is used to |

| |specify AM/PM. |

|H |Hour, one or two digits. |

|‘m |Minutes, one or two digits. |

|‘mm |Minutes, two digits. |

|‘s |Seconds, one or two digits. |

|‘ss |Seconds, two digits. |

|‘n |Tenths of a second. |

|‘nn |Hundredths of a second |

|‘nnn |Millisecondes |

|‘p |A/P for AM/PM. In this case a 12-hour clock is assumed. |

|‘pp |AM/PM. In this case a 12-hour clock is assumed. |

Table 6. Keywords for Timestamp Parsing

Note: The timestamp format string is CASE SENSITIVE !

Note: The format characters listed in the above table can be delimited by whatever (suitable) character; except for the month’s abbreviations, they must be comma delimited. See the pattern examples below:

DateTime and Time Format Strings Example:

“dd-MMM-yy hh:mm:ss”,_

“Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec”

‘ Foreign Language Example (months abbrev. Are in German):

„dd-MMM-yy hh:mm:ss“, _

„Jan,Feb,Mär,Apr,Mai,Jun,Jul,Aug,Sep,Okt,Nov,Dez“

‘ Other timestamp patterns (various delimiters):

“dd.MM.yy hh:mm”

“dd/MM/yy hh:mm:ss”

“M/d/yyyy hh:mm:ss.nnn”

“M_d_yyyy hh_mm_ss_nnn”

‘ …

Instead of a user-defined string format, two predefined numeric representations can be also used:

|Format string |Accepts the following from the input file |

|SECONDS_GMT |Number of seconds since 1970, in Universal Time Coordinated (UTC) |

|SECONDS_LOCAL |Number of seconds since 1970, in local time. |

Numeric Timestamps Example:

[FIELD]

Field(1).Name = Timestamp

Timestamp.Type = DateTime

Timestamp.Format = “SECONDS_GMT”

‘ The numeric formats allow an input line with timestamps as

‘ numbers; the number below thus translates into

‘30-May-06 00:00:00



1148940000

Field Type “DSTFlag”

The optional field type DSTFlag may be used to define the relationship of the timestamp field with Daylight Savings Time (DST). The Format property expects two words, delimited by a comma. The first word maps to a value of 0 (indicating no adjustment to DST), the second one maps to 1, meaning the time should be adjusted. Either of the two words is expected in the data file at the ‘DSTfield’ location. The way in which the time correction is applied depends on various scenarios. The example below adds the one hour offset whenever the input data is flagged with the ‘summer’ keyword. This will be suitable when the Interface Node is NOT configured for the automatic DST adjustment, while the input data may come from a source where the DST adjustment was already done.

Note: If the format property is omitted and the DSTFlag is used, the interface expects 0 or 1 in the input stream.

The following example shows how subtract one hour depending on the presence of the word winter or summer marker in the input data stream.

DSTFlag Example:

‘ Data file content:

‚ 01-Jun-2007 14:00:00

‚ Summer

‚ …

[FIELD]

FIELD(1).Name = “TimeStamp”

TimeStamp.Type = “DateTime”

FIELD(2).Name = “DSTOffset”

DSTOffset.Type = “Time”

‘…

FIELD(3).Name = “DSTField”

DSTField.Type = “DSTFlag”

DSTField.Format = “winter,summer”

‘…

DSTOffset = “01:00:00”

If(DSTFlag == 1) Then

TimeStamp = TimeStamp – DSTOffset

EndIf

[MSG]

The PI_UFL interface checks each line against a message filter and, in case the line passes it, the interface accepts the line and assigns it a certain message type. Normally, there is also more than one message type; therefore, more message filters thus need to be specified. In other words, it is expected that at least one message type will be defined in this section.

The [MSG] section is primarily designed to define message names. If the user can work with descriptive message names; the INI file becomes more readable. In addition, the [MSG] section serves a couple of other purposes. As already stated at the beginning of this text, the interface implements the automatic point creation. In the [MSG] section the user can specify which PI point types will be created on a per message basis. The following paragraphs summarize the supported keywords:

MSG(n).Name

Depending on the data file structure, the user can specify as many message names as necessary or the messages can remain unnamed (MSG(1), MSG(2), etc.). Once the name has been entered into the [MSG] section, it can be used in all consequent references.

A valid name starts with a letter (A-Z), followed by letters, digits (0-9) or an underscore. Letters are NOT case sensitive. Message names are NOT case sensitive and any name with spaces needs to be enclosed in double quotes.

Note: Avoid any message names with a predefined meaning, like “FIELD”, “MSG”, etc.!

Msg(n).Name Example:

[MSG]

MSG(1).Name = “HEADER”

MSG(2).Name = “DATA LINE”

MSG(n).EPC

Enable Point Creation. The specification is per message! The interface will only create a new PI tag when a line that satisfies the given message filter points to a tag that does not exist. The following PI point data types are supported:

Digital

Int16

Int32

Float32

Float64

String

Msg(n).Epc Example:

[MSG]

MSG(1).Epc = “Float32” ‘point type will be Float32

‘or’

MSG(2).Epc = “Digital” ‘point type will be Digital;

‘the MSG(n).DigitalSet keyword is ‘expected:

MSG(2).DigitalSet = “DigSetName”

‘ If there is NO MSG(n).DigitalSet keyword specified,

‘ the interface will create the state out of the arrived

‘ TagName + _SET.

MSG(n).EPC_Inherit

For the newly created points, inherit (copy) the tag attributes from the referenced tag.

Msg(n).Epc_Inherit Example:

[MSG]

MSG(1).Epc_Inherit = “Sinusoid” ‘The newly created tag will be ‘created with the same attributes ‘as Sinusoid.

Note: MSG(n).EPC and MSG(n).EPC_Inherit are mutually exclusive, use just one per message type.

MSG(n).DIGITALSET

If the MSG(n).EPC keyword (Enable Point Creation; see the description of this keyword below) specifies the Digital point type, the DIGITALSET keyword must define the digital state set, which is used while creating the PI point of the type Digital. In case this digital state set does not exist, the interface will create the needed set out of the TagName – giving it the suffix ‘_SET’. The behavior is thus as follows:

If the keyword MSG(n).DIGITALSTATE is NOT present, and the MSG(n).EPC=Digital, the interface will create the digital set like: TagName + _SET , else it will use the specified set.

Msg(n).DigitalSet Example:

[MSG]

MSG(1).DigitalSet = “UFL”

Note: The interface will also automatically add new digital states when it does not find a digital state. The automatic state addition is the default behavior; see the /des startup parameter description later on that disables the automatic digital state creation.

Message Structure Definitions: [MSG(n)]

This section is mandatory. That means, one or more message structure definitions [MSG(n)] must always be specified.

MSG(n).Filter

The filter sets the conditions for a line to be recognized as a specific message. At least one message filter definition is therefore required.

Note: Once a match is found, all other message definitions are ignored. The message belongs to the message type whose filter was ‘satisfied’ first.

Message filter definitions are read from top to bottom in the configuration file:

[MSG(1)]



[MSG(2)]



The evaluation order can be changed via the SetNextMsg() action. See this description later in this document.

MSG(n).Filter = Set Of Filter Conditions Example:

• The whole filter can consist of one or more filter conditions, which can be

AND-ed or OR-ed. Parentheses can be used for grouping.

• Each filter condition can be negated by the NOT keyword.

Message filter definitions can thus have the following syntax:

MSG(n).Filter = Cx == „Mask“

‘ or

MSG(n).Filter = Cx == “ Mask 1” OR Cy == “ Mask 2”

‘ or

MSG(n).Filter = NOT Cx == “ Mask 1” AND Cy == “ Mask 2”

‘ …

Where x, y define pattern-starting position.

Note: The pattern must be enclosed in double quotes.

Note: Indexing (x,y) is one based not zero based!

Mask Syntax

The following special characters are recognized in the mask string:

|Characters in mask declaration |Matches the following in a line from the input file |

|? |Any single character |

|* |Zero or more characters |

|# |Any single digit (0 — 9) |

|[character list] |Any single character in character list. |

| |Must be enclosed in square brackets! |

|[!character list] |Any single character not in the character list. |

| |Must be enclosed in square brackets! |

|( ) |A section in the pattern declaration that is enclosed in parentheses |

| |indicates that this section of the input line must be extracted. |

|\ |To match any of the above mentioned characters with a special meaning, |

| |you can either put the character within square brackets [ ] or prefix it |

| |with a backslash \. To have a literal match on the slash \ itself, use |

| |\\. |

Table 7. Message Filter Specification

Example 1. Basic Filter Condition

[MSG(1)]

MSG(1).Filter = NOT C1==”!*” AND C10==”TAG*” AND C30==”VALUE*”

‘ In this case, a line matches the filter if:



‘ NOT C1==”!*” line doesn’t start with an exclamation mark !

‘ C10==”TAG*” line, from position 10 on does have the

‘ string TAG followed by any number of characters

‘ C30==”VALUE*” line from position 30 on has the string VALUE

‘ followed by any number of characters



‘The following data line would match the filter criteria:

‘1234 TAG=mytag VALUE=10.0

Example 2. Filter Condition and Character List [xyz]

[MSG(1)]

‘ In this case a line satisfies the filter if

‘ any of the characters in square brackets are found

[MSG(1)]

MSG(1).Filter = C1 == “State.City.[ABC].*”

[MSG(2)]

MSG(2).Filter = C1 == “Plant.Area.Operation.[XYZ]*”

‘ MSG(1) filter will then be satisfied with the following:

‘ State.City.A.*, State.City.B.*, State.City.C.*

‘ and the MSG(2) filter will like the following:

‘ Plant.Area.Operation.X.*, Plant.Area.Operation.Y.*,

‘ Plant.Area.Operation.Z.*

Example 3. Filter Condition and Character List with ! Operator

[MSG(1)]

‘ In this case a line satisfies the filter if

‘ the character(s) in square brackets are NOT found

MSG(1).Filter = C1 == “State.City.[!DEF].*”

[MSG(2)]

MSG(2).Filter = C1 == “Plant.Area.Operation.[!OPQ]*”

Data Extraction to Fields

Field(n).Value

Once a line had passed the filter check, it becomes a message; the next step is to break it into smaller units – fields. This is achieved through the Field(n) = construction. Fields (variables) must already be declared in the [Field] Section (see section [FIELD]) and can be referenced either by their names defined in FIELD(n).Name (recommended) or just by the corresponding index Field(n).

Data Extraction

Each part of the message can be assigned to an individual field through a simple assignment.

Field(n) = Cx – Cy

Field(n) will take characters from position x to position y.

Note: - x and y positions are included

- the positioning is one based

Field(n) = Cx – Cy(“Mask”)

Field(n) = Cx – (“Mask”)

Field(n) = Cx(“Mask”) – (“Mask”)

The Cx-Cy (fixed position) construct can be extended and become the more generic one: Cx(“Mask”) ; the Cx can even be omitted.

Note: The Cx(“Mask”) construct is exclusive; in contrast to Cx-Cy, which does take the characters at positions x and y.

Field(n) = [“(Mask), Mask, Mask”]

This is the most complicated, nevertheless the most powerful extraction mechanism.

The user can specify a mask in the standard wild-card notation and the message will be divided to fields applying this mask(s) specification. To indicate which part of the message needs to be assigned to a particular field, the parentheses ( ) marker is needed.

Mask Syntax

The following special characters are recognized as mask patterns:

|Characters in mask declaration |Matches the following in a line from the input file |

|? |Any single character |

|* |Zero or more characters |

|# |Any single digit (0 — 9) |

|[character string] |Any single character in character string. |

| |Must be enclosed in square brackets |

|[!character string] |Any single character not in character string. |

| |Must be enclosed in square brackets |

|( ) |A section in the mask declaration that is enclosed in parentheses ( ) |

| |denotes this part of the input line that is taken. |

|\ |To match any of the above mentioned characters with a special meaning, |

| |one can either put the character within the square brackets [ ] or prefix|

| |it with a backslash \. |

| |To have a literal match on a backslash, use \\. |

Table 8. Field Filter Specification

Example 1. Field Assignment at Fixed Positions

‘ Field 1 will get the 1st 10 characters from the input line

FIELD(1) = C1 – C10

Example 2. Cx(“Mask”) Construct

‘ Field 2 will get characters at position 11 up to (but NOT

‘ including) the 1st comma ‘,’ after position 11

FIELD(2) = C11 – C11(“,”)

Example 3. Mask Without Cx specification

‘ Field 3 will start after the 1st comma ‘,’ after position 11 up

‘ to (but not including) the 1st comma ‘,’ after that

FIELD(3) = C11(“,”) – (“,”)

Example 4. Mask with [xyz] Construct

‘ Field 4 will get characters starting at position 31 up to (but ‘ not including) the 1st semi-colon ‘; ‘ comma ‘,’ or colon ‘:’

‘ after position 41

FIELD(4) = C31 – C41(“[;,:]”)

Example 5. Mask with [!xyz] Construct

‘ Field 5 will get characters starting at position 51 up to

‘ (but not including) the 1st NON-DIGIT after position 51

FIELD(5) = C51 – C51(“[!0123456789]”)

Example 6. Mask and NEWLINE

‘ Field 6 will get characters from Cx(“Mask”) till

‘ the end of the line

FIELD(6) = Cx(“Mask”) – NEWLINE

Example 7. Mask with Parenthesis

‘ Assume the input file is csv (comma separated values),

‘ but the positions of individual fields vary. The mask with

‘ parenthesis is the most suitable method of parsing the message.

‘ REM: The last field (status) is NOT separated by comma; it is

‘ enclosed in double quotation marks. The example shows how to use ‘ the escape character (back slash \) so that the double

‘ quotation marks can be used as delimiters. Thus, in addition,

‘ the quotation marks are stripped (which is mostly desirable).

‘ TagName, Timestamp, Value “Status”

‘ TagName, Timestamp, Value “Status”

‘ …

FIELD(1) = [“(*),*,*\”*\””]

FIELD(2) = [“*,(*),*\”*\””]

FIELD(3) = [“*,*,(*)\”*\””]

FIELD(4) = [“*,*,*\”(*)\””]

Data Manipulation

Fields (variables) can take part in arithmetic expressions. The following rules must be taken into account when these expressions are set in the INI file:

• The resulting value of an expression on the right hand side (of an assignment) is stored into the variable on the left hand side.

• The data types of all operands in the expression on the assignment’s right hand side are implicitly converted as needed. E.g., when two operands are added using a ‘+’ operator, both operands are interpreted as numbers.

Arithmetic and Logical Operators

|Operator |Meaning |Data Types Operands |

|* / |Multiply and Divide |Number, |

| | |Time |

|+ - |Add and Subtract. |Number, |

| | |DateTime, Time |

|& |String concatenation. |String |

|AND |Logical AND |Number |

| |The logical AND will check if both operands are different | |

| |from 0; if so, the result will be 1 else the result will be | |

| |0. | |

|OR |Logical OR. |Number |

| |The logical OR will check if one or both operands are | |

| |different from 0; if so, the result will be 1 else the result| |

| |will be 0 | |

Table 9. Supported Arithmetic Operators

Note: PI_UFL supports arithmetic operators for all numeric data types. And, in addition, it supports the following operator overloads:

DateTime Operator+(x DateTime, y Time)

DateTime Operator+(x Time y DateTime)

Time Operator+(x Time, y Time)

Time Operator-(x DateTime, y DateTime)

DateTime Operator-(x DateTime, y Time)

Time Operator-(x Time, y Time)

Time Operator*(x Int32, y Time)

Time Operator*(x Time, y Int32)

Time Operator/(x Time, y Int32)

Mathematical Functions

|Operator |Meaning |Data Types Operands |

|ABS |Absolute value. |Number ABS(x Number) |

|ACOS, ASIN,ATAN, ATAN2, |Trigonometric functions. |Number ACOS(x Number) |

|COS,COSH, |Return value is in radians. |… |

|SIN,SINH,TAN,TANH | |Number ATAN2(x Number, y Number) |

|CEILING |Rounds a number with a fractional |Number CEILING(x Number) |

| |portion to the next highest integer. | |

|EXP |Exponential value. |Number EXP(x Number) |

|FLOOR |Largest integer less than or equal to|Number FLOOR(x Number) |

| |the given numeric expression. | |

|LOG,LOG10 |Logarithmic value. |Number LOG(x Number) |

|PI |3.14 |Number PI() |

|ROUND |Round the value. |Number ROUND(x Number) |

Table 10. Supported Mathematical Functions

String Functions

|Operator |Meaning |Data Types Operands |

|CONCAT |Concatenate two strings. |String CONCAT(x String, y String) |

|INSTR |Returns the position of the given |Int INSTR(x String, ubstring String, |

| |occurrence |start Int, occurrence Int) |

| |of a specified substring. | |

|LOWER |All characters lower-case. |String LOWER (x String) |

|LEFT |Leftmost count of characters. |String LEFT(x String, n Int) |

|LEN |Number of characters excluding |Int LEN (x String) |

| |leading and trailing blanks. | |

|LTRIM |Trim the leading blanks. |String LTRIM (x String) |

|REPLACE |Find the given string and replace it|String REPLACE (x String, findWhat String, |

| |with the third parameter. |replaceWith String) |

|RIGHT |Rightmost count of characters. |String RIGHT(x String, n Int) |

|RTRIM |Trim the trailing blanks. |String RTRIM (x String) |

|SPACE |Character string consisting of n |String SPACE (n Int) |

| |spaces. | |

|SUBSTR |String consisting of len characters |String SUBSTR(x String, start Int, len Int) |

| |starting at start position. | |

|TRIM |Trim the leading and ending blanks. |String TRIM (x String) |

|UPPER |All characters upper-case. |String UPPER (x String) |

Table 11. Supported String Functions

DateTime and Time Functions

|Operator |Meaning |Data Types Operands |

|DAY |Extracts the Day from DateTime. |Int32 DAY(x DateTime) |

|FRACTION |Extracts the Subsecond part from |Float64 FRACTION(x DateTime) |

| |DateTime. |Float64 FRACTION(x Time) |

|HOUR |Extracts the Hour from DateTime. |Int32 HOUR(x DateTime) |

| | |Int32 HOUR(x Time) |

|MINUTE |Extracts the Minute from DateTime. |Int32 MINUTE(x DateTime) |

| | |Int32 MINUTE(x Time) |

|MONTH |Extracts the Month from DateTime. |Int32 MONTH(x DateTime) |

|MONTHNAME |Extracts the Month Name from |String MONTHNAME(x DateTime) |

| |DateTime. | |

|SECOND |Extracts the Second from DateTime and|Int32 SECOND(x DateTime) |

| |Time. |Int32 SECOND(x Time) |

|WEEK |Extracts the Week from DateTime. |Int32 WEEK(x DateTime) |

|YEAR |Extracts the Year from DateTime. |Int32 YEAR(x DateTime) |

Table 12. DateTime and Time Functions

IF Statement

The IF statement can have the following form:

IF THEN ELSE ENDIF

or

IF THEN ENDIF

::=

{[NOT] | ()}

[{AND | OR} ]

[, …]

::=

{ = | > | < | >= | FIELD(2)) THEN

FIELD(2)=2*FIELD(2)

ELSE

FIELD(2)=FIELD(1)

ENDIF

Example 6. IF Statement (2)

[FIELDS]

FIELD(1).Type = “DateTime”

FIELD(2).Type = “DateTime”

FIELD(3).Type = “Time”

[MSG(1)]

‘ Data file content:

‘ 25-Jan-2007;01-Nov-2007;01:00:00

FIELD(1) = [“(*);*;*”]

FIELD(2) = [“*;(*);*”]

FIELD(3) = [“*;*;(*)”]

IF (FIELD(1) > FIELD(2)) THEN

‘ Add one hour

FIELD(1) = FIELD(1) + FIELD(3)

ENDIF

Example 7. IF Statement (3)

[FIELD]

FIELD(1).Type = “String”

FIELD(2).Type = “DateTime”

FIELD(3).Type = “Number”

[MSG(1)]

‘ Data file content:

‘ Tag1; 23-Oct-2007 01:00:00; 1

FIELD(1) = [“(*);*;*”]

FIELD(2) = [“*;(*);*”]

FIELD(3) = [“*;*;(*)”]

‘ Only store in PI when a valid tagname has been extracted

IF (FIELD(1) IS NOT NULL) THEN

StoreInPI(FIELD(1),,FIELD(2),FIELD(3),)

ENDIF

Example 8. IF Statement (4)

[FIELDS]

FIELD(1).Name = “TimeVar”

FIELD(1).Type = “Time”

FIELD(1).Format = “m”

FIELD(2).Name = “TimeOffset”

FIELD(2).Type = “Time”

FIELD(2).Format = “hh:mm:ss”

FIELD(3).Name = “DateVar”

FIELD(3).Type = “DateTime”

FIELD(3).Format = “yyyymmdd “

FIELD(4).Name = “TimestampVar”

FIELD(4).Type = “DateTime”

FIELD(5).Name = “TagNameVar”

FIELD(6).Name = “ValueVar1”

FIELD(6).Type = “Number”

FIELD(7).Name = “ValueVar2”

FIELD(7).Type = “Number”

‘ …

‘ Data file content:

‚ 200,TagName1,kWh,30,

‚ 300,20071201,,1,1.2,1.1,1.12,1.01,…

‚ …

[MSG(1)]

MSG(1).NAME = “DataDetails”

MSG(2).NAME = “Values”

‘ …

[Values]

Values.FILTER = C1==”300*”

‘ There can be multiple expressions in the IF() construct:

‘ …

TimeOffset = “00:30:00”

IF (TimeVar == TimeOffset) THEN

TimestampVar = DateVar + TimeVar

StoreInPI(TagNameVar,,TimestampVar,ValueVar1,,)

TimestampVar = TimestampVar + TimeVar

StoreInPI(TagNameVar,,TimestampVar,ValueVar2,,)

TimestampVar = TimestampVar + TimeVar

‘ …

ENDIF

MSG(n).Action

All actions that can be performed on individual messages have to have the following format:

MSG(n).Action = ActionName (Optional Parameters)

Below is the list of actions that are implemented:

AppendLines(i)

The next i lines (after a line had been identified a message) will be appended.

This action is useful when data spans several lines in the input file.

Example AppendLines

It is required to concatenate the data lines below using AppendLines(), because some lines do not have appropriate pattern for the filter:

‘ Data file content:



‘ BATCH: B1;

‘ 05-Feb-07 12:00:00;

‘ Mixture1



‘ UNIT: U1;

‘ 05-Feb-07 12:10:00;

‘ Blue

‘ INI file content:

[MSG]

MSG(1).Name = “Batch_MSG”

MSG(2).Name = “Unit_MSG”

[Batch_MSG]

Batch_MSG.Filter = C1 == “Batch*”

Batch_MSG.Action = AppendLines(2)

Batch = [“*(*);*;*”]

TimeStamp = [“*:*;(*);*”]

Value = [“*:*;*;(*)”]

StoreInPI(Batch,,TimeStamp,Value,,)

[Unit_MSG]

Unit_MSG.Filter = C1 == “Unit*”

Unit_MSG.Action = AppendLines(2)

Unit = [“*(*);*;*”]

TimeStamp = [“*:*;(*);*”]

Value = [“*:*;*;(*)”]

StoreInPI(Unit,,TimeStamp,Value,,)

Results:

BATCH: B1; 05-Feb-07 12:0:00; Mixture1

UNIT: U1; 05-Feb-07 12:10:00; Blue

DateTimeFromJulian(Number)

DateTimeFromJulian() converts the number, which represents the interval of time in days and fractions of a day, since January 14713 BC Greenwich noon, to PI Timestamp.

Example DateTimeFromJulian

[FIELDS]

FIELD(1).Name = “TagName”

FIELD(2).Name = “TimeNumber”

FIELD(2).Type = “Number”

FIELD(3).Name = “Value”

FIELD(3).Type = “Number”

‘...

StoreInPI(TagName,,DateTimeFromJulian(TimeNumber),Value,,)

Now()

Now() gets the current local timestamp. The data type Now() returns is DateTime.

Note: Now() returns the same timestamp for all messages from a file. When lines are read from the serial port, it is guaranteed that every line gets unique timestamp!

Example Now

‘ See the description of StoreInPI() below in this chapter

StoreInPI (TagName,,Now(),Value,,)

SetNextMsg (MSG, NumberOfMsgs)

This construct is useful when one needs to change the preference of a message filter.

The filters of any individual message are applied in the order as they are specified in the INI file; that is, the filter of MSG(1) is applied first, MSG(2) second and so on. SetNextMsg() allows changing this order. Assume for example a line that satisfies filter MSG(1), then, a certain number of rows that come next need to be checked against MSG(2) (not against MSG(1)). SetNextMsg() allows changing the default order of the message filters.

SetNextMsg() will force the next NumberOfMsgs lines to be checked against the filter of the specified MSG. The second parameter – NumberOfMsgs is optional.

• If the second parameter is not specified, all consequent lines read from the input file will be checked against the filter of the message MSG until a line is encountered that does not satisfy this filter.

• If the second parameter is greater than or equal to 0, then, the next NumberOfMsgs lines will be checked against the filter of the message MSG until a line is encountered that does not satisfy this filter.

The referenced message – MSG, can be identified by its name or by its index:

MSG(1).Action = SetNextMsg (“OtherMsg”,)

MSG(1).Action = SetNextMsg (3,)

Following example demonstrates how to use SetNextMessage():

SetNextMsg Example:

‘ Data file content:



‘ Name, Timestamp, Value

‘ Tag1 , 05-Feb-07 12:00:00 , 1

‘ Tag1 , 05-Feb-07 12:10:00 , 2



‘ INI file content:

[FIELD]

FIELD(1).NAME = “TagName”

FIELD(2).NAME = “Timestamp”

Timestamp.TYPE = “DateTime”

Timestamp.FORMAT = “dd-MMM-yy hh:mm:ss”

FIELD(3).NAME = “Value”

FIELD(3).TYPE = “Number”

[MSG]

MSG(1).Name = “Description”

MSG(2).Name = “Events”

[Description]

Description.Filter = C1 == “Name, Timestamp, Value”

‘ Check the next couple of lines in the context of MSG(2)

‘ until there is a line that does not satisfy the filter

Tag.Action = SetNextMsg (“Events”,)

[Events]

Events.Filter = C1 == “*,*,*”

FIELD(1) = [“(*),*,*”]

FIELD(2) = [“*,(*),*”]

FIELD(3) = [“*,*,(*)”]

StoreInPI (TagName,,Timestamp,Value,,)

Note: The SetNextMsg() in PI_UFL 2.x could have variable number of parameters (one or two); in PI_UFL version 3.x it must have exactly two!

SkipFile()

This will instruct the interface to skip the rest of the lines that arrived in a batch of input stream lines, for example in a data file. SkipFile() can be used when a certain message indicates that the incoming data is actually invalid.

Example SkipFile

‘ Data file content:



‘ Invalid Sample

‘ Name, Timestamp, Value

‘ Tag1 , 05-Feb-07 12:00:00 , 1

‘ Tag1 , 05-Feb-07 12:10:00 , 2



‘ INI file content:

[MSG]

MSG(1).Name = “FileValidation”

MSG(2).Name = “MSG1”

[FileValidation]

FileValidation.Filter = C1 == “Invalid*”

SkipFile()

[MSG1]



SkipLines(i)

This will instruct the interface to skip the next i lines from an input stream. SkipLines() can be used to bypass certain number of irrelevant lines.

Example SkipLines

‘ Data file content:



‘ Name, Timestamp, Value

‘ Tag1 , 05-Feb-07 12:00:00 , 1

‘ Tag1 , 05-Feb-07 12:10:00 , -1

‘ , , ,

‘ Tag1 , 05-Feb-07 12:20:00 , 2

‘ Tag1 , 05-Feb-07 12:30:00 , 3

‘...



‘ INI file content:

[MSG]

MSG(1).Name = „MSG1“

[MSG1]

MSG1.Filter = C1 == “*,*,*”

FIELD(1) = [“(*),*,*”]

FIELD(2) = [“*,(*),*”]

FIELD(3) = [“*,*,(*)”]

IF (FIELD(3) < 0) Then

SkipLines(1)

Else

StoreInPI(FIELD(1),, FIELD(2), FIELD(3),,)

EndIf

StoreInPI (Tag, InstrumentTag, Timestamp, Value, Status, Questionable, [Annotation])

This action will send the Timestamp, Value, Status, the Questionable flag and the Annotation to PI for the given PI tag. Certain parameters are optional and can be omitted. The following paragraphs discuss the individual StoreInPI() parameters in more detail:

Tag & InstrumentTag

The function can address a PI tag according to its name – first parameter, or via the InstrumentTag – the function’s second parameter. Either the Tag name or the InstrumentTag must be provided. If both are given, the tag name is used.

Timestamp

The timestamp is in local time; that is, it reflects the time zone and the DST settings of the computer where the PI_UFL interface runs. The Timestamp parameter has to be of type DateTime.

Note: New data type DateTime has been introduced in PI_UFL version 3.x. It is a change to previous PI_UFL version where the data type was named Time.

If, in PI_UFL 3.x+ the data type Time is used in StoreInPI() the interface will print-out an error:

[StoreInPi] Overload resolution failed for (StoreInPi) argument(s).

Note: An empty “Timestamp” parameter defaults to the current (local) time.

Value

The Value field can be Number or a String.

Note: For digital points, the value can be in both forms – Number as well as String. The former represents the offset into the digital point’s state set;

the latter is translated into the corresponding digital code.

Status

The Status field is optional. Status can only be the data type Number. It then represents the ordinal in the PI System digital set. Status has higher priority than the Value. That means, if the Status is not zero, the Value is invalid.

Questionable

The Questionable parameter is optional. The questionable flag indicates that there is some reason to doubt the accuracy of the value. The parameter is Numeric. Non-zero values indicate the questionable flag will be set.

Annotation

The Annotation parameter is optional. When the StoreInPI() function has 7 parameters, the interface will use the PI SDK for sending this PI data record. PI Annotations are Variants and PI_UFL will store them as variant of the type: String , Number or DateTime (variant type VT_BSTR, VT_R8 or VT_DATE), depending on the PI_UFL variable type, that is, the corresponding field type defined in section [FIELD].

Note: Some parameters can remain empty, but the commas must be included. The user must supply the commas so that the interface ‘knows’ which parameters were used. See the Example 1 below.

Return Value

The StoreInPI() returns 0 if the operation was successful, otherwise it returns a code from the corresponding PI API or PI SDK call. For example -11046, which means –target date in future. The user can check the return code for success in the configuration file, and perform an action based on the result. (See Example 2 below).The MSG(n).Action token can thus be replaced with an ordinary variable as shown in Example 2 below.

Note: The construction MSG_NAME.ACTION=StoreInPI() is still supported, however, one can assign the result of StoreInPI() to a variable directly, as shown in Example 2 below.

Example 1. StoreInPI

‘ Write a value of FIELD(1) to the tag ‘test:001’;use current time

MSG(1).Action = StoreInPi (“test:001”,,,FIELD(1),,,)

Example 2. StoreInPI

‘ Write the “full” PI data record. In this case, the StoreInPI()

‘ will be made using PI SDK (a value is present at the Annotation

‘ position)



‘INI file content:

[FIELD]

FIELD(1).NAME = “PI_TAG”

FIELD(1).Type = “String”

FIELD(2).NAME = “PI_TIMESTAMP”

FIELD(2).Type = “DateTime”

FIELD(2).FORMAT = “yyyy-MM-dd hh:mm:ss”

FIELD(3).NAME = “PI_VALUE”

FIELD(3).Type = “Number”

FIELD(4).NAME = “PI_STATUS”

FIELD(4).Type = “Number”

FIELD(5).NAME = “PI_QFLAG”

FIELD(5).Type = “Number”

FIELD(6).NAME = “PI_ANNOTATION”

FIELD(6).Type = “String”

FIELD(7).NAME = “RESULT”

FIELD(7).Type = “Number”

[MSG]

MSG(1).Name = „Msg1“

[Msg1]

Msg1.Filter = C1 == “-“



‘ Field filters



Result = StoreInPI(PI_TAG,, _

PI_TIMESTAMP, _

PI_VALUE, _

PI_STATUS, _

PI_QFLAG, _

PI_ANNOTATION)

‘ The Result value can then be checked in the IF construct.

IF( RESULT 0) Then

StoreInPI(“UFL_Error_Tag”,,,Result,,)

EndIf

Graphical User Interface (GUI)

Facilitating the INI File Creation

The above chapter about the PI_UFL INI file shows that the Interface flexibility is immense. On the other hand, the more features an interface has the more difficult and self-intuitive is to configure it. In order to address this, the GUI facilitating an INI File creation has been created. The utility allows creating a simple INI file, just by mouse-clicking, selecting options from the predefined lists and going through simple wizards. In addition, many features can also be added manually as well as an existing INI files can be modified.

Note: The parsing and extraction routines used in the GUI are the same as in the PI_UFL Interface; therefore, the INI created through the GUI is guaranteed to work with the interface seamlessly.

It would contradict the purpose of the GUI if we start describing the utility in detail; therefore, the next section will depict just several screenshots, which show how to click the GUI through in order to get a workable INI file.

In order to simplify the description to the maximum possible extent, the used data file will resemble the simple structure, which can be processed by the OSIsoft’s Batch File Interface; that means, a comma separated list of items consisting of :

TagName, TimeStamp, Value, Status

TagName, TimeStamp, Value, Status

The GUI can be also launched from the PI Interface Configuration Utility (ICU):

[pic]

• When started through the ICU, the referenced INI file (if it already exists) will be automatically loaded or, the new (empty) INI opened:

[pic]

• The GUI executable is located in the PI_UFL interface directory; subdirectory GUI; that is:

\PIPC\Interfaces\PI_UFL\GUI\UFLDesigner.exe.

• In order to create a workable INI file, the following steps need to be taken:

1. If a new INI file needs to be created, the corresponding PlugIn (ASCIIFiles, Serial or POP3) must be selected:

[pic]

Note: Once the PlugIn is selected, the GUI does not allow changing it!

2. Depending on the selected PlugIn (ASCIIFiles, Serial or POP3) in the General window, window number one, the PlugIn related parameters need to be specified. The entries in this window reflect the keywords listed in the [INTERFACE] section in the previous chapter.

[pic]

3. Defining the variables in the Variables window (window number two).

[pic]

The individual variables are added by clicking the green plus sign in the top-left corner. The variable can be named and its type specified.

4. Next window defines the message types. Adding a new message type occurs in window number three – Message Types; the green plus sign again adds the new message type. In the Message Types window one can name the message, define the message filter and add several parameters, which reflect the keywords listed in section [MSG].

Provided the data file is loaded into the GUI, selecting the given message type and pressing the Test Filter button selects only those lines, which pass the specified message filter.

[pic]

5. In the window number four – Data Extraction, users can work with the defined message types and extract and assign the concrete parts of the message to variables. Pressing the green plus sign will guide you through a wizard like dialog sequences. These steps resemble the MS Excel dialogs for importing text data into the spreadsheet:

Three basic modes allowing what type of message division will be used:

[pic]

Various delimiters are supported in the Delimited mode:

[pic]

Variables can be assigned by drag and dropping them to the column headers:

[pic]

6. The last, number five window Action allows defining what actions can be done with the messages and variables. The most important action is to specify the StoreInPI() function. The individual parameters of this function can be also dragged and dropped:

[pic]

[pic]

• Pressing the Preview INI File [pic] icon and consequently Parse INI File [pic] finishes the INI file creation.

Startup Command File

Command-line parameters can begin with a / or with a -. For example, the /ps=U and –ps=U command-line parameters are equivalent.

Command file names have the .bat extension. The continuation character (^) allows one to use multiple lines for the startup command. The maximum length of each line is 1024 characters (1 kilobyte). The number of flags is unlimited, and the maximum length of each flag is 1024 characters.

The majority of the PI_UFL interface start-up parameters are specified in the configuration file (.INI file). The full path to it is specified via the startup parameter /cf. Along with the /cf parameter the startup command file defines all the parameters that define the connection to the PI Server. See the Command-line Parameters table below. The other parameters are given through the configuration file and are divided into sections. The chapter Configuration File has more details.

Configuring PI_UFL Interface with PI ICU

Note: PI ICU requires PI 3.3 or greater.

The PI Interface Configuration Utility provides a graphical user interface for configuring PI interfaces. If the interface is configured by the PI ICU, the batch file of the interface (PI_UFL.bat) will be maintained by the PI ICU and all configuration changes will be kept in that file and the module database. The procedure below describes the necessary steps for using PI ICU to configure the PI_UFL Interface.

From the PI ICU menu, select Interface, then New Windows Interface Instance from EXE..., and then Browse to the PI_UFL.exe executable file. Then, enter values for Point Source and Interface ID#. A window such as the following results:

[pic]

“Interface name as displayed in the ICU (optional)” will have PI- pre-pended to this name and it will be the display name in the services menu.

Click on Add and the following display should appear:

[pic]

Note that in this example the Host PI System is srvtest.osisoft.cz. To configure the interface to communicate with a remote PI Server, select ‘Interface => Connections…’ item from PI ICU menu and select the default server. If the remote node is not present in the list of servers, it can be added.

Once the interface is added to PI ICU, near the top of the main PI ICU screen, the Interface Type should be UFL. If not, use the drop-down box to change the Interface Type to be UFL.

Click on Apply to enable the PI ICU to manage this copy of the UFL Interface.

[pic]

The next step is to make selections in the interface-specific tab (i.e. “ufl”) that allow the user to enter values for the startup parameters that are particular to the PI UFL Interface.

[pic]

To set up the interface as a Windows Service, use the Service page. This page allows configuration of the interface to run as a service as well as to starting and stopping of the interface. The interface can also be run interactively from the PI ICU. To do that go to Menu, select the Interface item and then Start Interactive.

For more detailed information on how to use the above-mentioned and other PI ICU pages and selections, please refer to the PI Interface Configuration Utility User Manual. The next section describes the selections that are available from the UFL page. Once selections have been made on the PI ICU GUI, press the Apply button in order for PI ICU to make these changes to the interface’s startup file.

UFL Interface page

Since the startup file of the PI_UFL Interface is maintained automatically by the PI ICU, use the ufl page to configure the startup parameters and do not make changes in the file manually. The following is the description of interface configuration parameters used in the PI ICU Control and corresponding manual parameters.

UFL

The PI_UFL ICU Control for PI ICU has 1 section. A yellow text box indicates that an invalid value has been entered, or that a required value has not been entered.

[pic]

Configuration File

Enter the name of the INI file to use with this instance of the interface or click on the browse button[pic]. The command line equivalent is /CF=.

Send data to PI Archive

LaBoratory. If this parameter is present, the interface will store the data directly to the PI Archive. In case some events already exist at the given timestamp, they will be by default replaced. See the /am at the beginning of this table on how to change the mode. This archive mode is then used for all tags (regardless of Location5 of individual tags). The command line equivalent is /LB.

Note: The /lb start-up switch also causes the events are queued in the interface (see the related start up parameters /ws and /wd, which can be used to parameterize this queue); the queue is flushed (events are sent to PI in a bulk) before each scan class or when the queue is full. The consequence of it is that the interface cannot “immediately react” on any run-time error – like for example “Target Date In Future” or “Point does not Exist”. That is, the interface cannot store the “erroneous” line into the MSGInError file (because these error messages are “discovered” only when the buffer is flushed).

Archive Mode

When the PI API bulk calls are configured (see the /lb) the following modes can be specified:

3 (ARCNOREPLACE) add unless event(s) exist at same time (PI 2.x).

4 (ARCAPPEND) add event regardless of existing events.

5 (ARCREPLACE) add event, replace if event at same time.

6 (ARCREPLACEX) replace existing event (fail if no event at time).

7 (ARCDELETE) remove existing event.

8 (ARCAPPENDX) add event regardless of existing events,

with no compression.

The command line equivalent is /AM=#, Default: 5 (ARCREPLACE).

Note: This startup parameter does not apply when values are sent through the PI SDK call (StoreInPI() contains the annotation parameter). For PI SDK calls the archive mode is specified through the Location5.

Read Before Overwrite

Check this box to enable the read before overwrite function. This mode of operation will do an archive read first (to see if the value exists at the given timestamp) and will send the new value only if it is different. Also, this mode only works when Location5=1 and NO /lb start up parameter is set. The reason is that /lb means sending data in bulks and some events may still not be in PI Archives when the reading occurs. The command line equivalent is /RBO.

Use UTC Timestamps

When specified; the timestamps read from the data file are forwarded to PI as UTC timestamps. The command line equivalent is /UTC.

Run Once and Exit

If present, the interface executes once and exits. For the PlugIn ASCIIFiles it means it processes the existing files in the given directory and exits; for the PlugIn POP3 it processes all the existing emails and exits. For the Serial PlugIn this start-up parameter does not make sense. The command line equivalent is RunOnce.

Launch UFLDesigner.exe

This button when clicked will start the UFLDesigner.exe program to help in the configuration of the INI file.

Tag Mask

When specified, the interface will load all points matching this tag mask prior to Runtime operation. This is especially useful:

➢ when using the Instrument Tag to identify the tags to store data in

➢ when it is required to limit the write operations to a subset of tags

The tag mask complies to the PI Tag Search rules; that means,

the wildcard characters are * or ?. The command line equivalent is /TM=.

Default Error Status

Default Error Status. This status will be stored in PI when the digital status string cannot be translated. N is the index of the desired state from the PI System Digital Set. The command line equivalent is DES=#.

Note: This startup parameter does closely relate to the MSG(n).DIGITALSET keyword. If the /des=# is present, the interface will NOT try to automatically extend the digital sets when the non-existing state arrives. The specified index (#) to the system digital state will be used instead.

Write Delay (ms)

Write Delay, in milliseconds, between two bulk writes to the PI archive. Used to tune the load on the PI Archive and the network. See also the /ws=# below. The command line equivalent is /WD=#, Default: 10 milliseconds.

Write Size (# events)

Write Size. Maximum number of values written in one (bulk) call to the PI Archive.

This parameter can be used to tune (throttle) the load on the PI Archive.

With the UFL, it is possible to load huge amounts of data in a short time; for example, when loading files covering a long time periods,

the /ws /wd can be used to throttle the load. The command line equivalent is /WS=#, Default: 10240 events.

Command-line Parameters

The command-line parameters applicable with the PI_UFL interface are listed alphabetically in the table below:

|Parameter |Description |

|/am=# |Archive Mode. |

|Optional |When the PI API bulk calls are configured (see the /lb) the following modes can be |

| |specified: |

| |3 (ARCNOREPLACE) add unless event(s) exist at same time (PI 2.x). |

| |4 (ARCAPPEND) add event regardless of existing events. |

| |5 (ARCREPLACE) add event, replace if event at same time. |

| |6 (ARCREPLACEX) replace existing event (fail if no event at time). |

| |7 (ARCDELETE) remove existing event. |

| |8 (ARCAPPENDX) add event regardless of existing events, |

| |with no compression. |

| | |

| |Default is 5 (ARCREPLACE). |

| |Note: This startup parameter does not apply when values are sent through the PI SDK call |

| |(StoreInPI() contains the annotation parameter). For PI SDK calls the archive mode is |

| |specified through the Location5. |

|/cf=xxx.yyy |The full path pointing to the Configuration File |

|Required | |

|/des=# |Default Error Status. This status will be stored in PI when the digital status string |

|Optional |cannot be translated. N is the index of the desired state from the PI System Digital Set.|

| | |

| |Note: This startup parameter does closely relate to the MSG(n).DIGITALSET keyword. If the|

| |/des=# is present, the interface will NOT try to automatically extend the digital sets |

| |when the non-existing state arrives. The specified index (#) to the system digital state|

| |will be used instead. |

|/ec=# |Event Counter. The /ec parameter on the command-line is used to specify a counter number,|

|Optional |#, for an I/O Rate point. If the # is not specified, then the default event counter is 1.|

| |Also, if the /ec parameter is not specified at all, there is still a default event |

| |counter of 1 associated with the interface. If there is an I/O Rate point that is |

| |associated with an event counter of 1, each copy of the interface that is running without|

| |/ec=#explicitly defined will write to the same I/O Rate point. This means either |

| |explicitly defining an event counter other than 1 for each copy of the interface or not |

| |associating any I/O Rate points with event counter 1. Configuration of I/O Rate points is|

| |discussed in the section called “I/O Rate Tag Configuration.” |

|/f=HH:MM:SS |The /f parameter defines the time period between scans in terms of hours HH, minutes MM, |

|or |and seconds SS. |

|/f=SS |Example of one minute scan class: |

|Required |/f=00:01:00 |

| | |

| |Note: With the PI_UFL interface, only the first instance of the /f flag on the command |

| |line is taken into account! |

| | |

| |Note: Unlike other OSIsoft interfaces, PI_UFL does NOT support offset (to support scans |

| |at discrete moments in time)! |

|/host=host:port |The /host parameter is used to specify the PI Home node. Host is the IP address of the |

|Optional |PI Sever node or the domain name of the PI Server node. Port is the port number for |

| |TCP/IP communication. The port is always 5450 for a PI 3 Server. It is recommended to |

| |explicitly define the host and port on the command line with the /host parameter. |

| |Nevertheless, if either the host or port is not specified, the interface will attempt to |

| |use defaults: The default port name and server name is specified in the pilogin.ini or |

| |piclient.ini file. The piclient.ini file is ignored if a pilogin.ini file is found. Refer|

| |to the PI API Installation Instructions manual for more information on the piclient.ini |

| |and pilogin.ini files. |

| |Examples: |

| |The interface is running on a PI Interface node, the domain name of the PI 3 home node is|

| |Marvin, and the IP address of Marvin is 206.79.198.30. Valid /host flags would be: |

| |/host=marvin |

| |/host=marvin:5450 |

| |/host=206.79.198.30 |

| |/host=206.79.198.30:5450 |

|/lb |LaBoratory. If this parameter is present, the interface will store the data directly to |

|Optional |the PI Archive. In case some events already exist at the given timestamp, they will be by|

| |default replaced. See the /am at the beginning of this table on how to change the mode. |

| |This archive mode is then used for all tags (regardless of Location5 of individual tags).|

| |Note: The /lb start-up switch also causes the events are queued in the interface (see |

| |the related start up parameters /ws and /wd, which can be used to parameterize this |

| |queue); the queue is flushed (events are sent to PI in a bulk) before each scan class or |

| |when the queue is full. The consequence of it is that the interface cannot “immediately |

| |react” on any run-time error – like for example “Target Date In Future” or “Point does |

| |not Exist”. That is, the interface cannot store the “erroneous” line into the MSGInError |

| |file (because these error messages are “discovered” only when the buffer is flushed). |

|/ps=xxx |Specifies the Point Source characters for the interface. When specified, the interface |

|Optional |will load those PI points prior to run-time operation. This is especially useful: |

| |when using the instrument tag to identify the tags |

| |when it is required to limit the write operations to a subset of tags |

| |The point source can be any single or multiple character string and |

| |the evaluation is case insensitive. |

|/q |Queued. Events are sent to PI archive through the pisn_sendexceptionqx() PI API function.|

|Optional |The snapshot ratio is then significantly faster comparing to the event-by-event sending, |

| |which occurs when the /q is not present. |

|/rbo |Read Before Overwrite. This mode of operation will do an archive read first (to see if |

|Optional |the value exists at the given timestamp) and will send the new value only if it is |

| |different. Also, this mode only works when Location5=1 and NO /lb start up parameter is |

| |set. The reason is that /lb means sending data in bulks and some events may still not be |

| |in PI Archives when the reading occurs. |

| |Note: In the current PI_UFL version the /rbo does NOT have any effect when events are |

| |sent to PI through PI SDK calls! |

|/runonce |If present, the interface executes once and exits. For the PlugIn ASCIIFiles it means it |

|Optional |processes the existing files in the given directory and exits; for the PlugIn POP3 it |

| |processes all the existing emails and exits. For the Serial PlugIn this start-up |

| |parameter does not make sense. |

|/tm=xxx* |Tag Mask. |

|or |When specified, the interface will load all points matching this tag mask prior to |

|/tm=”xxx xxx*” |Runtime operation. This is especially useful: |

| |when using the Instrument Tag to identify the tags to store data in |

|Optional |when it is required to limit the write operations to a subset of tags |

| |The tag mask complies to the PI Tag Search rules; that means, |

| |the wildcard characters are * or ?. |

|/utc |Universal Time Coordinated |

|Optional |When specified; the timestamps read from the data file are forwarded to PI as UTC |

| |timestamps. |

|/wd=# |Write Delay, in milliseconds, between two bulk writes to the PI archive. Default is 10ms.|

|Optional |Used to tune the load on the PI Archive and the network. See also the /ws=# below. |

|/ws=# |Write Size. Maximum number of values written in one (bulk) call to the PI Archive; |

|Optional |default is 10240 events per bulk. |

| |This parameter can be used to tune (throttle) the load on the PI Archive. |

| | |

| |With the UFL, it is possible to load huge amounts of data in a short time; for example, |

| |when loading files covering a long time periods, |

| |the /ws /wd can be used to throttle the load. |

Table 13. PI_UFL Startup Parameters

Sample PI_UFL.bat File

The following is an example startup file:

REM ==================================================================

REM PI_UFL.bat_new

REM

REM Sample startup file for the Universal File Loader Interface Ver3

REM to the PI System

REM

REM ==================================================================

REM

REM Sample Command Line

REM

PI_UFL.EXE ^

/host=XXXXXX:5450 ^

/ps=UFL ^

/f=00:01:00 ^

/cf=”C:\Program Files\PIPC\Interfaces\PI_UFL\pi_ufl_cfg.ini” ^

/lb

REM

REM end of PI_UFL.bat_new file

Interface Node Clock

Make sure that the time and time zone settings on the computer are correct. To confirm, run the Date/Time applet located in the Windows Control Panel. If the locale where the Interface Node resides observes Daylight Saving Time, check the box marked “Automatically adjust clock for daylight saving changes”. For example,

[pic]

In addition, make sure that the TZ environment variable is not defined. All of the currently defined environment variables can be viewed by opening a Command Prompt window and typing set. That is, C:> set

Make sure that the TZ environment variable is not defined. All of the currently defined environment variables can be viewed by opening a Command Prompt window and typing set. Confirm that TZ is not in the resulting list. If it is, run the System applet of the Control Panel, click the Environment tab, and remove TZ from the list of environment variables.

Security

Windows

The PI Firewall Database and the PI Proxy Database must be configured so that the interface is allowed to write data to the PI Server. See “Modifying the Firewall Database” and “Modifying the Proxy Database” in the PI Server manuals.

Note that the Trust Database, which is maintained by the Base Subsystem, replaces the Proxy Database used prior to PI version 3.3. The Trust Database maintains all the functionality of the proxy mechanism while being more secure.

See “Trust Login Security” in the chapter “PI System Management” of the PI Universal Data Server System Management Guide.

If the interface cannot write data to the PI Server because it has insufficient privileges, a –10401 error will be reported in the pipc.log file. If the interface cannot send data to a PI2 Serve, it writes a –999 error. See the section Appendix A: Error and Informational Messages for additional information on error messaging.

PI Server v3.3 and Higher

Security configuration using piconfig

For PI Server v3.3 and higher, the following example demonstrates how to edit the PI Trust table:

C:\PI\adm> piconfig

@table pitrust

@mode create

@istr Trust,IPAddr,NetMask,PIUser

a_trust_name,192.168.100.11,255.255.255.255,piadmin

@quit

For the above,

Trust: An arbitrary name for the trust table entry; in the above example,

a_trust_name

IPAddr: the IP Address of the computer running the Interface; in the above example,

192.168.100.11

NetMask: the network mask; 255.255.255.255 specifies an exact match with IPAddr

PIUser: the PI user the Interface to be entrusted as; piadmin is usually an appropriate user

Security Configuring using Trust Editor

The Trust Editor PlugIn for PI System Management Tools 3.x may also be used to edit the PI Trust table.

See the PI System Management chapter in the PI Server manual for more details on security configuration.

PI Server v3.2

For PI Server v3.2, the following example demonstrates how to edit the PI Proxy table:

C:\PI\adm> piconfig

@table pi_gen,piproxy

@mode create

@istr host,proxyaccount

piapimachine,piadmin

@quit

In place of piapimachine, put the name of the PI Interface Node as it is seen by PI Server.

Starting / Stopping PI_UFL Interface

This section describes starting and stopping the interface once it has been installed as a service. See the UniInt Interface User Manual to run the interface interactively.

[pic]

Starting Interface as a Service

If the interface was installed as service, it can be started from the services control panel or directly with the command:

PI_UFL.exe –start

To start the interface service with PI ICU, use the [pic] button on the PI ICU toolbar.

A message will inform the user of the status of the interface service. Even if the message indicates that the service has started successfully, double check through the Services control panel applet. Services may terminate immediately after startup for a variety of reasons, and one typical reason is that the service is not able to find the command-line parameters in the associated .bat file. Verify that the root name of the .bat file and the .exe file are the same, and that the .bat file and the .exe file are in the same directory. Further troubleshooting of services might require consulting the pipc.log file, Windows Event Viewer, or other sources of log messages. See the section Appendix A: Error and Informational Messages for additional information.

Pausing Interface

Users can temporarily ‘pause’ the interface operation and resume it again:

PI_UFL.exe –pause

PI_UFL.exe –continue

Stopping Interface Running as a Service

If the interface was installed as service, it can be stopped at any time from PI ICU, the services control panel or with the command:

PI_UFL.exe –stop

The service can be removed (uninstall) by:

PI_UFL.exe –remove

To stop the interface service with PI ICU, use the [pic] button on the PI ICU toolbar.

Buffering

PI_UFL and Buffering

Note: PI_UFL is not a “classic OSIsoft interface”, which usually periodically copies current values from a DCS (Distributed Control System) and stores them in PI; the characteristics of the “UFL like” data collection (and several other implemented features) require considering using Buffering from various angles:

Data redundancy

- With ASCII files, the data is actually “buffered” on the hard drive, because any failure while reading or sending events to PI Archive is accompanied by either marking the given file with a certain suffix (indicating this file needs to be reprocessed later on) or storing the line, which did not make it to PI, in a separate place (see section MSGINERROR for more details).

- The POP3 data source is relatively similar to ASCII files, because the FORWARD_TO allows “copying” the emails to the specified address and any data loss can thus be recovered from the backed-up location.

- Finally, the Serial PlugIn, through the keyword COMDATA allows for storing the incoming streams in a file, which, again, can be reprocessed in case the interface encounters problems.

In general, PI_UFL offers means for reprocessing the not delivered events to PI manually.

PI_UFL implements features, which do not work with Buffering

- PI_UFL uses PI SDK for sending events with Annotations; as PI SDK bypasses Buffering the annotated events will not make it to PI, when PI server is not available.

- PI point and Digital Sets/States automatic creation is also implemented through

PI SDK calls; point #1 therefore also applies here.

- Sending annotated events to a collective (HA) will end up with annotated events not making it to the non-primary PI Servers.

- The /RBO start-up parameter causes the interface reads an event from the PI Archive every time before it attempts to store a new one (at a given timestamp) in PI. With Buffering in place (and PI Server not available) this configuration won’t work.

- PI_UFL maintains its internal cache of PI Points and Digital Sets/States and keeping this cache in sync with PI means poling PI Server. As Buffering is a component, which is one-directional (from an interface to PI Server), the polling will generate runtime errors when PI Server is down or not reachable.

The features and scenarios described above are not meant to imply PI_UFL should not be used with Buffering; it is just useful to think about them when the question of using buffering and PI_UFL arises. In the majority of cases PI Buffering and PI_UFL will work smoothly!

Buffering refers to an Interface Node’s ability to temporarily store the data that interfaces collect and to forward these data to the appropriate PI Servers. OSIsoft strongly recommends that you enable buffering on your Interface Nodes. Otherwise, if the Interface Node stops communicating with the PI Server, you lose the data that your interfaces collect.

The PI SDK installation kit installs two buffering applications: the PI Buffer Subsystem (PIBufss) and the PI API Buffer Server (Bufserv). PIBufss and Bufserv are mutually exclusive; that is, on a particular computer, you can run only one of them at any given time.

If you have PI Servers that are part of a PI Collective, PIBufss supports n-way buffering. N-way buffering refers to the ability of a buffering application to send the same data to each of the PI Servers in a PI Collective. (Bufserv also supports n-way buffering, but OSIsoft recommends to run PIBufss instead.)

Which Buffering Application to Use

You should use PIBufss whenever possible because it offers better throughput than Bufserv. In addition, if the interfaces on an Interface Node are sending data to a PI Collective, PIBufss guarantees identical data in the archive records of all the PI Servers that are part of that collective.

You can use PIBufss only under the following conditions:

• the PI Server version is at least 3.4.375.x; and

• all of the interfaces running on the Interface Node send data to the same PI Server or to the same PI Collective.

If any of the following scenarios apply, you must use Bufserv:

• the PI Server version is earlier than 3.4.375.x; or

• the Interface Node runs multiple interfaces, and these interfaces send data to multiple PI Servers that are not part of a single PI Collective.

If an Interface Node runs multiple interfaces, and these interfaces send data to two or more PI Collectives, then neither PIBufss nor Bufserv is appropriate. The reason is that PIBufss and Bufserv can buffer data only to a single collective. If you need to buffer to more than one PI Collective, you need to use two or more Interface Nodes to run your interfaces.

It is technically possible to run Bufserv on the PI Server Node. However, OSIsoft does not recommend this configuration.

How Buffering Works

A complete technical description of PIBufss and Bufserv is beyond the scope of this document. However, the following paragraphs provide some insights on how buffering works.

When an Interface Node has Buffering enabled, the buffering application (PIBufss or Bufserv) connects to the PI Server. It also creates shared memory storage.

When an interface program makes a PI API function call that writes data to the PI Server (for example, pisn_sendexceptionqx()), the PI API checks whether buffering is enabled. If it is, these data writing functions do not send the interface data to the PI Server. Instead, they write the data to the shared memory storage that the buffering application created.

The buffering application (either Bufserv or PIBufss) in turn

• reads the data in shared memory, and

• if a connection to the PI Server exists, sends the data to the PI Server; or

• if there is no connection to the PI Server, continues to store the data in shared memory (if shared memory storage is available) or writes the data to disk (if shared memory storage is full).

When the buffering application re-establishes connection to the PI Server, it writes to the PI Server the interface data contained in both shared memory storage and disk.

(Before sending data to the PI Server, PIBufss performs further tasks such data validation and data compression, but the description of these tasks is beyond the scope of this document.)

When PIBufss writes interface data to disk, it writes to multiple files. The names of these buffering files are PIBUFQ_*.DAT.

When Bufserv writes interface data to disk, it writes to a single file. The name of its buffering file is APIBUF.DAT.

As a previous paragraph indicates, PIBufss and Bufserv create shared memory storage at startup. These memory buffers must be large enough to accommodate the data that an interface collects during a single scan. Otherwise, the interface may fail to write all its collected data to the memory buffers, resulting in data loss. The buffering configuration section of this chapter provides guidelines for sizing these memory buffers.

When buffering is enabled, it affects the entire Interface Node. That is, you do not have a scenario whereby the buffering application buffers data for one interface running on an Interface Node but not for another interface running on the same Interface Node.

Buffering and PI Server Security

After you enable buffering, it is the buffering application—and not the interface program—that writes data to the PI Server. If the PI Server’s trust table contains a trust entry that allows all applications on an Interface Node to write data, then the buffering application is able write data to the PI Server.

However, if the PI Server contains an interface-specific PI Trust entry that allows a particular interface program to write data, you must have a PI Trust entry specific to buffering. The following are the appropriate entries for the Application Name field of a PI Trust entry:

|Buffering Application |Application Name field for PI Trust |

|PI Buffer Subsystem |PIBufss.exe |

|PI API Buffer Server |APIBE (if the PI API is using 4 character process names) |

| |APIBUF (if the PI API is using 8 character process names) |

To use a process name greater than 4 characters in length for a trust application name, use the LONGAPPNAME=1 in the PIClient.ini file.

Enabling Buffering on an Interface Node with the ICU

The ICU allows you to select either PIBufss or Bufserv as the buffering application for your Interface Node. Run the ICU and select Tools > Buffering.

Choose Buffer Type

[pic]

To select PIBufss as the buffering application, choose Enable buffering with PI Buffer Subsystem.

To select Bufserv as the buffering application, choose Enable buffering with API Buffer Server.

If a warning message such as the following appears, click Yes.

[pic]

Buffering Settings

There are a number of settings that affect the operation of PIBuffss and Bufserv. The Buffering Settings section allows you to set these parameters. If you do not enter values for these parameters, PIBuffss and Bufserv use default values.

PIBufss

For PIBuffss, the paragraphs below describe the settings that may require user intervention. Please contact OSIsoft Technical Support for assistance in further optimizing these and all remaining settings.

[pic]

Primary and Secondary Memory Buffer Size (Bytes)

This is a key parameter for buffering performance. The sum of these two memory buffer sizes must be large enough to accommodate the data that an interface collects during a single scan. A typical event with a Float32 point type requires about 25 bytes. If an interface writes data to 5,000 points, it can potentially send 125,000 bytes (25 * 5000) of data in one scan. As a result, the size of each memory buffer should be 62,500 bytes.

The default value of these memory buffers is 32,768 bytes.

Send rate (milliseconds)

Send rate is the time in milliseconds that PIBufss waits between sending up to the Maximum transfer objects (described below) to the PI Server. The default value is 100. The valid range is 0 to 2,000,000.

Maximum transfer objects

Maximum transfer objects is the maximum number of events that PIBufss sends between each Send rate pause. The default value is 500. The valid range is 1 to 2,000,000.

Event Queue File Size (Mbytes)

This is the size of the event queue files. PIBufss stores the buffered data to these files. The default value is 32. The range is 8 to 131072 (8 to 128 Gbytes). Please see the section entitled, “Queue File Sizing” in the pibufss.chm file for details on how to appropriately size the event queue files.

Event Queue Path

This is the location of the event queue file. The default value is [PIHOME]\DAT.

For optimal performance and reliability, OSIsoft recommends that you place the PIBufss event queue files on a different drive/controller from the system drive and the drive with the Windows paging file. (By default, these two drives are the same.)

Bufserv

For Bufserv, the paragraphs below describe the settings that may require user intervention. Please contact OSIsoft Technical Support for assistance in further optimizing these and all remaining settings.

[pic]

Maximum buffer file size (KB)

This is the maximum size of the buffer file ([PIHOME]\DAT\APIBUF.DAT). When Bufserv cannot communicate with the PI Server, it writes and appends data to this file. When the buffer file reaches this maximum size, Bufserv discards data.

The default value is 2,000,000 KB, which is about 2 GB. The range is from 1 to 2,000,000.

Primary and Secondary Memory Buffer Size (Bytes)

This is a key parameter for buffering performance. The sum of these two memory buffer sizes must be large enough to accommodate the data that an interface collects during a single scan. A typical event with a Float32 point type requires about 25 bytes. If an interface writes data to 5,000 points, it can potentially send 125,000 bytes (25 * 5000) of data in one scan. As a result, the size of each memory buffer should be 62,500 bytes.

The default value of these memory buffers is 32,768 bytes.

Send rate (milliseconds)

Send rate is the time in milliseconds that Bufserv waits between sending up to the Maximum transfer objects (described below) to the PI Server. The default value is 100. The valid range is 0 to 2,000,000.

Maximum transfer objects

Max transfer objects is the maximum number of events that Buferv sends between each Send rate pause. The default value is 500. The valid range is 1 to 2,000,000.

Buffered Servers

The Buffered Servers section allows you to define the PI Servers or PI Collective that the buffering application writes data.

PIBufss

PIBufss buffers data only to a single PI Server or a PI Collective. Select the PI Server or the PI Collective from the Buffering to collective/server drop down list box.

The following screen shows that PIBufss is configured to write data to a standalone PI Server named starlight. Notice that the Replicate data to all collective member nodes check box is disabled because this PI Server is not part of a collective. (PIBufss automatically detects whether a PI Server is part of a collective.)

[pic]

The following screen shows that PIBufss is configured to write data to a PI Collective named admiral. By default, PIBufss replicates data to all collective members. That is, it provides n-way buffering.

You can override this option by not checking the Replicate data to all collective member nodes check box. Then, uncheck (or check) the PI Server collective members as desired.

[pic]

Bufserv

Bufserv buffers data to a standalone PI Server, or to multiple standalone PI Servers. (If you want to buffer to multiple PI Servers that are part of a PI Collective, you should use PIBufss.)

If the PI Server to which you want Buferv to buffer data is not in the Server list, enter its name in the Add a server box and click the Add Server button. This PI Server name must be identical to the API Hostname entry:

[pic]

The following screen shows that Bufserv is configured to write to a standalone PI Server named etamp390. You use this configuration when all the interfaces on the Interface Node write data to etamp390.

[pic]

The following screen shows that Bufserv is configured to write to two standalone PI Servers, one named etamp390 and the other one named starlight. You use this configuration when some of the interfaces on the Interface Node write data to etamp390 and some write to starlight.

[pic]

Installing Buffering as a Service

Both the PIBufss and Bufserv applications run as a Service.

PI Buffer Subsystem Service

Use the PI Buffer Subsystem Service page to configure PIBufss as a Service. This page also allows you to start and stop the PIBufss service.

PIBufss does not require the logon rights of the local administrator account. It is sufficient to use the LocalSystem account instead. Although the screen below shows asterisks for the LocalSystem password, this account does not have a password.

[pic]

[pic]

API Buffer Server Service

Use the API Buffer Server Service page to configure Bufserv as a Service. This page also allows you to start and stop the Bufserv Service

Bufserv version 1.6 and later does not require the logon rights of the local administrator account. It is sufficient to use the LocalSystem account instead. Although the screen below shows asterisks for the LocalSystem password, this account does not have a password.

[pic]

Interface Diagnostics Configuration

The Interface Point Configuration chapter provides information on building PI points for collecting data from the device. This chapter describes the configuration of points related to interface diagnostics.

Scan Class Performance Points

A Scan Class Performance Point measures the amount of time (in seconds) that this Interface takes to complete a scan. The Interface writes this scan completion time to millisecond resolution. Scan completion times close to 0 indicate that the Interface is performing optimally. Conversely, long scan completion times indicate an increased risk of missed or skipped scans. To prevent missed or skipped scans, you should distribute the data collection points among more interface instances.

You can only configure one Performance Point, for this Interface supports just one scan class. It is required to restart the Interface in order to write values to the Scan Class Performance Point.

Performance Counters Points

This interface does NOT support Scan Class Performance Points!

Interface Health Monitoring Points

Interface Health Monitoring Points provide information about the health of this Interface.

Creating Health Monitoring Points Using the PI Tag Configurator

In order to make it easy to create the Health Monitoring Points the interface install kit include a sample PI Tag Configurator spreadsheet

PI_UFL_Sample_HealthPoints.xls

Before using this spreadsheet you will have to make some changes. These changes are listed in comment within the spreadsheet. The OSIsoft PI Tag Configurator and Microsoft Excel also required. You can get the PI Tag Configurator from OSIsoft Download Center at the following URL:



[UI_IF_INFO]

The [UI_IF_INFO] Health Point is the Interface Information Point. This point provides information for all interfaces that connect to a PI Server. The value of this point is a string that indicates:

• the node name on which an interface is running

• the IP address on which an interface is running

• an interface’s executable name

• an interface’s Point Source parameter

• an interface’s Interface ID parameter

• an interface’s Scan Classes

• the number of points in an interface’s point list

• the number of messages to pipc.log that an interface has written

• the number of seconds that an interface has been running

An example value for the Interface Information Point is:

ifnodename | 192.168.8.72 | PI_UFL | UFL | ID N/A |

1 Scan Class: 5 | Points 10 | Message Count 31 | Up Time 1234

This Interface updates the value of the Interface Information Point every 30 minutes.

[UI_HEARTBEAT]

The [UI_HEARTBEAT] Health Point indicates whether the Interface is currently running. The value of this point is an integer that increments continuously from 1 to 15. After reaching 15, the value resets to 1.

The fastest scan class frequency determines the frequency at which the Interface updates this point:

|Fastest Scan Frequency |Update frequency |

|Less than 1 second |1 second |

|Between 1 and 60 seconds, |Scan frequency |

|inclusive | |

|More than 60 seconds |60 seconds |

If the value of the [UI_HEARTBEAT] Health Point is not changing, then this Interface is in an unresponsive state.

[UI_DEVSTAT]

The [UI_DEVSTAT] Health Point provides an indication of the connection status between the Interface and the PLC(s) or PLC gateway. The possible values for this string point are:

• “Starting” – The Interface remains in this state until it has successfully initialized the given PI_UFL PlugIn..

• “Good” – This value indicates that the Interface was able to connect to all of the devices referenced in the Interface’s point configuration. A value of “Good” does not mean that all tags are receiving good values, but it is a good indication that there are no hardware or network problems.

• “Intf Shutdown“ – The Interface has shut down.

Note: Due to the concept of PlugIns the device status Health Point does not always fully indicate the actual status of the interfaced data source; in fact, it rather shows the status of the PlugIn itself. More precisely, it shows if the PlugIn has been successfully initialized.

Some PI_UFL PlugIns establish the (permanent) connection during initialization – ASCIIFiles and Serial, while the POP3 PlugIn always connects at the beginning of each scan and then closes the link at the scan end. Therefore, the value of “Good” in this Health Point needs to be combined with values from other Health Points (UI_MSGCOUNT, UI_SCIORATE, I/O Rate point, PERFORMANCE_POINT, etc.) in order to find out the interface has problems communicating with the data source.

[UI_SCINFO]

The [UI_SCINFO] Health Point provides scan class information. The value of this point is a string that indicates

• the number of scan classes;

• the update frequency of the [UI_HEARTBEAT] Health Point

• the scan class frequency

An example value for the [UI_SCINFO] Health Point is:

1 | 5 | 120

The Interface updates the value of this point at startup and then each 8 hours.

[UI_IORATE]

The [UI_IORATE] Health Point indicates the sum of the number of scan-based input values the Interface collects before it performs exception reporting.

The Interface updates this point at the same frequency as the [UI_HEARTBEAT] point’s. The value of this [UI_IORATE] Health Point may be zero. A stale timestamp for this point indicates that this Interface has stopped collecting data.

[UI_MSGCOUNT]

The [UI_MSGCOUNT] Health Point tracks the number of messages that the Interface has written to the interface specific log file since start-up. In general, a large number for this point indicates that the Interface is encountering problems or has been/is run with high debug level. You should investigate the cause of these problems by looking in the corresponding log file.

The Interface updates the value of this point every 60 seconds. While the Interface is running, the value of this point never decreases.

[UI_OUTPUTRATE]

[UI_OUTPUTBVRATE]

[UI_TRIGGERRATE]

[UI_TRIGGERBVRATE]

These four Health Points are NOT implemented in PI_UFL interface.

[UI_SCPOINTCOUNT]

This Health Point monitors the number of tags in a Scan Class. The Interface updates

the [UI_SCPOINTCOUNT] Health Point when it performs the scan.

[UI_SCIORATE]

This Health Point indicates the number of events that the Interface has collected. If the current value of this point is between zero and the corresponding [UI_SCPOINTCOUNT] point, inclusive, then the Interface executed the scan successfully. If a [UI_SCIORATE] point stops updating, then this condition indicates that an error has occurred and the tags for the scan class are no longer receiving new data.

The Interface updates the value of a [UI_SCIORATE] point after the completion of the associated scan.

[UI_SCBVRATE]

This Health Point indicates the number System Digital State values that the Interface has collected. The Interface updates the value of a [UI_SCBVRATE] point after the completion of the scan.

[UI_SCSKIPPED]

Represents the number of scans that the Interface was not able to perform before the scan time elapsed and before the Interface performed the next scheduled scan.

The Interface updates the value of this point each time it skips a scan. The value represents the total number of skipped scans. The Interface resets the value of this point to zero each 8 hours.

[UI_SCSCANCOUNT]

Represents the number of scans that the Interface has performed. The Interface updates the value of this point at the completion of the associated scan. The Interface resets the value to zero each 8 hours.

[UI_SCINSCANTIME]

Represents the amount of time (in milliseconds) the Interface takes to read data from the device, fill in the values for the tags, and send the values to the PI Server.

The Interface updates the value of this point at the completion of the scan.

[UI_SCINDEVSCANTIME]

Represents the amount of time (in milliseconds) the Interface takes to read data from the device and fill in the values for the tags.

Normally, the value of a [UI_ SCINDEVSCANTIME] point is a fraction of the corresponding [UI_SCINSCANTIME] point value. You can use these numbers to determine the percentage of time the Interface spends communicating with the device compared with the percentage of time communicating with the PI Server.

If the [UI_SCSKIPPED] value is increasing, the [UI_SCINSCANTIME] points along with the [UI_SCINSCANTIME] points can help identify where the delay is occurring: whether the reason is communication with the device, communication with the PI Server, or elsewhere.

The Interface updates the value of this point at the completion of the scan.

Note: Neither of the two above described Health Points; that is, UI_SCINSCANTIME and UI_SCINDEVSCANTIME will actually show the time how long it took to read the data from the corresponding data source. Both Health Points show just the amount of time needed to process the data, which the interface obtained from the used PlugIn. The UI_SCINSCANTIME will thus always be bigger than UI_SCINDEVSCANTIME, but the difference will be negligible, because sending data to PI is usually very fast (especially when the events are sent in bulks (see the /lb parameter in Startup Command File).

In the future versions of PI_UFL the protocol between the PlugIn and the interface will be enhanced so that the needed information (about the time spent to read the data) will be communicated to the main interface module.

I/O Rate Point

An I/O Rate point measures the rate at which the Interface writes data to its input tags. The value of an I/O Rate point represents a 10-minute average of the total number of values per minute that the Interface sends to the PI Server.

When the Interface starts, it writes 0 to the I/O Rate point. After running for ten minutes, the Interface writes the I/O Rate value. The Interface continues to write a value every 10 minutes. When the Interface stops, it writes 0.

The ICU allows you to create one I/O Rate point for each copy of this Interface. Select this Interface from the Interface drop-down list, click IO Rate in the parameter category pane, and check Enable IORates for this Interface.

[pic]

As the preceding picture shows, the ICU suggests an Event Counter number and a Tagname for the I/O Rate Point. Click the Save button to save the settings and create the I/O Rate point. Click the Apply button to apply the changes to this copy of the Interface.

You need to restart the Interface in order for it to write a value to the newly created I/O Rate point. Restart the Interface by clicking the Restart button:

[pic]

(The reason you need to restart the Interface is that the PointSource attribute of an I/O Rate point is Lab.)

Enable IORates for this Interface

The Enable IORates for this interface check box enables or disables I/O Rates for the current interface. To disable I/O Rates for the selected interface, uncheck this box. To enable I/O Rates for the selected interface, check this box.

Event Counter

The Event Counter correlates a tag specified in the iorates.dat file with this copy of the interface. The command-line equivalent is /ec=x, where x is the same number that is assigned to a tag name in the iorates.dat file.

Tagname

The tag name listed under the Tagname column is the name of the I/O Rate tag.

Tag Status

The Tag Status column indicates whether the I/O Rate tag exists in PI. The possible states are:

Created – This status indicates that the tag exist in PI

Not Created – This status indicates that the tag does not yet exist in PI

Deleted – This status indicates that the tag has just been deleted

Unknown – This status indicates that the PI ICU is not able to access the PI Server

In File

The In File column indicates whether the I/O Rate tag listed in the tag name and the event counter is in the IORates.dat file. The possible states are:

• Yes – This status indicates that the tag name and event counter are in the IORates.dat file

• No – This status indicates that the tag name and event counter are not in the IORates.dat file

Snapshot

The Snapshot column holds the snapshot value of the I/O Rate tag, if the I/O Rate tag exists in PI. The Snapshot column is updated when the IORates/Status Tags tab is clicked, and when the Interface is first loaded.

Right Mouse Button Menu Options

Create

Create the suggested I/O Rate tag with the tag name indicated in the Tagname column.

Delete

Delete the I/O Rate tag listed in the Tagname column.

Rename

Allow the user to specify a new name for the I/O Rate tag listed in the Tagname column.

Add to File

Add the tag to the IORates.dat file with the event counter listed in the Event Counter Column.

Search

Allow the user to search the PI Server for a previously defined I/O Rate tag.

For Users of Previous (2.x) Interface Versions

The PI_UFL interface version 3.x is a complete rewrite. The goal was to merge the BatchFl interface (PI-IN-BF-LAB-NTI) and the Message Logger interface (PI-IN-OS-ML-NTI), because the functionality of these interfaces overlapped. In addition, the new PI_UFL interface has been designed so that it consists of the reusable frame and the data source specific PlugIns implemented as DLLs. All stream oriented data can thus be interfaced in the unified way; regardless if the data comes from ASCII files in directories, from ASCII files located on FTP servers, or if the data is read from serial ports or emails. The syntax for the message/field description and the consequent expression evaluation (configuration file) will remain the same. Any new ‘stream oriented’ interface will thus only require a proprietary PlugIn (DLL) that will implement the communication with the given stream producer. To achieve this, a couple of configuration parameters (of the existing PI_UFL interface) had to be modified. In addition, it was necessary to change the existing startup parameters’ location. Some parameters were moved from the PI_UFL.BAT file to the configuration file.

Users of the previous PI_UFL versions who want to upgrade their existing installations should carefully read the following paragraphs:

PI_UFL.BAT Changes

The major change (against the previous PI_UFL version – 2.3.0.14) occurred with start-up parameters. Some parameters were moved from the PI_UFL.BAT to the configuration file, and some were renamed. The following table lists all the startup parameters supported in the older versions and documents those that changed their location, or have a modified name:

|Old Parameter Name |New Parameter Name |Location / Remark |

|New start-up parameter |/am |BAT file. |

| | |Since version 3.0.3 |

|/cf=xxx.yyy |Unchanged | |

|/db |deb=n |Moved to INI file; section [SETTING] |

|/des |Unchanged | |

|New start-up parameter |/ec |BAT file. |

| | |Since version 3.0.3 |

|/err |Err |Moved to INI file; section [PLUG-IN] |

|/f=HH:MM:SS |Unchanged | |

|/host=host |Unchanged | |

|/id |No longer Supported | |

|/if |Ifm |Moved to INI file; section [PLUG-IN] |

|Old Parameter Name |New Parameter Name |Location / Remark |

|/ifs |Ifs |Moved to INI file; section [PLUG-IN] |

|/imt |No longer Supported |As the interface can automatically |

| | |create tags, support for this startup |

| | |parameter (Ignore Missing Tags) was |

| | |dropped. If the automatic point creation|

| | |is not configured (see the MSG(n).Epc |

| | |keyword of the configuration file), |

| | |the whole message line is stored into |

| | |the log-file keeping the unsuccessfully |

| | |processed messages. |

|/lb |Unchanged |BAT file |

| | |Also, see description of Location5 in |

| | |chapter PI Point Configuration. |

|/output |Output |Moved to INI file; section [SETTING] |

|/ps |Unchanged | |

|/pu |Purgetime |Moved to INI file; section [PLUG-IN] |

|New start-up parameter |/Rbo |BAT file |

|/ren |ren |Moved to INI file; section [PLUG-IN] |

|New start-up parameter |/RunOnce |BAT file |

|/test |No Longer Supported | |

|/tm |Unchanged | |

|/utc |Unchanged | |

|New start-up parameter |/wd |BAT file |

| | |Supported since version 3.0.3 |

|New start-up parameter |/ws |BAT file |

| | |Supported since version 3.0.3 |

Configuration File Changes

In PI_UFL 3.x version, the configuration file not only defines the definitions for parsing the messages, it also contains some of the interface’s start-up parameters. The above table explicitly lists which parameters moved from the .BAT file to the configuration file. The chapter Configuration File contains full description of individual sections with keywords. Users only have to make sure, the sections [INTERFACE], [PLUG-IN] and [SETTING] are defined at the beginning of the configuration file; the sections [FIELD] or [MSG] then have to follow.

Note: The most important change in the messages and fields description part of the config. File is related to data types. PI_UFL 3.x has much stricter data type control. The new data Time has been introduced and the new name DateTime replaced the name Time used in the previous PI_UFL versions. In the 3.x+ the Time data type is real Time and DateTime describes the full timestamp. Therefore, existing INI files (used with PI_UFL version 2.x) have to be changed so that Time needs to be replaced with DateTime; that is:

FIELD(1).NAME= “PI_TimeStamp”

‘ FIELD(1).Type= “Time”

‘ needs to be replaced with

FIELD(1).Type= “DateTime”

The following bullets summarize the other important changes/enhancements:

• The Now() function was added.

• The StoreInPI() function has been enhanced to support the Annotation parameter. It also returns a value indicating success or failure of the operation.

• StoreInPIDST() is no longer supported.

• New functionality has been added regarding the automatic tag and digital set/state creation. See the MSG(n).EPC and MSG(n).DigitalSet keywords.

• The IF (Expression) THEN construct was added.

• Messages in error are now stored by default in a file specified by the MSGInError keyword.

• The processed file renaming logic has been changed. Reading the data files is the responsibility of the PlugIn. The PlugIn is not aware about any success or failure when sending the data to PI or of any other run-time (parsing) error. In version 3.x the file is not given the Err suffix when there was runtime error. The Err is only used when the file cannot be open or read.

Note: Examples showing the above listed changes are given in Appendixes to this document. See Appendix B-F below.

Changes in Point Attributes

In PI_UFL 3.x, the following attributes from the PI Point Database are interpreted differently. See their description in the corresponding section in this document.

• Convers – this parameter is now applied as a coefficient against the numeric tags

• Location5 – defines whether exception reporting is used, or what archive writing mode is applied

Appendix A:

Error and Informational Messages

All messages are sent to the standard output, and, depending whether the output keyword is specified or not, interface will log the messages to the output file or

to the PIPC.log.

Each message has the following format

dd-MMM-yy hh:mm:ss [PI_UFL] [Msg type] Message

where

dd-MMM-yy hh:mm:ss

is the date time the message occurred.

Msg type Is the type of the message:

[Info], [Error], [Warning], [PL_Info], [PL_Error], [PL_Warning]

The PL prefix stands for PlugIn and indicates the message was printed from the PlugIn DLL.

Message Message Body.

Note: Should the consequent message be the same as the previous one, the interface stops printing them after 10 identical occurrences.

Appendix B:

CSV (Comma Delimited) Data Files

For Users of the PI Batch File Interface

The interface installation kit distributes examples that show the ability of the PI_UFL interface to process files covered by the BatchFl interface (PI-IN-BF-LAB-NTI).

Please consult the examples found under:

[PIHOME]\Interfaces\PI_UFL\Examples

Example5BatchFl01.ini

Example5BatchFl02.ini

Example5BatchFl03.ini

and the corresponding data files found in:

[PIHOME]Interfaces\PI_UFL\Examples\Data

Example5BatchFl01.dat

Example5BatchFl02.dat

Example5BatchFl03.dat

The examples provide for 3 variations of the Batch File Interface configuration. You will need to modify the paths (and possibly the timestamp formatting) in the configuration files for these to work properly.

Next to the above mentioned BatchFl examples, the following sections show the data stream extract, the configuration file and the .BAT file together with a short explanation:

Data File Example

BATCHFL-1,25-Jan-07 08:00:25,1234.1

BATCHFL-2,25-Jan-07 08:00:25,1234.2

BATCHFL-3,25-Jan-07 08:00:25,1234.3

BATCHFL-4,25-Jan-07 08:00:25,1234.4

BATCHFL-5,25-Jan-07 08:00:25,1234.5

BATCHFL-6,17-Jan-07 08:00:25,1234.6

BATCHFL-7,17-Jan-07 08:00:25,1234.7

BATCHFL-8,17-Jan-07 08:00:25,1234.8

BATCHFL-9,17-Jan-07 08:00:25,1234.9

BATCHFL-0,17-Jan-07 08:00:25,1234.0

Configuration File Example

‘ BatchFl.ini

‘ Shows that PI_UFL interface covers the stuctures

‘ processed by the BatchFl interface

[INTERFACE]

PLUG-IN = ASCIIFiles.dll

[PLUG-IN]

ERR = BAD

IFM = C:\PIPC\Interfaces\PI_UFL\Data\*.txt

IFS = N

PURGETIME = 8h

[SETTING]

DEB = 1

MAXLOG = 10

MAXLOGSIZE = 10240

MSGINERROR = c:\PIPC\Interfaces\PI_UFL\logs\errors_batchfl.out

OUTPUT = c:\PIPC\Interfaces\PI_UFL\logs\pi_ufl_batchfl.out

‘-----------------------------------------------------

[FIELD]

FIELD(1).NAME=”TagName”

FIELD(1).TYPE=”String”

FIELD(2).NAME=”Timestamp”

FIELD(2).TYPE=”DateTime”

FIELD(2).FORMAT=”dd-MMM-yy hh:mm:ss”, _

“Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec”

FIELD(3).NAME=”Value”

FIELD(3).TYPE=”Number”

[MSG]

MSG(1).NAME = “BatchFL”

‘ Enable the point creation; that is, all new points will be

‘ automatically created. See the appropriate chapter for more

‘ detailed explanation

MSG(1).EPC = “Float32”

[BatchFL]

‘ Message filter. If the data file contains a valid message on

‘ each line, no filter is necessary.

BatchFL.FILTER = C1==”*,??-???-?? ??:??:??,*”

‘ Positions of the individual fields:

TagName = [“(*),*,*”]

Timestamp = C1(“,”)-(“,*”)

‘ or Timestamp = [“*,(??-???-?? ??:??:??),*”]

‘ or Timestamp = [“*,(##-???-## ##:##:##),*”]

Value = C1(“*,??-???-?? ??:??:??,”) – NEWLINE

‘ or Value = C1(“*,*,”)- NEWLINE

‘ or Value = [“*,*,(*)”]

‘ Send value to PI

StoreInPi(TagName,, Timestamp, Value,,,)

Bat File Example

PI_UFL.EXE ^

/ps=U ^

/host=piserver1 ^

/f=00:01:00 ^

/cf=c:\PIPC\Interfaces\PI_UFL\ini\BatchFL.ini ^

/lb

Explanation

A comma delimited data file is a rather simple case for the PI_UFL interface. There is only one message type and messages consist of only one line. Separating the fields from each other is also easy, because the comma (delimiter) serves as the ‘search string’.

In the configuration file we use names for a message – BatchFL and for the fields TagName, Timestamp, Value. This makes the file more readable.

A valid data line is recognized based on the timestamp format (BatchFL.FILTER = C1==”*,??-???-?? ??:??:??,*”).

The field containing a TagName is read in first. It is positioned between column 1 and the first occurrence of the comma (TagName = C1 – (“,”)).

Second field – the Timestamp; the date/time format uses 3 characters month abbreviations, so it is important to know in which language they are given. The second parameter of the Format attribute explicitly names them.

Finally the Value; the Value field starts after the comma, which follows the Timestamp, and ends with the line itself.

At the very end, the data is sent to a PI tag (StoreInPi() function). Once this is completed, the interface starts a new iteration with the next data line..; until the data file reaches its end.

Note: The PI_UFL thus covers much ‘wider spectrum’ of data files than the BatchFL interface. In other words, the data file structure does not have to be strictly orthogonal; i.e., ‘column oriented’.

Appendix C:

XML Document Files

XML files can be relatively complex; however, it does not mean PI_UFL cannot parse them. Simple XML structures like below are easily parse-able by the means PI_UFL offers. All what is needed is to write a suitable INI file. As always, first step is to define a line. In case the XML file has lines ended with CRLF (ASCII codes: 13 and 10), the line division can remain and the content treated as ordinary ASCII file. When needed,

the NEWLINE keyword allows the definition of multiple line-ends (see the NEWLINE section in this document) and the XML content can be broken into lines that end for instance with the end tags: NEWLINE = “” OR “” OR “”

Data File Example

GMT+1

2004,01,22,12,00,00

17940

GMT+1

2004,01,22,12,00,00

52320

GMT+1

2004,01,22,12,00,00

1618776

Configuration File Example

‘ xml.ini

‘ Shows that PI_UFL interface can parse the XML files

[INTERFACE]

PLUG-IN = ASCIIFiles.dll

[PLUG-IN]

ERR = BAD

IFM = C:\PIPC\Interfaces\PI_UFL\Data\*.xml

IFS = N

PURGETIME = 1d

[SETTING]

DEB = 4

MAXLOG = 10

MAXLOGSIZE = 10249

MSGINERROR = C:\PIPC\Interfaces\PI_UFL\Logs\errors_xml.out

OUTPUT = C:\PIPC\Interfaces\PI_UFL\Logs\pi_ufl_xml.out

‘-------------------------------------------------------------

[FIELD]

FIELD(1).NAME = “TAG_ID”

FIELD(2).NAME = “TIMEZONE”

FIELD(3).NAME = “TIMESTAMP”

FIELD(3).TYPE = “DateTime”

FIELD(3).FORMAT = “yyyy,MM,dd,hh,mm,ss”

FIELD(4).NAME = “DST”

FIELD(4).Type = “DSTFlag”

FIELD(4).Format = “no,yes”

FIELD(5).NAME = “UOM”

FIELD(6).NAME = “STATUS”

FIELD(6).Type = “Number”

FIELD(7).NAME = “QUALITY”

FIELD(8).NAME = “VALUE”

FIELD(9).NAME = “TIMEONEHOUR”

FIELD(9).TYPE = “Time”

FIELD(9).FORMAT = “hh:mm:ss”

‘-------------------------------------------------------------

‘ Five messages are recognized:

[MSG]

MSG(1).NAME = “XML_LINE_MP”

MSG(2).NAME = “XML_LINE_TZ”

MSG(3).NAME = “XML_LINE_MQ”

MSG(4).NAME = “XML_LINE_TS”

MSG(5).NAME = “XML_LINE_PV”

MSG(5).EPC = “Float32”

‘-------------------------------------------------------------

‘ TAG_ID and Unit of Measure

[XML_LINE_MP]

XML_LINE_MP.FILTER= C1==”*”)-(“ ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download