Skip to content
mihai-stfc edited this page Jan 5, 2021 · 32 revisions
  1. Overview
  2. PV Import Service
  3. Service Manager

Overview

The purpose of the service is to enable efficient monitoring of Helium consumption by populating the HLM Database with new object measurements using the PV data provided by the Helium Recovery PLC. This repository contains both the HLM PV Import Service and its Service Manager.

PV Import Service

The service uses caproto for Channel Access ("EPICS") to read and store the data of specified PVs, whose values are then added to the HLM Database as Measurements for objects. For example, an object ""

The service consists of three "main" classes:

  1. User Config (PV configuration) - reads & validates the Record/Meas. PVs user config., stores & prepares records & PV names list
  2. PV Monitors (Channel Access) - sets up the PV monitors, handles PV data, updates, stale PV checks etc.
  3. PV Import (Main Loop) - adds measurements to the HLM DB, initializes tasks & handles update intervals and more
Service Diagram

On service start, the settings EPICS CA Address List will be set, and an UserConfig object will be created. After validating the provided configuration, it will fetch the entries (object IDs, measurement PVs, logging periods) and store them as attributes. The PV measurements list from the UserConfig is then used to create the PV Monitors object. The monitors object will prepare caproto's threading client Context. Monitors will be set-up for each PV name, and a dictionary containing the latest PV values will be regularly updated by the callback functions that were added to each subscription, alongside the time of each update (for checking stale PVs).

Lastly, a PV Import object will be created with references to the UserConfig and PV Monitors object. This is the main loop, which will be responsible for preparing the addition of new measurement: initialize tasks, handle update intervals, run stale PV checks, handle missing PV data, etc. If the PVs of a measurement meet the criteria, PV Import will call DBUtils to add it.

The supporting modules are:

  • DB Functions - functions for working with the HLM DB (e.g. add measurement, add relation, check for object Software Level Device).
  • Utilities - Various utility functions (e.g. get full PV name, get PV name without prefix/domain).
  • Logger - Custom logging for DB insertions, errors, stale PV warnings and more.
  • Settings - Service settings, paths, table/key names and other constants, all in one place.

Note: The PV Import service does not require the service manager - it can be set-up manually by directly editing the files, adding the objects and run via terminal commands. The service's only dependencies are its settings.ini and pv_config.json.

Service Manager

Although the PV Import service can be managed manually (see above), the HLM Service Manager offers a GUI that makes it easier to set-up, configure, validate and run the service.

hlm_manager_main_window
Clone this wiki locally