File Processor Agent Example – Lorentz

<< Click to Display Table of Contents >>

Live > Agents > File Agents > File Processor > Examples >

File Processor Agent Example – Lorentz

1.Add Lorentz to the *.config file's processors setting, and ensure the following Lorentz settings:

 

Setting

Value

Description

Lorentz.dateTimeColumnHeaderRegex

^Date and Time$

DT_LOGGER_DATUM.DATUM_UTC_DT; column header text is Date and Time.

Lorentz.folderWatcherPath

C:\EarthSoft\Live\Lorentz


Lorentz.loggerCodeColumnHeaderRegex

^Pump$

DT_LOGGER.LOGGER_CODE

Lorentz.loggerDescPrefix

Lorentz Pump


Lorentz.seriesNameColumnHeaderRegexGroups

((?'a'.*)\(|(?'b'.*))

DT_LOGGER_SERIES.SERIES_NAME; text before last open parenthesis.

Lorentz.seriesUnitColumnHeaderRegexGroups

\((?'a'[^)]*)\)[^(]*$

DT_LOGGER_SERIES.SERIES_UNIT; text between last parentheses.

 

And default (non-Lorentz) settings (or add Lorentz.dateTimeFormats, etc., settings):

 

Setting

Value

Description

dateTimeFormats


Empty; determined automatically.

delimiters

,

The fields are separated by commas.

headerLinesRegex


Empty; the file's header is on the first non-empty line in the file (and is only one line).

utcOffsetHrs

0

DT_LOGGER.UTC_OFFSET_HRS

 

2.Start the agent, and copy the following file to folder C:\EarthSoft\Live\Lorentz.

 

 

Pump,Date and Time,Power(kWh),Voltage(V),Input Current(A),Motor Current(A),Flow(m³/h),Pressure(m)

1234,10:03 16 May 2017,0,120.0,0,0,0,1.0

1234,10:14 16 June 2017,0,119.8,0,0,0,1.1

1234,10:23 16 July 2017,0,122.3,0,0,0,1.2

5678,10:01 16 May 2017,0.18,58.2,2.9,3.04,1.27,2.0

5678,10:11 16 June 2017,0.22,57.9,3.39,3.39,1.34,2.1

5678,10:21 16 July 2017,0.21,59.1,3.48,3.48,1.32,2.2

91011,10:02 16 May 2017,0,70.1,0,0,0,0.2

91011,10:13 16 June 2017,0.21,68.8,3.39,4.73,1.09,0.2

91011,10:22 16 July 2017,0.22,67.1,3.37,4.71,1.03,0.1

 

 

3.The file's first non-empty line is the header line (because headerLinesRegex is empty); it contains the DT_LOGGER.LOGGER_CODE and DT_LOGGER_DATUM.DATUM_UTC_DT columns. The other columns are the series; they contain DT_LOGGER_SERIES.SERIES_NAMEs and DT_LOGGER_SERIES.SERIES_UNITs.

 

4.For each subsequent line:

a.Find/add the logger row for the Pump/LOGGER_CODE, e.g., for the file's second line:

 

LOGGER_CODE

LOGGER_DESC

LIVE_DATA_SOURCE

UTC_OFFSET_HRS

1234

Lorentz Pump 1234 (= Lorentz.loggerDescPrefix + LOGGER_CODE)

folder://COMPUTER_NAME/
C:/EarthSoft/Live/Lorentz

0 (= utcOffsetHrs)

 

b.For each series (each column, excluding Pump and Date and Time columns):

i.Find/add the series row for the SERIES_NAME and SERIES_UNIT.

ii.Add the datum row, e.g., for the file's second line:

 

SERIES_NAME

DATUM_UTC_DT

DATUM_VALUE

SERIES_UNIT

Power

2017-05-16 10:03:00

0

kWh

Voltage

2017-05-16 10:03:00

120

V

Input Current

2017-05-16 10:03:00

0

A

Motor Current

2017-05-16 10:03:00

0

A

Flow

2017-05-16 10:03:00

0

m³/h

Pressure

2017-05-16 10:03:00

1

m