DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
thi_gen.py
Go to the documentation of this file.
1# testapp_noreadout_two_process.py
2
3# This python configuration produces *two* json configuration files
4# that together form a MiniDAQApp with the same functionality as
5# MiniDAQApp v1, but in two processes. One process contains the
6# TriggerDecisionEmulator, while the other process contains everything
7# else.
8#
9# As with testapp_noreadout_confgen.py
10# in this directory, no modules from the readout package are used: the
11# fragments are provided by the FakeDataProdModule module from dfmodules
12
13
14# Set moo schema search path
15from dunedaq.env import get_moo_model_path
16import moo.io
17moo.io.default_load_path = get_moo_model_path()
18
19# Load configuration types
20import moo.otypes
21moo.otypes.load_types('timinglibs/timinghardwaremanagerpdi.jsonnet')
22import dunedaq.timinglibs.timinghardwaremanagerpdi as thi
23
24from daqconf.core.app import App, ModuleGraph
25from daqconf.core.daqmodule import DAQModule
26from daqconf.core.conf_utils import Direction
27
28#===============================================================================
29def get_thi_app(FIRMWARE_TYPE='pdii',
30 GATHER_INTERVAL=5e5,
31 GATHER_INTERVAL_DEBUG=10e7,
32 MASTER_DEVICE_NAME="",
33 FANOUT_DEVICE_NAME="",
34 HSI_DEVICE_NAME="",
35 CONNECTIONS_FILE="${TIMING_SHARE}/config/etc/connections.xml",
36 UHAL_LOG_LEVEL="notice",
37 HOST="localhost",
38 DEBUG=False):
39
40 modules = {}
41 fanout_devices=[]
42
43 if FANOUT_DEVICE_NAME:
44 fanout_devices.append(FANOUT_DEVICE_NAME)
45
46 if FIRMWARE_TYPE == 'pdi':
47 thi_class='TimingHardwareManagerPDI'
48 elif FIRMWARE_TYPE == 'pdii':
49 thi_class='TimingHardwareManagerPDII'
50 else:
51 raise Exception(f"'Unexpected firmware type: {FIRMWARE_TYPE}")
52
53 modules = [
54 DAQModule( name="thi",
55 plugin=thi_class,
56 conf= thi.ConfParams(connections_file=CONNECTIONS_FILE,
57 gather_interval=GATHER_INTERVAL,
58 gather_interval_debug=GATHER_INTERVAL_DEBUG,
59 monitored_device_name_master=MASTER_DEVICE_NAME,
60 monitored_device_names_fanout=fanout_devices,
61 monitored_device_name_endpoint="",
62 monitored_device_name_hsi=HSI_DEVICE_NAME,
63 uhal_log_level=UHAL_LOG_LEVEL)),
64 ]
65
66 mgraph = ModuleGraph(modules)
67
68 mgraph.add_endpoint("timing_cmds", "thi.timing_cmds", "TimingHwCmd", Direction.IN, check_endpoints=False)
69
70 if MASTER_DEVICE_NAME:
71 mgraph.add_endpoint(MASTER_DEVICE_NAME+"_info", "thi."+MASTER_DEVICE_NAME+"_info", "JSON", Direction.OUT, is_pubsub=True)
72 if HSI_DEVICE_NAME:
73 mgraph.add_endpoint(HSI_DEVICE_NAME+"_info", "thi."+HSI_DEVICE_NAME+"_info", "JSON", Direction.OUT, is_pubsub=True)
74 if FANOUT_DEVICE_NAME:
75 mgraph.add_endpoint(FANOUT_DEVICE_NAME+"_info", "thi."+FANOUT_DEVICE_NAME+"_info", "JSON", Direction.OUT, is_pubsub=True)
76
77 thi_app = App(modulegraph=mgraph, host=HOST, name="THIApp")
78
79 if DEBUG:
80 thi_app.export("thi_app.dot")
81
82 return thi_app
get_thi_app(FIRMWARE_TYPE='pdii', GATHER_INTERVAL=5e5, GATHER_INTERVAL_DEBUG=10e7, MASTER_DEVICE_NAME="", FANOUT_DEVICE_NAME="", HSI_DEVICE_NAME="", CONNECTIONS_FILE="${TIMING_SHARE}/config/etc/connections.xml", UHAL_LOG_LEVEL="notice", HOST="localhost", DEBUG=False)
Definition thi_gen.py:38