Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| df4f140c12 | |||
| 872f21d9bc | |||
| 9958ef428b | |||
| e91b0e54b7 | |||
| c2b73e44cc | |||
| 14214e6151 | |||
| b8406016d2 | |||
| b26704d061 | |||
| 5f86266fc0 | |||
| eefb8c2053 | |||
| 2717b66fcd | |||
| ae20111e42 | |||
| 6e88505799 | |||
| 7764e2184e | |||
| 4ebe12da29 | |||
| 8f16888b68 | |||
| 2a75f9ec3c | |||
| 0d09282c9a | |||
| 47228b0b5b | |||
| c44056176f | |||
| c0ac01b3d6 | |||
| 44d4b83a80 | |||
| 653d3e238d | |||
| 2770cd80da |
27
.gitea/workflows/action.yaml
Normal file
27
.gitea/workflows/action.yaml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
name: Example Action
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Lint:
|
||||||
|
runs-on: linepics
|
||||||
|
steps:
|
||||||
|
- name: checkout repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: cppcheck
|
||||||
|
run: cppcheck --std=c++17 --addon=cert --addon=misc --error-exitcode=1 src/*.cpp
|
||||||
|
- name: formatting
|
||||||
|
run: clang-format --style=file --Werror --dry-run src/*.cpp
|
||||||
|
BuildAndTest:
|
||||||
|
runs-on: linepics
|
||||||
|
steps:
|
||||||
|
- name: checkout repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: build
|
||||||
|
run: |
|
||||||
|
sed -i 's/ARCH_FILTER=.*/ARCH_FILTER=linux%/' Makefile
|
||||||
|
echo "LIBVERSION=${CI_COMMIT_TAG:-0.0.1}" >> Makefile
|
||||||
|
make install
|
||||||
|
- name: test
|
||||||
|
run: |
|
||||||
|
cd test
|
||||||
|
python3 test.py
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
default:
|
|
||||||
image: docker.psi.ch:5000/sinqdev/sinqepics:latest
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- lint
|
|
||||||
- build
|
|
||||||
- test
|
|
||||||
|
|
||||||
cppcheck:
|
|
||||||
stage: lint
|
|
||||||
script:
|
|
||||||
- cppcheck --std=c++17 --addon=cert --addon=misc --error-exitcode=1 src/*.cpp
|
|
||||||
artifacts:
|
|
||||||
expire_in: 1 week
|
|
||||||
tags:
|
|
||||||
- sinq
|
|
||||||
|
|
||||||
formatting:
|
|
||||||
stage: lint
|
|
||||||
script:
|
|
||||||
- clang-format --style=file --Werror --dry-run src/*.cpp
|
|
||||||
artifacts:
|
|
||||||
expire_in: 1 week
|
|
||||||
tags:
|
|
||||||
- sinq
|
|
||||||
|
|
||||||
# clangtidy:
|
|
||||||
# stage: lint
|
|
||||||
# script:
|
|
||||||
# - curl https://docker.psi.ch:5000/v2/_catalog
|
|
||||||
# # - dnf update -y
|
|
||||||
# # - dnf install -y clang-tools-extra
|
|
||||||
# # - clang-tidy sinqEPICSApp/src/*.cpp sinqEPICSApp/src/*.c sinqEPICSApp/src/*.h -checks=cppcoreguidelines-*,cert-*
|
|
||||||
# # tags:
|
|
||||||
# # - sinq
|
|
||||||
|
|
||||||
build_module:
|
|
||||||
stage: build
|
|
||||||
script:
|
|
||||||
- sed -i 's/ARCH_FILTER=.*/ARCH_FILTER=linux%/' Makefile
|
|
||||||
- echo "LIBVERSION=${CI_COMMIT_TAG:-0.0.1}" >> Makefile
|
|
||||||
- make install
|
|
||||||
- cp -rT "/ioc/modules/counterbox/$(ls -U /ioc/modules/counterbox/ | head -1)" "./counterbox-${CI_COMMIT_TAG:-$CI_COMMIT_SHORT_SHA}"
|
|
||||||
artifacts:
|
|
||||||
name: "counterbox-${CI_COMMIT_TAG:-$CI_COMMIT_SHORT_SHA}"
|
|
||||||
paths:
|
|
||||||
- "counterbox-${CI_COMMIT_TAG:-$CI_COMMIT_SHORT_SHA}/*"
|
|
||||||
expire_in: 1 week
|
|
||||||
when: always
|
|
||||||
tags:
|
|
||||||
- sinq
|
|
||||||
|
|
||||||
test_module:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- mkdir -p "/ioc/modules/counterbox"
|
|
||||||
- cp -rT "./counterbox-${CI_COMMIT_TAG:-$CI_COMMIT_SHORT_SHA}" "/ioc/modules/counterbox/${CI_COMMIT_TAG:-0.0.1}"
|
|
||||||
- python3 test/test.py
|
|
||||||
when: always
|
|
||||||
tags:
|
|
||||||
- sinq
|
|
||||||
@@ -7,6 +7,10 @@ SINQ.
|
|||||||
This supports the older 4 and 8 channel EL737 models and the new 10CH 2nd
|
This supports the older 4 and 8 channel EL737 models and the new 10CH 2nd
|
||||||
generation systems.
|
generation systems.
|
||||||
|
|
||||||
|
**Note:** the epics side of this interface is also implemented/shared by the
|
||||||
|
[StreamGenerator](https://gitea.psi.ch/lin-epics-modules/StreamGenerator)
|
||||||
|
module.
|
||||||
|
|
||||||
## How to Use
|
## How to Use
|
||||||
|
|
||||||
Unless a custom database is needed, a device can be configure simply by setting
|
Unless a custom database is needed, a device can be configure simply by setting
|
||||||
|
|||||||
@@ -40,17 +40,51 @@ record(bi, "$(INSTR)$(NAME):S$(CHANNEL)")
|
|||||||
################################################################################
|
################################################################################
|
||||||
# Count Commands
|
# Count Commands
|
||||||
|
|
||||||
|
# Unfortunately, clearing the channels is somewhat complicated as a result of
|
||||||
|
# the addition of more channels over time and minimal changes to the underlying interface
|
||||||
|
#
|
||||||
|
# Urs Greuter provided the following explanation:
|
||||||
|
#
|
||||||
|
# bei den Befehlen CC r und HC r ist der Parameter r als bit-Maske zu verstehen:
|
||||||
|
#
|
||||||
|
# Bit0: Zähler Channel 1
|
||||||
|
# Bit2: Zähler Channel 2
|
||||||
|
# Bit3: Zähler Channel 3
|
||||||
|
# Bit4: Zähler Channel 4
|
||||||
|
# Bit5: Zähler Channel Timer
|
||||||
|
# Bit6: Zähler Channel 5
|
||||||
|
# Bit7: Zähler Channel 6
|
||||||
|
# Bit8: Zähler Channel 7
|
||||||
|
# Bit9: Zähler Channel 8
|
||||||
|
#
|
||||||
|
# Beispiele:
|
||||||
|
# CC 1 setzt den Zähler des Channels 1 zurück
|
||||||
|
# CC 4 setzt den Zähler des Channels 3 zurück
|
||||||
|
# CC 5 setzt gleichzeitig die Zähler der Channels 1 und 3 zurück
|
||||||
|
# CC 16 ist gleichbedeutend wie CT (Timer zurücksetzen)
|
||||||
|
# CC 511 setzt gleichzeitig die Zähler aller Kanäle (auch des Timers) zurück.
|
||||||
|
|
||||||
|
record(calc, "$(INSTR)$(NAME):BM$(CHANNEL)")
|
||||||
|
{
|
||||||
|
field(DESC, "Bit Mask for Channel")
|
||||||
|
field(INPA, $(CHANNEL))
|
||||||
|
field(CALC, "A > 4 ? 2 ^ A : 2 ^ (A-1)")
|
||||||
|
field(PINI, "YES")
|
||||||
|
}
|
||||||
|
|
||||||
record(longout, "$(INSTR)$(NAME):C$(CHANNEL)")
|
record(longout, "$(INSTR)$(NAME):C$(CHANNEL)")
|
||||||
{
|
{
|
||||||
field(DESC, "Clear the current channel count")
|
field(DESC, "Clear the current channel count")
|
||||||
field(DTYP, "stream")
|
field(DTYP, "stream")
|
||||||
field(OUT, "@$(PROTO) clearChannel($(INSTR)$(NAME):, $(CHANNEL)) $(ASYN_PORT)")
|
field(OMSL, "closed_loop")
|
||||||
|
field(DOL, "$(INSTR)$(NAME):BM$(CHANNEL) NPP")
|
||||||
|
field(OUT, "@$(PROTO) clearChannel($(INSTR)$(NAME):) $(ASYN_PORT)")
|
||||||
field(FLNK, "$(INSTR)$(NAME):T$(CHANNEL)")
|
field(FLNK, "$(INSTR)$(NAME):T$(CHANNEL)")
|
||||||
}
|
}
|
||||||
|
|
||||||
record(ao,"$(INSTR)$(NAME):THRESH$(CHANNEL)")
|
record(ao,"$(INSTR)$(NAME):THRESH$(CHANNEL)")
|
||||||
{
|
{
|
||||||
field(DESC, "Sets minimum rate for counting to proceed")
|
field(DESC, "Sets min rate for counting to proceed")
|
||||||
field(OMSL, "supervisory")
|
field(OMSL, "supervisory")
|
||||||
field(OROC, "0")
|
field(OROC, "0")
|
||||||
field(OUT, "@$(PROTO) setMinRate($(INSTR)$(NAME):, $(CHANNEL)) $(ASYN_PORT)")
|
field(OUT, "@$(PROTO) setMinRate($(INSTR)$(NAME):, $(CHANNEL)) $(ASYN_PORT)")
|
||||||
@@ -60,7 +94,7 @@ record(ao,"$(INSTR)$(NAME):THRESH$(CHANNEL)")
|
|||||||
################################################################################
|
################################################################################
|
||||||
# Read all monitors values
|
# Read all monitors values
|
||||||
|
|
||||||
record(longin, "$(INSTR)$(NAME):M$(CHANNEL)")
|
record(int64in, "$(INSTR)$(NAME):M$(CHANNEL)")
|
||||||
{
|
{
|
||||||
field(DESC, "DAQ CH$(CHANNEL)")
|
field(DESC, "DAQ CH$(CHANNEL)")
|
||||||
field(EGU, "cts")
|
field(EGU, "cts")
|
||||||
|
|||||||
52
db/daq.proto
52
db/daq.proto
@@ -5,17 +5,18 @@ OutTerminator = CR;
|
|||||||
InTerminator = CR;
|
InTerminator = CR;
|
||||||
ReadTimeout = 100;
|
ReadTimeout = 100;
|
||||||
WriteTimeout = 100;
|
WriteTimeout = 100;
|
||||||
ReplyTimeout = 200;
|
ReplyTimeout = 1000;
|
||||||
LockTimeout = 450;
|
LockTimeout = 500;
|
||||||
|
|
||||||
initialise {
|
initialise {
|
||||||
out "RMT 1"; # Turn on Remote Control
|
out "RMT 1"; # Turn on Remote Control
|
||||||
in;
|
in;
|
||||||
out "ECHO 2"; # Ask for reponses
|
out "ECHO 2"; # Ask for reponses
|
||||||
in "%(\$1MsgTxt)s"; # Clear MsgTxt on Init
|
in "%(\$1MsgTxt)s"; # Clear MsgTxt on Init
|
||||||
@mismatch{
|
# Probably should cause the ioc to just exit
|
||||||
exec 'echo "Failed to configure DAQ" && exit(1)';
|
# @mismatch{
|
||||||
}
|
# exec 'echo "Failed to configure DAQ" && exit(1)';
|
||||||
|
# }
|
||||||
}
|
}
|
||||||
|
|
||||||
fullReset {
|
fullReset {
|
||||||
@@ -74,39 +75,25 @@ clearTimer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
clearChannel{
|
clearChannel{
|
||||||
out "CC \$2";
|
out "CC %d";
|
||||||
in;
|
in;
|
||||||
@mismatch{in "%(\$1MsgTxt)s";}
|
@mismatch{in "%(\$1MsgTxt)s";}
|
||||||
}
|
}
|
||||||
|
|
||||||
clearCounter4 {
|
clearCounter4 {
|
||||||
out "CC 1";
|
out "CC 15";
|
||||||
in;
|
|
||||||
out "CC 2";
|
|
||||||
in;
|
|
||||||
out "CC 3";
|
|
||||||
in;
|
|
||||||
out "CC 4";
|
|
||||||
in;
|
in;
|
||||||
@mismatch{in "%(\$1MsgTxt)s";}
|
@mismatch{in "%(\$1MsgTxt)s";}
|
||||||
}
|
}
|
||||||
|
|
||||||
clearCounter8 {
|
clearCounter8 {
|
||||||
out "CC 5";
|
out "CC 480";
|
||||||
in;
|
|
||||||
out "CC 6";
|
|
||||||
in;
|
|
||||||
out "CC 7";
|
|
||||||
in;
|
|
||||||
out "CC 8";
|
|
||||||
in;
|
in;
|
||||||
@mismatch{in "%(\$1MsgTxt)s";}
|
@mismatch{in "%(\$1MsgTxt)s";}
|
||||||
}
|
}
|
||||||
|
|
||||||
clearCounter10 {
|
clearCounter10 {
|
||||||
out "CC 9";
|
out "CC 1536";
|
||||||
in;
|
|
||||||
out "CC 10";
|
|
||||||
in;
|
in;
|
||||||
@mismatch{in "%(\$1MsgTxt)s";}
|
@mismatch{in "%(\$1MsgTxt)s";}
|
||||||
}
|
}
|
||||||
@@ -217,52 +204,33 @@ setGate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# TODO To clean
|
|
||||||
|
|
||||||
startWithCountPreset4 {
|
startWithCountPreset4 {
|
||||||
clearTimer;
|
|
||||||
clearCounter4;
|
|
||||||
readAll4;
|
readAll4;
|
||||||
startWithCountPreset;
|
startWithCountPreset;
|
||||||
}
|
}
|
||||||
|
|
||||||
startWithCountPreset8 {
|
startWithCountPreset8 {
|
||||||
clearTimer;
|
|
||||||
clearCounter4;
|
|
||||||
clearCounter8;
|
|
||||||
readAll8;
|
readAll8;
|
||||||
startWithCountPreset;
|
startWithCountPreset;
|
||||||
}
|
}
|
||||||
|
|
||||||
startWithCountPreset10 {
|
startWithCountPreset10 {
|
||||||
clearTimer;
|
|
||||||
clearCounter4;
|
|
||||||
clearCounter8;
|
|
||||||
clearCounter10;
|
|
||||||
readAll10;
|
readAll10;
|
||||||
startWithCountPreset;
|
startWithCountPreset;
|
||||||
}
|
}
|
||||||
|
|
||||||
startWithTimePreset4 {
|
startWithTimePreset4 {
|
||||||
clearTimer;
|
|
||||||
clearCounter4;
|
|
||||||
readAll4;
|
readAll4;
|
||||||
startWithTimePreset;
|
startWithTimePreset;
|
||||||
}
|
}
|
||||||
|
|
||||||
startWithTimePreset8 {
|
startWithTimePreset8 {
|
||||||
clearTimer;
|
|
||||||
clearCounter4;
|
|
||||||
clearCounter8;
|
|
||||||
readAll8;
|
readAll8;
|
||||||
startWithTimePreset;
|
startWithTimePreset;
|
||||||
}
|
}
|
||||||
|
|
||||||
startWithTimePreset10 {
|
startWithTimePreset10 {
|
||||||
clearTimer;
|
|
||||||
clearCounter4;
|
|
||||||
clearCounter8;
|
|
||||||
clearCounter10;
|
|
||||||
readAll10;
|
readAll10;
|
||||||
startWithTimePreset;
|
startWithTimePreset;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,13 @@ record(seq, "$(INSTR)$(NAME):CORRECT-MONITOR-CHANNEL")
|
|||||||
field(SCAN, ".5 second")
|
field(SCAN, ".5 second")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
record(calc, "$(INSTR)$(NAME):RATE_MAP")
|
||||||
|
{
|
||||||
|
field(DESC, "Want a consistent lowrate pv")
|
||||||
|
field(INPA, "$(INSTR)$(NAME):RAW-STATUS.B2 NPP")
|
||||||
|
field(CALC, "(A=1)?1:0")
|
||||||
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Count Commands
|
# Count Commands
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ record(longout, "$(INSTR)$(NAME):MONITOR-CHANNEL")
|
|||||||
{
|
{
|
||||||
field(DESC, "PRESET-COUNT Monitors this channel")
|
field(DESC, "PRESET-COUNT Monitors this channel")
|
||||||
field(VAL, 1)
|
field(VAL, 1)
|
||||||
field(DRVL, "1") # Smallest Monitor Channel
|
field(DRVL, 0) # Smallest Monitor Channel (should really be 1)
|
||||||
field(DRVH, "1") # Largest Monitor Channel
|
field(DRVH, 1) # Largest Monitor Channel
|
||||||
field(DISP, 1)
|
field(DISP, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,6 +25,13 @@ record(longin, "$(INSTR)$(NAME):MONITOR-CHANNEL_RBV")
|
|||||||
field(DISP, 1)
|
field(DISP, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
record(calc, "$(INSTR)$(NAME):RATE_MAP")
|
||||||
|
{
|
||||||
|
field(DESC, "Want a consistent lowrate pv")
|
||||||
|
field(INPA, "$(INSTR)$(NAME):RAW-STATUS.B2 NPP")
|
||||||
|
field(CALC, "(A=0)?1:0")
|
||||||
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Count Commands
|
# Count Commands
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ record(longout, "$(INSTR)$(NAME):MONITOR-CHANNEL")
|
|||||||
{
|
{
|
||||||
field(DESC, "PRESET-COUNT Monitors this channel")
|
field(DESC, "PRESET-COUNT Monitors this channel")
|
||||||
field(VAL, 1)
|
field(VAL, 1)
|
||||||
field(DRVL, "1") # Smallest Monitor Channel
|
field(DRVL, 0) # Smallest Monitor Channel (should really be 1)
|
||||||
field(DRVH, "1") # Largest Monitor Channel
|
field(DRVH, 1) # Largest Monitor Channel
|
||||||
field(DISP, 1)
|
field(DISP, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,6 +25,13 @@ record(longin, "$(INSTR)$(NAME):MONITOR-CHANNEL_RBV")
|
|||||||
field(DISP, 1)
|
field(DISP, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
record(calc, "$(INSTR)$(NAME):RATE_MAP")
|
||||||
|
{
|
||||||
|
field(DESC, "Want a consistent lowrate pv")
|
||||||
|
field(INPA, "$(INSTR)$(NAME):RAW-STATUS.B2 NPP")
|
||||||
|
field(CALC, "(A=0)?1:0")
|
||||||
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Count Commands
|
# Count Commands
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,15 @@ record(seq, "$(INSTR)$(NAME):REINIT-CONF")
|
|||||||
# it must always be triggered after the value of $(INSTR)$(NAME):RAW-STATUS is
|
# it must always be triggered after the value of $(INSTR)$(NAME):RAW-STATUS is
|
||||||
# updated, so that it can't be the case that the status changes back from
|
# updated, so that it can't be the case that the status changes back from
|
||||||
# counting to idle, without having updated the time and count values.
|
# counting to idle, without having updated the time and count values.
|
||||||
record(longin, "$(INSTR)$(NAME):RAW-STATUS")
|
#
|
||||||
|
# The status can be interpreted as follows
|
||||||
|
#
|
||||||
|
# Bit 0: NC_STAT_P_TIME_C
|
||||||
|
# Bit 1: NC_STAT_P_COUNT_C
|
||||||
|
# Bit 2: NC_STAT_RATE_OK_C It appears this should be ignored unless counting
|
||||||
|
# Bit 3: NC_STAT_PAUSE_C
|
||||||
|
#
|
||||||
|
record(mbbiDirect, "$(INSTR)$(NAME):RAW-STATUS")
|
||||||
{
|
{
|
||||||
field(DESC, "Raw returned status value")
|
field(DESC, "Raw returned status value")
|
||||||
field(DTYP, "stream")
|
field(DTYP, "stream")
|
||||||
@@ -64,13 +72,44 @@ record(longin, "$(INSTR)$(NAME):RAW-STATUS")
|
|||||||
field(FLNK, "$(INSTR)$(NAME):READALL")
|
field(FLNK, "$(INSTR)$(NAME):READALL")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
record(bi, "$(INSTR)$(NAME):COUNTING_TIME")
|
||||||
|
{
|
||||||
|
field(INP, "$(INSTR)$(NAME):RAW-STATUS.B0")
|
||||||
|
field(ZNAM, "DISABLED")
|
||||||
|
field(ONAM, "COUNTING")
|
||||||
|
}
|
||||||
|
|
||||||
|
record(bi, "$(INSTR)$(NAME):COUNTING_PRESET")
|
||||||
|
{
|
||||||
|
field(INP, "$(INSTR)$(NAME):RAW-STATUS.B1")
|
||||||
|
field(ZNAM, "DISABLED")
|
||||||
|
field(ONAM, "COUNTING")
|
||||||
|
}
|
||||||
|
|
||||||
|
record(bi, "$(INSTR)$(NAME):IS_LOWRATE")
|
||||||
|
{
|
||||||
|
field(INP, "$(INSTR)$(NAME):RATE_MAP PP")
|
||||||
|
field(ZNAM, "LOW RATE")
|
||||||
|
field(ONAM, "GOOD RATE")
|
||||||
|
}
|
||||||
|
|
||||||
|
record(bi, "$(INSTR)$(NAME):IS_PAUSED")
|
||||||
|
{
|
||||||
|
field(INP, "$(INSTR)$(NAME):RAW-STATUS.B3")
|
||||||
|
field(ZNAM, "RUNNING")
|
||||||
|
field(ONAM, "PAUSED")
|
||||||
|
}
|
||||||
|
|
||||||
record(calc, "$(INSTR)$(NAME):MAP-STATUS")
|
record(calc, "$(INSTR)$(NAME):MAP-STATUS")
|
||||||
{
|
{
|
||||||
field(DESC, "Maps Raw Status to State")
|
field(DESC, "Maps Raw Status to State")
|
||||||
field(INPA, "$(INSTR)$(NAME):RAW-STATUS NPP")
|
field(INPA, "$(INSTR)$(NAME):INVALID-CONFIG NPP")
|
||||||
field(INPB, "$(INSTR)$(NAME):INVALID-CONFIG NPP")
|
field(INPB, "$(INSTR)$(NAME):RAW-STATUS.UDF NPP") # should also be invalid if can't read the status
|
||||||
field(INPC, "$(INSTR)$(NAME):RAW-STATUS.UDF NPP") # should also be invalid if can't read the status
|
field(INPC, "$(INSTR)$(NAME):COUNTING_TIME PP")
|
||||||
field(CALC, "(B=1||C==1)?4:A=0?0:(A=1||A=2)?1:(A=5||A=6)?2:(A=9||A=13||A=10||A=14)?3:4")
|
field(INPD, "$(INSTR)$(NAME):COUNTING_PRESET PP")
|
||||||
|
field(INPE, "$(INSTR)$(NAME):IS_LOWRATE PP")
|
||||||
|
field(INPF, "$(INSTR)$(NAME):IS_PAUSED PP")
|
||||||
|
field(CALC, "(A=1||B=1)?4:(F=1)?3:(C=0&&D=0)?0:(E=0)?2:1")
|
||||||
field(FLNK, "$(INSTR)$(NAME):STATUS")
|
field(FLNK, "$(INSTR)$(NAME):STATUS")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class DAQ:
|
|||||||
self.monitor = 0
|
self.monitor = 0
|
||||||
|
|
||||||
self.minratechannel = 0
|
self.minratechannel = 0
|
||||||
self.minrates = [2] * self.total_channels
|
self.minrates = [2] * (self.total_channels + 1)
|
||||||
|
|
||||||
self.gate_config = [
|
self.gate_config = [
|
||||||
#(enabled, count high/low),
|
#(enabled, count high/low),
|
||||||
@@ -50,7 +50,7 @@ class DAQ:
|
|||||||
]
|
]
|
||||||
|
|
||||||
def clearCount(self, counter):
|
def clearCount(self, counter):
|
||||||
self.counts[counter-1] = 0
|
self.counts[counter] = 0
|
||||||
|
|
||||||
def clearCounts(self):
|
def clearCounts(self):
|
||||||
self.counts = [0] * self.total_channels
|
self.counts = [0] * self.total_channels
|
||||||
@@ -92,7 +92,7 @@ class DAQ:
|
|||||||
if self.countmode == 'time':
|
if self.countmode == 'time':
|
||||||
if elapsed < self.presettime:
|
if elapsed < self.presettime:
|
||||||
|
|
||||||
if self.minratechannel >= 0 and self.rates[self.minratechannel] < self.minrates[self.minratechannel]:
|
if self.minratechannel > 0 and self.rates[self.minratechannel - 1] < self.minrates[self.minratechannel]:
|
||||||
# adjust the starttime, so that it is as if this polling period didn't happen
|
# adjust the starttime, so that it is as if this polling period didn't happen
|
||||||
self.starttime += elapsed - self.elapsed
|
self.starttime += elapsed - self.elapsed
|
||||||
self.status = 5
|
self.status = 5
|
||||||
@@ -115,7 +115,7 @@ class DAQ:
|
|||||||
elif self.countmode == 'count':
|
elif self.countmode == 'count':
|
||||||
if self.getMonitorCount() < self.presetcount:
|
if self.getMonitorCount() < self.presetcount:
|
||||||
|
|
||||||
if self.minratechannel >= 0 and self.rates[self.minratechannel] < self.minrates[self.minratechannel]:
|
if self.minratechannel > 0 and self.rates[self.minratechannel - 1] < self.minrates[self.minratechannel]:
|
||||||
# adjust the starttime, so that it is as if this polling period didn't happen
|
# adjust the starttime, so that it is as if this polling period didn't happen
|
||||||
self.starttime += elapsed - self.elapsed
|
self.starttime += elapsed - self.elapsed
|
||||||
self.status = 5
|
self.status = 5
|
||||||
@@ -171,16 +171,16 @@ class DAQ:
|
|||||||
return float(self.rates[channel - 1])
|
return float(self.rates[channel - 1])
|
||||||
|
|
||||||
def getMinRateChannel(self):
|
def getMinRateChannel(self):
|
||||||
return self.minratechannel + 1
|
return self.minratechannel
|
||||||
|
|
||||||
def setMinRateChannel(self, channel):
|
def setMinRateChannel(self, channel):
|
||||||
self.minratechannel = channel - 1
|
self.minratechannel = channel
|
||||||
|
|
||||||
def getMinRate(self, channel):
|
def getMinRate(self, channel):
|
||||||
return self.minrates[channel - 1]
|
return self.minrates[channel]
|
||||||
|
|
||||||
def setMinRate(self, channel, rate):
|
def setMinRate(self, channel, rate):
|
||||||
self.minrates[channel - 1] = rate
|
self.minrates[channel] = rate
|
||||||
|
|
||||||
def getGateStatus(self, channel):
|
def getGateStatus(self, channel):
|
||||||
return self.gate_config[channel - 1]
|
return self.gate_config[channel - 1]
|
||||||
@@ -260,7 +260,11 @@ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|||||||
|
|
||||||
elif re.fullmatch(r'CC (\d+)', data):
|
elif re.fullmatch(r'CC (\d+)', data):
|
||||||
counter = int(re.fullmatch(r'CC (\d+)', data).group(1))
|
counter = int(re.fullmatch(r'CC (\d+)', data).group(1))
|
||||||
daq.clearCount(counter)
|
num_bits = daq.total_channels
|
||||||
|
bits = [(counter >> bit) & 1 for bit in range(num_bits - 1, -1, -1)]
|
||||||
|
for ch, bit in enumerate(bits):
|
||||||
|
if bit:
|
||||||
|
daq.clearCount(ch)
|
||||||
send('')
|
send('')
|
||||||
|
|
||||||
elif re.fullmatch(r'TP (\d+(\.\d+)?)', data):
|
elif re.fullmatch(r'TP (\d+(\.\d+)?)', data):
|
||||||
|
|||||||
@@ -6,9 +6,8 @@ require sinqDAQ
|
|||||||
|
|
||||||
epicsEnvSet("STREAM_PROTOCOL_PATH","./db")
|
epicsEnvSet("STREAM_PROTOCOL_PATH","./db")
|
||||||
epicsEnvSet("INSTR","SQ:TEST:")
|
epicsEnvSet("INSTR","SQ:TEST:")
|
||||||
epicsEnvSet("NAME","CB_TEST")
|
|
||||||
|
|
||||||
epicsEnvSet("SET_SIM_MODE","") # Run Simulation Instead of Actual Interface
|
epicsEnvSet("SET_SIM_MODE","") # Run Simulation Instead of Actual Interface
|
||||||
runScript "$(sinqDAQ_DIR)daq_2nd_gen.cmd" "DAQ_IP=127.0.0.1, DAQ_PORT=2000"
|
runScript "$(sinqDAQ_DIR)daq_2nd_gen.cmd" "NAME=CB_TEST, DAQ_IP=127.0.0.1, DAQ_PORT=2000"
|
||||||
|
|
||||||
iocInit()
|
iocInit()
|
||||||
|
|||||||
Reference in New Issue
Block a user