# Presentation: 230491

## History Server & API

- Christopher Larrieu
- Jefferson Laboratory

## Goals

*Simple* interface to archived data
*Efficient* access to distributed data sources
*Useful* data manipulation capabilities
*Portable* integration with existing EPICS tools

## CADataStore: abstract interface to read CA data from file, db, etc.

- archive
- Provides channel listing, creates data range objects
- range
- Describes data for one channel on time range
- channel_state
- Complete information for one channel associated with one point in time.
- range_iterator
- Access sequential channel states by updating channel_state

**Notes:**
By updating one channel state object, the range_iterator provides simple yet powerful support for useful features like dynamic decompression and acquisition of real-time data.

## Server Specialization

- Server accesses CA archive via CADataStore object
- Different derived classes for different archives
- LANL_DataStore wraps around Kay’s archive API
- JLAB_DataStore wraps around JLAB archive API
- RDB_DataStore ?
- *_DataStore
- Derived classes compiled as shared object code, loaded at run-time.
*Narrow interface eases specialization, but captures essential functionality.*

## Server Schematic

- LANL_DataStore

- Channel
- Archiver API

- History Server

- History
- Data
- Client

## Server Components

- Data access plug-in (derived from CADataStore)
- Exported network interface
- Archive description (name, acquisition mode, etc.)
- Data manipulation (transform library)
- Data production (data stream, iterator)
- Network communication component

## Client Components

- Consumer code (e.g. data mining, visualization)
- Library API
- Directory Services
- Data manipulation (transform library)
- Data consumption (stream from server)
- Network communication component

## DataStoreDirectory

- Provides hierarchical structure to signal names
- Enumerates registered history servers
- Name
- Location
- Data quality
- Maps signal names to history servers

## DataSequence

- Describes a stream of sequenced data
- Every element contains
- Indexing attribute (scalar, numeric) (e.g. time)
- Primary attribute (e.g. value)
- Ancillary attributes (e.g. status, severity, units)
- Attribute dependencies (e.g. alarm depends upon value)
- Elements are iterated over via the indexing attribute, and return primary attribute as default value.

## DataTransform

- Reads input sequence, generates output sequence.
- Generic transforms operate upon primary attribute.
- Specialized transforms operate on known attributes.

## Example 1: Binning Transform

- Parameters: bin width
- Input: (index,value) pairs (e.g. time, value)
- All other attributes discarded
- Output: (count, mean, variance, min, max) tuples, indexed by bin number, with mean as primary attribute.

## Example 2: Discrete Fourier Transform

- Input (index, value) pairs (e.g. time, value)
- All other attributes discarded
- Output (frequency, amplitude) pairs, index by frequency, with amplitude as primary attribute.

## Standard Transforms

- Binning
- Interpolating
- Decimating
- DFT, IDFT
- Digital Filter
- Averaging
- Rasterizing
- Attribute Mapping
- Attribute Filtering

## Network Communication

- CORBA
- Transparent binary compatibility
- Easy communication between distributed objects
- Integrate with other CORBA-enabled tools
- MICO
- open source implementation
- branded CORBA 2.3 compliant by OMG
- Portable: Unix (hp-ux, linux, solaris, aix, etc.), Win32
- C++, Java bindings

## Uses in EPICS

- Portable CA Server interface can supply history data to ca clients (e.g. medm) .
- Adaptor library supporting Kay’s API: current applications become network capable.
- New applications: java tools, etc.

## Intended Use at JLAB

- StripTool history plug-in
- Replacement for current XARR interface
- Operator / user scripting.
- DARTH (vaporous data-mining tool)