From 4436f5cd6a6a0e21cbbab777d1c197b9ff7e60f9 Mon Sep 17 00:00:00 2001 From: wang_x1 Date: Wed, 25 Nov 2026 16:04:20 +0100 Subject: [PATCH] areaDetector IOC setup howto (#31) Co-authored-by: Xiaoqiang Wang Reviewed-on: https://gitea.psi.ch/Controls/gitea-pages/pulls/31 Reviewed-by: acerbo_a Co-authored-by: wang_x1 --- .../03_how_to/03_detector_areadetector.md | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/docs/3._Knowledge_Center/03_how_to/03_detector_areadetector.md b/docs/3._Knowledge_Center/03_how_to/03_detector_areadetector.md index 4036a30c..d1bdb93e 100644 --- a/docs/3._Knowledge_Center/03_how_to/03_detector_areadetector.md +++ b/docs/3._Knowledge_Center/03_how_to/03_detector_areadetector.md @@ -8,3 +8,94 @@ tags: --- # How-To Guide: Detector Integration with AreaDetector + +Assuming the detector has [a support module](../../2._Services_Portfolio/Hardware_Portfolio/Detectors/index.md), here are the general steps to setup an IOC. + +## IOC Host Setup + +For Ethernet interface detectors, IOCs normally run on virtual host with RHEL system. + +If high performance is demanded or frame grabbers are required, physical hosts can be used. +In SwissFEL physical hosts run Warewulf provisioned Debian system. + +In rare cases, when lacking Linux support from vendor, IOC can be manually launched on Windows. + + +### RHEL Host Setup +The configuration is managed by ansible. Vendor's driver come in the form of DKMS RPM packages. + +### Debian Host Setup +The configuration is done by various provisioning scripts. Refer to Debian provisioning document. + +### Windows Host Setup +Refer to [MSVC WINE](../../3._Knowledge_Center/03_how_to/15_ioc_platforms.md) + +## IOC Project Setup + +The following startup script skeleton could be used with **MODULE** replaced with your detector support module name, e.g. *ADPylon*. + +```bash hl_lines="16" +# Prefix for areaDetector records +epicsEnvSet("PREFIX", "13AD1:") +# The port name for the detector +epicsEnvSet("PORT", "AD1") +# The maximum image width; used to set the maximum size for this driver +# and for row profiles in the NDPluginStats plugin +epicsEnvSet("XSIZE", "2048") +# The maximum image height; used to set the maximum size for this driver +# and for column profiles in the NDPluginStats plugin +epicsEnvSet("YSIZE", "2048") +# The waveform is large enough for 2048x2048 pixels of short type. +epicsEnvSet("NELEMENTS", "4194304") +epicsEnvSet("TYPE", "Int16") +epicsEnvSet("FTVL", "SHORT") + +require "MODULE" +runScript $(ADCore_DIR)/commonPlugin.cmd + +# File writer plugins if needed +require "NDPluginHDF5" # HDF5 file format +require "NDPluginMagick" # JPEG, PNG file formats + +``` + +### Multi-config in One IOC + +Driver module startup.cmd configures the detector asyn port and loads record template files. When it runs for the 2nd detector, a *N* macro needs to provided in addition to the *PREFIX* macro change. +And this number should be increased for each following detector. + + + + +```bash + +# Prefix for areaDetector records +epicsEnvSet("PREFIX", "13AD2:") + +require "MODULE",N=2 +runScript $(ADCore_DIR)/commonPlugin.cmd,N=2 +``` +### Mult-IOC in One Project +In SwissFEL, the many cameras in one section makes the deployment and maintenance time consuming and error prone. +The practice is to have one project installing multi-IOCs, i.e. repo epics_iocboot_sf/ad_setup_script + +## Checks on First Startup +After IOC started, launch the detector driver specific panel. Check the top left *Setup* section, the *Model* should not be *Unknown* if detector is properly detected and configured. + +In case of no connection to the detector, one can connect to the IOC shell, look for the messages directly after **require "MODULE"**. Some error prints may explain the reason. + +## Image Viewers + +- [QtAD](https://github.com/paulscherrerinstitute/QtAD) installed on RHEL systems. It is written in Qt and displays images on a OpenGL widget. It is best suited for video cameras. + ``` + QtAD --simple --prefix=13AD1:image1: + ``` +- /\/controls/bin/ADLiveViewer.py auto deployed from git repo autodeploy_bin/\_controls. It is written in PyQt and display images using pyqtgraph. It shows the image +histogram, clips the pixel value, change color maps, and shows the pixel value under mouse cursor. + ``` + ${FACILITY}/controls/bin/ADLiveViewer.py 13AD1:image1: + ``` + + +[areaDetector viewers](https://areadetector.github.io/areaDetector/ADViewers/ad_viewers.html) offer other choices which user can install themselves. +