41 ):
42
43
44 nw_specs = [nwmgr.Connection(name=PARTITION + ".hsievent",topics=[], address="tcp://127.0.0.1:12344")]
45
46
47 queue_bare_specs = [
48 app.QueueSpec(inst="trigger_candidate_q", kind='FollySPSCQueue', capacity=2000),
49
50 ]
51
52
53 queue_specs = app.QueueSpecs(sorted(queue_bare_specs, key=lambda x: x.inst))
54
55 mod_specs = [
56 mspec("hsi", "HSIReadout", []),
57
58 mspec("ttcm", "TimingTriggerCandidateMaker", [
59 app.QueueInfo(name="output", inst="trigger_candidate_q", dir="output"),
60 ]),
61 ]
62
63 init_specs = app.Init(queues=queue_specs, modules=mod_specs, nwconnections=nw_specs)
64
65 jstr = json.dumps(init_specs.pod(), indent=4, sort_keys=True)
66 print(jstr)
67
68 initcmd = rcif.RCCommand(
69 id=cmdlib.CmdId("init"),
70 entry_state="NONE",
71 exit_state="INITIAL",
72 data=init_specs
73 )
74
75 mods = [
76 ("hsi", hsi.ConfParams(
77 connections_file=CONNECTIONS_FILE,
78 readout_period=READOUT_PERIOD,
79 hsi_device_name=HSI_DEVICE_NAME,
80 uhal_log_level=UHAL_LOG_LEVEL,
81 hsievent_connection_name = f"{PARTITION}.hsievent",
82 )),
83
84 ("ttcm", ttcm.Conf(
85 s1=ttcm.map_t(signal_type=TTCM_S1,
86 time_before=100000,
87 time_after=200000),
88 s2=ttcm.map_t(signal_type=TTCM_S2,
89 time_before=100000,
90 time_after=200000),
91 hsievent_connection_name = PARTITION+".hsievent",
92 )),
93 ]
94
95 confcmd = mrccmd("conf", "INITIAL", "CONFIGURED", mods)
96
97 jstr = json.dumps(confcmd.pod(), indent=4, sort_keys=True)
98 print(jstr)
99
100 startpars = rcif.StartParams(run=1, disable_data_storage=False)
101
102 startcmd = mrccmd("start", "CONFIGURED", "RUNNING", [
103 ("hsi", None),
104 ("ttcm", startpars),
105 ])
106
107 jstr = json.dumps(startcmd.pod(), indent=4, sort_keys=True)
108 print("="*80+"\nStart\n\n", jstr)
109
110 stopcmd = mrccmd("stop", "RUNNING", "CONFIGURED", [
111 ("hsi", None),
112 ("ttcm", None),
113 ])
114
115 jstr = json.dumps(stopcmd.pod(), indent=4, sort_keys=True)
116 print("="*80+"\nStop\n\n", jstr)
117
118
119 scrapcmd = mcmd("scrap", [
120 ("", None)
121 ])
122
123 jstr = json.dumps(scrapcmd.pod(), indent=4, sort_keys=True)
124 print("="*80+"\nScrap\n\n", jstr)
125
126
127 cmd_seq = [initcmd, confcmd, startcmd, stopcmd]
128
129
130 jstr = json.dumps([c.pod() for c in cmd_seq], indent=4, sort_keys=True)
131 return jstr
132