working on correcting the ordering of the messages

This commit is contained in:
2025-11-03 17:31:16 +01:00
parent e65725609c
commit 81bd3bef7f
4 changed files with 160 additions and 150 deletions
+2 -2
View File
@@ -8,8 +8,8 @@ require StreamGenerator, test
epicsEnvSet("INSTR", "SQ:TEST:")
epicsEnvSet("NAME", "SG")
drvAsynIPPortConfigure("ASYN_IP_PORT", "127.0.0.1:9071:54321 UDP", 0, 0, 0)
asynStreamGenerator("ASYN_SG", "ASYN_IP_PORT", 4, 1000, 8192)
drvAsynIPPortConfigure("ASYN_IP_PORT", "127.0.0.1:9071:54321 UDP", 0, 0, 1)
asynStreamGenerator("ASYN_SG", "ASYN_IP_PORT", 4, 10000, 1000, 8192)
dbLoadRecords("$(StreamGenerator_DB)daq_common.db", "INSTR=$(INSTR), NAME=$(NAME), PORT=ASYN_SG, CHANNELS=5")
+8 -5
View File
@@ -45,16 +45,15 @@ while True:
header[16] = t_high & 0xff
header[17] = t_high >> 8
# num_events = random.randint(0, 243)
num_events = 243
num_events = random.randint(0, 243)
# num_events = 243
# num_events = 1
# update buffer length
buffer_length = 21 + num_events * 3
header[0] = buffer_length & 0xff
header[1] = (buffer_length >> 8) & 0xff
tosend = list(header)
# I believe, that in our case we never mix monitor and detector events as
# the monitors should have id 0 and the detector events 1-9 so I have
# excluded that posibility here. That would, however, if true mean we could
@@ -62,6 +61,10 @@ while True:
is_monitor = random.randint(0, 9)
header[11] = 0 if is_monitor > 3 else random.randint(1,9)
tosend = list(header)
if is_monitor > 3:
for i in range(num_events):
@@ -103,4 +106,4 @@ while True:
sock.sendto(bytes(tosend), ('127.0.0.1', 54321))
mv = memoryview(bytes(header)).cast('H')
print(f'Sent packet {mv[3]} with {num_events} events {base_timestamp}')
# time.sleep(0.0005)
# time.sleep(0.5)