From 00b9093b3712116afde85c842c9396f7d4caaccc Mon Sep 17 00:00:00 2001 From: soederqvist_a Date: Fri, 6 Feb 2026 11:05:51 +0100 Subject: [PATCH] SPC: add example for st.cmd and nicos setup --- README.md | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6170e29..b0cbf9a 100644 --- a/README.md +++ b/README.md @@ -310,6 +310,71 @@ compatible with the sinqdaq device in Nicos, albeit with only one channel. You can start a proton current DAQ based on a simulation with the following command on any PC having the SINQ epics environment installed. ``` -iocsh -r sinqDAQ,0.4.0 -c 'epicsEnvSet(SET_SIM_MODE,"" )' -c 'epicsEnvSet(INSTR,SQ:TEST:)' -c 'epicsEnvSet(NAME, SPC)' -c 'runScript($(sinqDAQ_DIR)daq_soft_proton.cmd' +iocsh -r sinqDAQ,0.4.0 -c 'epicsEnvSet(SET_SIM_MODE,"" )' -c 'epicsEnvSet(INSTR,SQ:TEST:)' -c 'epicsEnvSet(NAME, SPC)' -c 'runScript $(sinqDAQ_DIR)daq_soft_proton.cmd' ``` +### Example st.cmd declaration + +To include it in an existing st.cmd, add the following lines: +``` +require sinqDAQ, 0.4.0 +# This is the proton current PV from HIPA, however it's not available in the shutdown +epicsEnvSet(REMOTE_RATE_PV,"MHC6:IST:2") +# During shutdown you can specify this empty env var to have a simulated proton current. +epicsEnvSet(SET_SIM_MODE,"" ) # During operation remove this. +runScript $(sinqDAQ_DIR)daq_soft_proton.cmd "INSTR=SQ:TEST:, NAME=SPC" +``` + +### Example NICOS setup file declaration +``` +description = 'Setup for software based proton counter' + +pvprefix = 'SQ:TEST:SPC' + +channels = ['protoncount'] + +devices = dict( + elapsedtime = device( + 'nicos_sinq.devices.epics.sinqdaq.DAQTime', + daqpvprefix = pvprefix, + ), + protoncount = device( + 'nicos_sinq.devices.epics.sinqdaq.DAQChannel', + description = 'Proton counter channel', + daqpvprefix = pvprefix, + channel = 1, + type = 'monitor', + ), + preset = device( + 'nicos_sinq.devices.epics.sinqdaq.DAQPreset', + description = 'Time/Count Preset', + daqpvprefix = pvprefix, + channels = channels, + time_channel = ['elapsedtime'], + ), + ThresholdChannel = device( + 'nicos_sinq.devices.epics.sinqdaq.DAQMinThresholdChannel', + daqpvprefix = pvprefix, + channels = channels, + ), + Threshold = device( + 'nicos_sinq.devices.epics.sinqdaq.DAQMinThreshold', + daqpvprefix = pvprefix, + min_rate_channel = 'ThresholdChannel', + ), + spcdet = device( + 'nicos_sinq.devices.epics.sinqdaq.SinqDetector', + description = 'Detector device that estimates proton counts in software', + timers = ['elapsedtime'], + counters = [], + monitors = ['preset'] + channels, + images = [], + others = [], + liveinterval = 7, + saveintervals = [60] + ), +) +startupcode = ''' +SetDetectors(spcdet) +''' +```