105 lines
4.3 KiB
Markdown
105 lines
4.3 KiB
Markdown
SINQDAQ Epics Module
|
|
-----------------------
|
|
|
|
A Stream and Asyn based driver for configuring the Data Acquisition Systems at
|
|
SINQ.
|
|
|
|
This supports the older 4 and 8 channel EL737 models and the new 10CH 2nd
|
|
generation systems.
|
|
|
|
## How to Use
|
|
|
|
Unless a custom database is needed, a device can be configure simply by setting
|
|
the required environment variables when calling the correct counterbox script.
|
|
|
|
Required Variables
|
|
|
|
| Environment Variable | Purpose |
|
|
|----------------------|-----------------------------------------|
|
|
| INSTR | Prefix of all device specific PVs |
|
|
| NAME | First field in all PVs after Prefix |
|
|
| CNTBOX\_IP | Network IP of device |
|
|
| CNTBOX\_PORT | Network Port of device |
|
|
|
|
All PVs take the form
|
|
|
|
```
|
|
$(INSTR)$(NAME):*
|
|
```
|
|
|
|
Available device startup scripts
|
|
|
|
* scripts/counterbox\_4ch.cmd
|
|
* scripts/counterbox\_8ch.cmd
|
|
* scripts/counterbox\_v2.cmd
|
|
|
|
A device can be configured using one of the startup scripts as follows
|
|
|
|
```
|
|
epicsEnvSet("INSTR", "SQ:INSTRUMENT:") # can also be set in runScript call
|
|
|
|
runScript "$(counterbox_DIR)counterbox_v2.cmd" "NAME=COUNTERBOX, CNTBOX_IP=TestInst-DAQ1, CNTBOX_PORT=2000"
|
|
```
|
|
|
|
## PVs of Interest
|
|
|
|
| PV | Description |
|
|
|-------------------------------------|----------------------------------------------------------------------|
|
|
| \$(INSTR)\$(NAME):MsgTxt | Contains unexpected response to executed command |
|
|
| \$(INSTR)\$(NAME):STATUS | 0: Idle, 1: Counting, 2: Low rate, 3: Paused, 4: Error |
|
|
| \$(INSTR)\$(NAME):MONITOR-CHANNEL | Channel that PRESET-COUNT monitors (has RBV, only v2 can be changed) |
|
|
| \$(INSTR)\$(NAME):PRESET-COUNT | Run count until specified pv value reached |
|
|
| \$(INSTR)\$(NAME):PRESET-TIME | Run count until specified pv value in seconds reached |
|
|
| \$(INSTR)\$(NAME):THRESHOLD | Minimum rate for counting to preceed. (has RBV) |
|
|
| \$(INSTR)\$(NAME):THRESHOLD-MONITOR | Channel monitored for minimum rate (has RBV) |
|
|
| \$(INSTR)\$(NAME):ELAPSED-TIME | Time Counterbox has been measuring for |
|
|
| \$(INSTR)\$(NAME):M_ | Current count on channel. (1-10 depending on box) |
|
|
| \$(INSTR)\$(NAME):CHANNELS | Number of available channels (4, 8 or 10) |
|
|
|
|
## Generating Test Signals
|
|
|
|
The 2nd generation systems have two test channels that can be used to output
|
|
signals at a variable rate. These can be used to ensure the other channels are
|
|
working and to check the IOC - Nicos integration. These can be loaded at
|
|
runtime via the following
|
|
|
|
```
|
|
epicsEnvSet("LOAD_TEST_PVS","")
|
|
runScript "$(counterbox_DIR)counterbox_v2.cmd" "NAME=COUNTERBOX, CNTBOX_IP=TestInst-DAQ1, CNTBOX_PORT=2000"
|
|
```
|
|
|
|
See the file [counterbox\_v2\_test.db](./db/counterbox_v2_test.db)
|
|
|
|
## Simulation
|
|
|
|
Simulation of the Hardware can be toggled on as follows:
|
|
|
|
```
|
|
epicsEnvSet("SET_SIM_MODE","") # run counterbox simulation instead of connecting to actual box
|
|
runScript "$(counterbox_DIR)counterbox_v2.cmd" "NAME=CB_TEST, CNTBOX_IP=localhost, CNTBOX_PORT=2000"
|
|
```
|
|
|
|
In such a case, the provided `CNTBOX_IP` is ignored, and a python program
|
|
simulating the hardware is started in the background, listening at the
|
|
specified `CNTBOX_PORT`. So, if you have multiple devices listening on the same
|
|
port, you might have to change this port value of one of the devices when
|
|
simulating hardware. You can then interact with the PVs as with the normal
|
|
hardware. Keep in mind, however, that not all functionality has been
|
|
implemented.
|
|
|
|
See [sim/counterbox\_sim.py](sim/counterbox_sim.py).
|
|
|
|
## Testing
|
|
|
|
An IOC with the counterbox\_v2 started in simulation mode can be started via
|
|
the [test/ioc.sh](test/ioc.sh) script.
|
|
|
|
There is also a simple automated test that can be run for a simple check of
|
|
functionality and that the PVs load [test/test.py](test/test.py).
|
|
|
|
Both require that the module has been built and installed as is normal in the
|
|
require based module system.
|
|
|
|
You might have to change the specified version in the
|
|
[test/st.cmd](test/st.cmd) file to the version you compiled and want to test.
|