How to specify some EPICS records’ fields

Contents

8. How to specify some EPICS records’ fields#

Prerequisites:

You might want to customize some records associated to the shell instructions specified in the .substitutions files (e.g. myTargetMonitoringTop/iocBoot/iocMyTargetMonitoring/target1.substitutions). To do so, you can add some macros associated to the following common EPICS fields:

  • DESC

  • EGU

  • HIHI

  • HHSV

  • HIGH

  • HSV

  • LOLO

  • LLSV

  • LOW

  • LSV

  • DRVL

  • DRVH

  • HOPR

  • LOPR

  • PREC

  • HYST

  • ADEL

  • MDEL

E.g., from the example in the custom shell instructions how-to, let’s configure an alarm over the CSS monitoring (let’s also configure an engineering unit EGU, and a description DESC), in case it eats up too much CPU:

$ vi myTargetMonitoringTop/iocBoot/iocMyTargetMonitoring/custom_monitoring.substitutions
    > ...
    >         # scalar instruction 3 used to extract CPU usage of CSS (Control System Studio)
    >         # the result of this instruction is stored in the record called "${PREFIX}${CATEGORY}${PV_NAME_SCALAR_3}"
    >         PV_NAME_SCALAR_3 = "cpu_usage_css"
    >         SCALAR_3_INSTRUCTION = "ps -eo %cpu,args | grep css | awk '{print $1}' | paste -sd+ - | bc"
    >         LOAD_SCALAR_3 = ""
  + >         DESC_SCALAR_3 = "monitor the CPU usage of CSS"
  + >         LOAD_DESC_SCALAR_3 = ""
  + >         EGU_SCALAR_3 = "%"
  + >         LOAD_EGU_SCALAR_3 = ""
  + >         HIGH_SCALAR_3 = "80"
  + >         LOAD_HIGH_SCALAR_3 = ""
  + >         HIHI_SCALAR_3 = "90"
  + >         LOAD_HIHI_SCALAR_3 = ""
  + >         HSV_SCALAR_3 = "MINOR"
  + >         LOAD_HSV_SCALAR_3 = ""
  + >         HHSV_SCALAR_3 = "MAJOR"
  + >         LOAD_HHSV_SCALAR_3 = ""
    > ...

See also

You will find more details about the supported EPICS records fields in the .cmd, .template and .substitutions explanations.

8.1. SCAN field#

The SCAN field cannot be changed per record/shell instruction. Instead, the SCAN macro is specified in a SSH Monitor .substitutions file only once per CATEGORY macro and not once per record / shell instruction (see the .cmd, .template and .substitutions explanations for more details about how and why).

If you want to override the default SCAN value, (e.g. when loading a default SSH Monitor .substitutions file), then the recommended way is to load the SSH Monitor .substitutions file (from your .cmd file) with the SCAN_MACRO macro. E.g. like so:

dbLoadTemplate("${TOP}/db/example_monitoring.substitutions", "PREFIX_MACRO=${PREFIX}, SSH_OPTS_AND_ARGS_MACRO=${SSH_OPTS_AND_ARGS}, SCAN_MACRO=1 hour")

In this case, the default SCAN value will be overwritten by the content of the SCAN_MACRO macro, i.e. it will be set to 1 hour.