DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
wib_packet_sender Namespace Reference

Functions

 cli (address, port)
 

Variables

 console = Console()
 
 CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
 
 show_default
 
 True
 
 standalone_mode
 

Function Documentation

◆ cli()

wib_packet_sender.cli ( address,
port )

Definition at line 17 of file wib_packet_sender.py.

17def cli(address, port):
18 console.log(f"Preparing to send WIB packets to {address}:{port} in a loop.")
19 sock = socket.socket(socket.AF_INET, # Internet
20 socket.SOCK_DGRAM) # UDP
21
22 wf = fddetdataformats.WIBEthFrame()
23 wf.get_daqheader().det_id = 3
24 wf.get_daqheader().stream_id = 0
25 wf.get_daqheader().seq_id = 1
26 wf.get_daqheader().block_length = 0x382
27 wf.get_daqheader().timestamp = 0
28
29 sent_pkts = 0
30 sent_pkts_tot = 0
31 sent_bytes = 0
32 sent_bytes_tot = 0
33 start_time_orig = time.time();
34 start_time = time.time();
35 while True:
36 try:
37 for i in range(0,4):
38 wf.get_daqheader().stream_id = i
39 sock.sendto(wf.get_bytes(), (address, port))
40 sent_pkts +=1
41 sent_pkts_tot +=1
42 sent_bytes += len(wf.get_bytes())
43 sent_bytes_tot += len(wf.get_bytes())
44 if sent_pkts_tot % 100000 == 0:
45 stop_time = time.time()
46 interval = stop_time - start_time
47 console.log(f"Received {sent_pkts} packets: throughput is {sent_bytes*8/(interval*1000000000.):.2f} Gb/s")
48 sent_pkts = 0
49 sent_bytes = 0
50 start_time = stop_time
51
52 wf.get_daqheader().timestamp += (32*64)
53 if wf.get_daqheader().seq_id == 4095:
54 wf.get_daqheader().seq_id = 0
55 else:
56 wf.get_daqheader().seq_id +=1
57
58 except KeyboardInterrupt:
59 break
60 except:
61 continue
62
63 stop_time = time.time();
64 time_seconds = stop_time - start_time_orig
65 console.log(f"Sent {sent_pkts_tot} WIB packets in {time_seconds:.2f} seconds. Throughput = {(sent_bytes_tot*8)/(time_seconds*1000000000.):2f} Gb/s")
66

Variable Documentation

◆ console

wib_packet_sender.console = Console()

Definition at line 9 of file wib_packet_sender.py.

◆ CONTEXT_SETTINGS

wib_packet_sender.CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])

Definition at line 11 of file wib_packet_sender.py.

◆ show_default

wib_packet_sender.show_default

Definition at line 69 of file wib_packet_sender.py.

◆ standalone_mode

wib_packet_sender.standalone_mode

Definition at line 69 of file wib_packet_sender.py.

◆ True

wib_packet_sender.True

Definition at line 69 of file wib_packet_sender.py.