DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
daqconf
python
daqconf
generate_hwmap.py
Go to the documentation of this file.
1
#!/usr/bin/env python3
2
3
import
conffwk
4
import
os
5
import
json
6
import
sys
7
8
def
generate_hwmap
(
9
oksfile: str,
10
n_streams: int,
11
n_apps: int = 1,
12
det_id: int = 3,
13
app_host: str =
"localhost"
,
14
eth_protocol: str =
"udp"
,
15
flx_mode: str =
"fix_rate"
,
16
crate_id_offset: int = 1,
17
slot_id: int = 0,
18
) ->
None
:
19
20
schemafiles = [
21
"schema/confmodel/dunedaq.schema.xml"
,
22
"schema/appmodel/application.schema.xml"
,
23
"schema/appmodel/fdmodules.schema.xml"
,
24
"schema/appmodel/wiec.schema.xml"
,
25
]
26
dal =
conffwk.dal.module
(
"generated"
, schemafiles[-1])
27
db =
conffwk.Configuration
(
"oksconflibs"
)
28
db.create_db(oksfile, schemafiles)
29
30
group_name = os.path.basename(oksfile).removesuffix(
".data.xml"
)
31
groups = []
32
streams = []
33
senders = []
34
source_id = 0
35
36
for
app
in
range(n_apps):
37
print
(f
"Generating {app=}"
)
38
print(f
"New nic adding nic with id nic-{app}"
)
39
nic_dal = dal.NetworkInterface(f
"nic-{app}"
)
40
db.update_dal(nic_dal)
41
42
for
stream_no
in
range(n_streams):
43
print
(f
"Generating {stream_no=}"
)
44
45
# 28-May-2025, KAB: hack(?) to get DAPHNE TPs to have unique channel numbers
46
# within a single ReadoutApp. This involves setting DAPHNE slot numbers to
47
# unique values. There is probably more work to be done to get the DAPHNE
48
# and WIBEth crate/slot/stream numbers that we use in fake-data-playback and
49
# integration tests to better match real electronics, but hopefully this is
50
# sufficient for now.
51
if
det_id
in
[2, 8, 9]:
52
geo_dal = dal.GeoId(
53
f
"geioId-{source_id}"
,
54
detector_id=det_id,
55
crate_id=app+crate_id_offset,
56
slot_id=stream_no,
57
stream_id=1,
58
)
59
else
:
60
geo_dal = dal.GeoId(
61
f
"geioId-{source_id}"
,
62
detector_id=det_id,
63
crate_id=app+crate_id_offset,
64
slot_id=slot_id,
65
stream_id=stream_no,
66
)
67
db.update_dal(geo_dal)
68
stream = dal.DetectorStream(
69
f
"stream-{source_id}"
,
70
source_id=source_id,
71
geo_id=geo_dal,
72
)
73
db.update_dal(stream)
74
streams.append(stream)
75
db.commit()
76
77
sender_dal = dal.FakeDataSender(
78
f
"sender-{source_id}"
,
79
streams=[stream],
80
uses=nic_dal
81
)
82
db.update_dal(sender_dal)
83
senders.append(sender_dal)
84
db.commit()
85
86
source_id = source_id + 1
87
88
rec_dal = dal.FakeDataReceiver(
89
f
"dataRec-{app}"
,
90
uses=nic_dal
91
)
92
db.update_dal(rec_dal)
93
detconn_dal = dal.NetworkDetectorToDaqConnection(
94
f
"det-conn-{app}"
,
95
net_receiver=rec_dal,
96
net_senders=senders
97
)
98
db.update_dal(detconn_dal)
99
groups.append(detconn_dal)
100
senders = []
101
102
db.commit()
103
104
if
__name__ ==
"__main__"
:
105
generate_hwmap
(
"xxx.data.xml"
, 4, n_apps=2)
conffwk.Configuration.Configuration
Definition
Configuration.py:29
conffwk.dal.module
module(name, schema, other_dals=[], backend='oksconflibs', db=None)
Definition
dal.py:695
generate_hwmap
Definition
generate_hwmap.py:1
Generated on
for DUNE-DAQ by
1.17.0