Skip to content

Add monitoring functionalities with data sinks

Daniel Joseph Antrim requested to merge add_mon into main

Table of Contents

What

This MR adds several things, the main one being the addition to the ana-mon utility several command line functions that relate to continuous monitoring and datasinks.

It additionally adds helper functions for managing output files and directories.

The run option

The command line option -r (--run) now exists and takes as argument a JSON configuration file which defines the monitoring setup (a default one is under config/mon_config_default.json:

{
    "monitor_config" :
    {
        "output" : {...},
        "datasinks" : {...},
        "measurements" : {...}
    }
}

Output configuration

The output fields specify how and to where any output data and/or files are stored. Right now it is:

"output" :
{
    "directory" : "/path/to/monitor/data/",
    "suffix" : "",
    "sink" : "CSV"
}
  • The field directory will be the directory where any data files are stored.
  • If the directory field is an empty string ("") then the output directory will be defined as the default one (/path/to/rd53b_anamon/data) defined by the create_default_data_dir function.
  • The field suffix is a string that will be be added to the end of any output files. If it is an empty string ("") or not present than no suffix will be added.
  • The sink field is required and selects the default sink to use for reporting measurements. It's name must match one of the nodes under the datasinks object.

Datasinks configuration

The datasinks object matches that in the usual configuration of DataSink objects:

"datasinks" :
{
    "CSV" :
    {
        "sinktype" : "CSVSink"
    },
    "Console" :
    {
        "sinktype" : "ConsoleSink"
    }
}

Measurement configuration

The measurement object describes how measurements are taken and what the measurements are of:

"measurement" :
{
    "tag" : "RD53B-AnalogMonitor-SCC"
    ,"name" : "rd53b_monitoring"
    ,"frequency" : 1000
    ,"count" : -1
    ,"time" : -1
    ,"quantities" : []
}
  • The tag field is the DataSink tag (sink->setTag) and gets called once per measurement.
  • The name field is the name of the measurement (provided to sink->startMeasurement(<name>,...)). The name field also defines what the output CSV files will be named when using CSVSink (e.g. <name>.csv).
  • The frequency field specifies the measurement frequency in units of milliseconds and must be a positive integer.
  • The count field specifies the number of measurements to take. If the count field is negative or zero (< 0) then the measurements will ignore the counting (this allows for an infinite number of measurements, for example).
  • The time field specifies for how long to continue taking measurements in units of milliseconds. If the time field is negative or zero (< 0) then the measurements will not keep track of time.
  • If both the count and time field are positive, the count field will be given priority.
  • The quantities array specifies which quantities to measure on the analog monitor card. If this array is empty ([]) then all of the SCC monitoring pins will be sampled. An example of specifying specific quantities is: "quantities" : ["VDDA", "VDDD", "TP_NTC1"].
  • If running infinitely (the time and count fields are both negative), or if the specified time or number of count measurements have not been fulfilled, the monitoring can be killed with Ctrl-C or Ctrl-Z: these interrupts will be caught and the DataSink objects will exit gracefully.

Additional notes

Making things quiet

By default, running ana-mon with the --run flag will spin up the ConsoleSink DataSink object (if one is defined in the datasinks field of the provided configuration file) so that, in addition to the CSVSink (for example), the measurements will be reported to the screen. These can be silenced by providing the -q (--quiet) command-line option:

./bin/ana-mon -r ../config/mon_config_default.json -q

Specifying the environmental conditions

The ana-mon utility also has a command-line option -t (--temp) for specifying the external temperature of the RD53B. This is useful if you are running in a climate controlled setting. This option takes as argument the specified temperature in units of Celsius. If provided, an additional field in the recorded measurements will be provided for specifying this set temperature. This extra field is called EnvTemp.

In order to ensure that the data formats of the output data sinks are somewhat consistent, the temperature field EnvTemp is always present, whether or not the user provided the -t (--temp) input. If the t (--temp) input is not provided, the EnvTemp data will be reported as NaN.

Measurement timestamps

By default, a data field is added to all measurements called time_us. This corresponds to the time since last epoch in microseconds at each call to recordPoint. In this way, a precise time point is given to each recorded row of data.

LabRemote Fixes Required

This MR assumes that the CSVSink class in labRemote has been fixed as described in this labRemote MR. If these changes are not added, the CSVSink output will be polluted with extraneous headers.

Tagging @theim @lmeng

Edited by Daniel Joseph Antrim

Merge request reports