39 PARTITION = "hsi_readout_test",
41 TRIGGER_RATE_HZ: int=1,
42 CLOCK_SPEED_HZ: int = 62500000,
43 HSI_TIMESTAMP_OFFSET: int = 0,
44 HSI_DEVICE_ID: int = 0,
45 MEAN_SIGNAL_MULTIPLICITY: int = 0,
46 SIGNAL_EMULATION_MODE: int = 0,
47 ENABLED_SIGNALS: int = 0b00000001,
51 nw_specs = [nwmgr.Connection(name=PARTITION +
".hsievent",topics=[], address=
"tcp://127.0.0.1:12344")]
55 app.QueueSpec(inst=
"time_sync_from_netq", kind=
'FollySPSCQueue', capacity=100),
59 queue_specs = app.QueueSpecs(sorted(queue_bare_specs, key=
lambda x: x.inst))
62 mspec(
"ntoq_timesync",
"NetworkToQueue", [
63 app.QueueInfo(name=
"output", inst=
"time_sync_from_netq", dir=
"output")
66 mspec(
"fhsig",
"FakeHSIEventGeneratorModule", [
67 app.QueueInfo(name=
"time_sync_source", inst=
"time_sync_from_netq", dir=
"input"),
71 init_specs = app.Init(queues=queue_specs, modules=mod_specs)
74 jstr = json.dumps(init_specs.pod(), indent=4, sort_keys=
True)
77 initcmd = rcif.RCCommand(
78 id=cmdlib.CmdId(
"init"),
84 trigger_interval_ticks = 0
85 if TRIGGER_RATE_HZ > 0:
86 trigger_interval_ticks = math.floor((1 / TRIGGER_RATE_HZ) * CLOCK_SPEED_HZ)
90 clock_frequency=CLOCK_SPEED_HZ,
91 trigger_interval_ticks=trigger_interval_ticks,
92 timestamp_offset=HSI_TIMESTAMP_OFFSET,
93 mean_signal_multiplicity=MEAN_SIGNAL_MULTIPLICITY,
94 signal_emulation_mode=SIGNAL_EMULATION_MODE,
95 enabled_signals=ENABLED_SIGNALS,
96 timesync_topic=
"Timesync",
97 hsievent_connection_name = PARTITION+
".hsievent",
101 confcmd = mrccmd(
"conf",
"INITIAL",
"CONFIGURED", mods)
103 jstr = json.dumps(confcmd.pod(), indent=4, sort_keys=
True)
106 startpars = rcif.StartParams(run=33, disable_data_storage=
False)
108 startcmd = mrccmd(
"start",
"CONFIGURED",
"RUNNING", [
109 (
"ntoq_timesync", startpars),
113 jstr = json.dumps(startcmd.pod(), indent=4, sort_keys=
True)
114 print(
"="*80+
"\nStart\n\n", jstr)
116 stopcmd = mrccmd(
"stop",
"RUNNING",
"CONFIGURED", [
117 (
"ntoq_timesync",
None),
121 jstr = json.dumps(stopcmd.pod(), indent=4, sort_keys=
True)
122 print(
"="*80+
"\nStop\n\n", jstr)
125 scrapcmd = mcmd(
"scrap", [
129 jstr = json.dumps(scrapcmd.pod(), indent=4, sort_keys=
True)
130 print(
"="*80+
"\nScrap\n\n", jstr)
134 cmd_seq = [initcmd, confcmd, startcmd, stopcmd]
137 jstr = json.dumps([c.pod()
for c
in cmd_seq], indent=4, sort_keys=
True)