dquality.pv

Please make sure the installation Pre-requisites are met.

This module verifies that each of the PVs listed in the configuration file exist and their values are set within the predefined range.

The results will be reported in a file (printed on screen for now). An error will be reported back to UI via PV.

Functions:

init(config) This function initializes global variables.
verify(conf) This function reads the schemas/pvs.json as set in the dqconfig.ini file.
read(pv_str) This function returns a Process Variable (PV) value or None if the PV does not exist.
state(value, limit) This function takes boolean “value” parameter and string “limit” parameter that can be either “True” or “False”.
dquality.pv.init(config)[source]

This function initializes global variables. It gets values from the configuration file, evaluates and processes the values. If mandatory file or directory is missing, the script logs an error and exits.

Parameters:config (str) – configuration file name, including path
Returns:
  • logger (Logger) – logger instance
  • pvs (dictionary) – a dictionary containing pvs values and attributes read from the configured ‘pv_file’ file
dquality.pv.verify(conf)[source]

This function reads the schemas/pvs.json as set in the dqconfig.ini file. This file contains dictionary with keys of mandatory process variables. The values is a dictionary of attributes, each attribute being either description, or a verification operation. The verification operation attribute has an operation as a key, and the value is the limit of the PV. The allowed keys are:

  • less_than” - the PV value must be less than attribute value
  • less_or_equal” - the PV value must be less than or equal attribute value
  • equal” - the PV value must be equal to attribute value
  • greater_or_equal” - the PV value must be greater than or equal attribute value
  • greater_than” - the PV value must be greater than attribute value
  • state” - to support boolean PVs. The defined value must be “True” or “False”.

Any missing PV (i.e. it can’t be read) is an error that is reported (printed for now). Any PV value that is out of limit is an error that is reported (printed for now). The function returns True if no error was found and False otherwise.

Parameters:conf (str) – configuration file name, including path
Returns:boolean
dquality.pv.read(pv_str)[source]

This function returns a Process Variable (PV) value or None if the PV does not exist.

Parameters:value (str) – name of the PV
Returns:PV value
dquality.pv.state(value, limit)[source]

This function takes boolean “value” parameter and string “limit” parameter that can be either “True” or “False”. The limit is converted to string and compared with the value. The function returns True if the boolean values are equal, False otherwise.

Parameters:
  • value (numeric) – value
  • limit (str) – limit value
Returns:

boolean