]> jspc29.x-matter.uni-frankfurt.de Git - mvd_epics.git/commitdiff
TrbNet: New IOC w/ Docker container added
authorPhilipp Klaus <philipp.l.klaus@web.de>
Tue, 18 Dec 2018 12:59:55 +0000 (13:59 +0100)
committerPhilipp Klaus <philipp.l.klaus@web.de>
Tue, 18 Dec 2018 12:59:55 +0000 (13:59 +0100)
MVD_TRBNET/Dockerfile [new file with mode: 0644]
MVD_TRBNET/README.docker [new file with mode: 0644]
MVD_TRBNET/build.sh [new file with mode: 0755]
MVD_TRBNET/mvd_trbnet_ioc.py [new file with mode: 0755]

diff --git a/MVD_TRBNET/Dockerfile b/MVD_TRBNET/Dockerfile
new file mode 100644 (file)
index 0000000..5bfdab2
--- /dev/null
@@ -0,0 +1,7 @@
+FROM pklaus/pytrbnet:latest
+
+ENV DAQOPSERVER jspc55.x-matter.uni-frankfurt.de:1
+
+WORKDIR /var/lib/mvd_epics
+ADD mvd_trbnet_ioc.py .
+CMD /var/lib/mvd_epics/mvd_trbnet_ioc.py
diff --git a/MVD_TRBNET/README.docker b/MVD_TRBNET/README.docker
new file mode 100644 (file)
index 0000000..6320eeb
--- /dev/null
@@ -0,0 +1,23 @@
+# How to run this IOC as a Docker image
+
+    docker run --rm -it -p 5064-5065:5064-5065 -p 5064-5065:5064-5065/udp pklaus/mvd_trbnet:latest
+
+Press Ctrl-C to stop. If everything worked well, you may proceed with starting the IOC in background and restarting on reboot.
+
+To start the container with the IOC in the background, the daemon parameter `-d` can be used. To have it reboot upon
+
+To start the example IOC in background (-d), run:
+
+    docker run \
+      -d -i -t \
+      --restart=always \
+      -p 5064-5065:5064-5065 \
+      -p 5064-5065:5064-5065/udp \
+      -w /epics/iocs/example/iocBoot/iocEXAMPLE \
+      pklaus/mvd_trbnet:latest
+
+To attach to the IOC later on, you may run
+
+    docker attach $(docker ps -q)
+
+To leave the attached process again, press Ctrl-p followed by Ctrl-q.
diff --git a/MVD_TRBNET/build.sh b/MVD_TRBNET/build.sh
new file mode 100755 (executable)
index 0000000..2a8d041
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+docker build --squash -t pklaus/mvd_trbnet .
diff --git a/MVD_TRBNET/mvd_trbnet_ioc.py b/MVD_TRBNET/mvd_trbnet_ioc.py
new file mode 100755 (executable)
index 0000000..30bde47
--- /dev/null
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+
+from trbnet.epics import TrbNetIOC
+
+ioc = TrbNetIOC()
+ioc.prefix = 'CBM:MVD:TRB:'
+
+print("\n______________________________________________\n\n")
+print("MVD TrbNet PCASpy IOC starting up.")
+print("Prefix: {}".format(ioc.prefix))
+print("\n______________________________________________\n\n")
+
+expected_trbs = {
+  0xffff: [0xd010, 0xd011, 0xd012, 0xd013, 0xc010],
+  0xfe4d: [0xd010, 0xd011, 0xd012, 0xd013],
+}
+
+for send_to_trb_address, answer_from_trb_addresses in expected_trbs.items():
+    ioc.add_expected_trb_addresses(send_to_trb_address, answer_from_trb_addresses)
+
+ioc.add_subscription(0xffff, 'TrbNet', 'StatusRegisters')
+ioc.add_subscription(0xfe4d, 'Mvd', 'ReadoutController')
+ioc.add_subscription(0xfe4d, 'CbController', 'CbCtrlReg')
+ioc.add_subscription(0xfe4d, 'CbController', 'CbSpiStream')
+ioc.add_subscription(0xfe4d, 'CbController', 'CbSpiRam')
+ioc.add_subscription(0xfe4d, 'CbController', 'CbUcReg')
+ioc.add_subscription(0xfe4d, 'JtagController', 'JtagCommonControl')
+ioc.add_subscription(0xfe4d, 'JtagController', 'JtagControl')
+ioc.add_subscription(0xfe4d, 'JtagController', 'JtagStatus')
+
+print("Failures to reach TrbNet or to read certain registers might show up"
+      "following this line...\n")
+ioc.initialize()
+
+all_pvs = ioc.all_pvs
+print("\n\n______________________________________________\n\n")
+print("Number of PVs monitored by this IOC: {}".format(len(all_pvs)))
+print("The first 10 PVs are named:\n" + "\n".join(all_pvs[0:10]))
+print("\n______________________________________________\n\n")
+
+ioc.run()