DCS
More I/O business
Motivation
Temperature and humidity sensors provide their data through JSON strings via MQTT protocol to the server. There are two messages, "Alert" and "Monitoring"
At the same time, the servers can set thresholds and send in general messages with the board to JSON.
Thus, naturally the DCS server needs to communicate with json, through c++ software.
The repository is https://gitlab.cern.ch/sndlhc-daq/detectorcontrolsystem
Another sensor is provided by the CV department, via the DIM and DIP communication service
Required external libraries
JSONCPP
This C++ library allows both reading and writing json strings with c++ variables.
The official github repository: https://github.com/open-source-parsers/jsoncpp
For the installation, there is already a Debian package, so I prefer to use this one:
sudo apt-get install libjsoncpp-dev
Only difference, the include. Instead of the default include
we need this one:
Standard execution with ROOT then works
Paho-mqtt
C++/Python Library to connect to the MQTT server. Our server can be accessed from my aiulian lxplus account with https://gitlab.cern.ch/sndlhc-daq/detectorcontrolsystem/-/blob/master/python/testsndmqtt_connection.py, by modifying the on_message function
DIP and DIM
This communication system is used to subscribe to information from the CV Temperature and Humidity sensor:
https://readthedocs.web.cern.ch/display/DIP/
The library used to retrieve the code is the python library pydim, installed according to
http://lhcbdoc.web.cern.ch/lhcbdoc/pydim/index.html
Necessary prerequisite. Source this script:
source configpydim.sh
Then to acces and store the data launch
python python/CVtemphumidity_DIM_SND_readout.py
DCS Presenter
The SMS monitoring class, it stores the sensor data into a TTree. It is launched from lxplus via
and it will access the "monitoring channel", autosaving the TTree every 100 entries (about every 30 minutes). The saved TFile will have the date of creation, i.e. "dcs_output_20220421.root"
Format of dcs tree info
The DCS Presenter store information into a TTree smstree, with the following variables:
monitortime: TDatime, storing the time when the monitor message was stored;
coolingon: A boolean, telling us if cooling system is active
temp[5]: An array of temperatures (in °C)
relhum[5]: An array of relative humidities (percentage);
smk[3]: An array of booleans, will tell us if a smoke sensor has been triggered
TDatime can be easily plotted, by filling a graph or histogram with the output of Convert() call, then the axis can be set as preferred:
Online monitoring
Storage of sensor data:
Online monitoring is performed via tmux screens on lxplus.
Important: writing permissions last 1 day. Once a day (twice, for safety), you should reconnect with kinit and your CERN credentials to the same lxplus you used with tmux (example. lxplus761);
To launch a new monitoring session:
create a tmux session with tmux new -s dcsmonitorgraphs;
enter sndsw environment;
go to detectorcontrolsystem/python/ folder;
Launch python sndmqtt_startconnection.py
Detach with ctrl-b d
Drawing graphs:
Graphs are drawn with ROOT and stored in our webserver folder, accessible from snd-lhc-monitoring.web.cern.ch/dcsgraphsonline.html. To do them:
create a tmux session with tmux new -s startdrawingdcsgraphs;
enter sndsw environment;
go to detectorcontrolsystem/cplusplus_scripts/ folder;
Launch source startdrawingmonitorgraphs.sh smsfilename cvfilename;
where smsfilename contains the TTree from SMS and cvfilename the one from CV sensor
Replace filename with the latest monitoring file, for example dcs_output_20220719.root
Updating web index
Last, not forget to add a new link to the index, otherwise people cannot find the link to the new graph. Modify /eos/experiment/sndlhc/www/dcsgraphsonline.html accordingly.
If you do not know how to write the file, please check https://gitlab.cern.ch/sndlhc-daq/detectorcontrolsystem/-/blob/master/dcsgraphsonline.html and https://gitlab.cern.ch/sndlhc-daq/detectorcontrolsystem/-/blob/master/python/getlinks.py
Last updated
Was this helpful?