48 ):
49
50
51 nw_specs = [nwmgr.Connection(name=PARTITION + ".hsievent",topics=[], address="tcp://127.0.0.1:12344")]
52
53
54 queue_bare_specs = [
55 app.QueueSpec(inst="time_sync_from_netq", kind='FollySPSCQueue', capacity=100),
56 ]
57
58
59 queue_specs = app.QueueSpecs(sorted(queue_bare_specs, key=lambda x: x.inst))
60
61 mod_specs = [
62 mspec("ntoq_timesync", "NetworkToQueue", [
63 app.QueueInfo(name="output", inst="time_sync_from_netq", dir="output")
64 ]),
65
66 mspec("fhsig", "FakeHSIEventGeneratorModule", [
67 app.QueueInfo(name="time_sync_source", inst="time_sync_from_netq", dir="input"),
68 ]),
69 ]
70
71 init_specs = app.Init(queues=queue_specs, modules=mod_specs)
72
73
74 jstr = json.dumps(init_specs.pod(), indent=4, sort_keys=True)
75 print(jstr)
76
77 initcmd = rcif.RCCommand(
78 id=cmdlib.CmdId("init"),
79 entry_state="NONE",
80 exit_state="INITIAL",
81 data=init_specs
82 )
83
84 trigger_interval_ticks = 0
85 if TRIGGER_RATE_HZ > 0:
86 trigger_interval_ticks = math.floor((1 / TRIGGER_RATE_HZ) * CLOCK_SPEED_HZ)
87
88 mods = [
89 ("fhsig", fhsig.Conf(
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",
98 )),
99 ]
100
101 confcmd = mrccmd("conf", "INITIAL", "CONFIGURED", mods)
102
103 jstr = json.dumps(confcmd.pod(), indent=4, sort_keys=True)
104 print(jstr)
105
106 startpars = rcif.StartParams(run=33, disable_data_storage=False)
107
108 startcmd = mrccmd("start", "CONFIGURED", "RUNNING", [
109 ("ntoq_timesync", startpars),
110 ("fhsig", startpars)
111 ])
112
113 jstr = json.dumps(startcmd.pod(), indent=4, sort_keys=True)
114 print("="*80+"\nStart\n\n", jstr)
115
116 stopcmd = mrccmd("stop", "RUNNING", "CONFIGURED", [
117 ("ntoq_timesync", None),
118 ("fhsig", None)
119 ])
120
121 jstr = json.dumps(stopcmd.pod(), indent=4, sort_keys=True)
122 print("="*80+"\nStop\n\n", jstr)
123
124
125 scrapcmd = mcmd("scrap", [
126 ("", None)
127 ])
128
129 jstr = json.dumps(scrapcmd.pod(), indent=4, sort_keys=True)
130 print("="*80+"\nScrap\n\n", jstr)
131
132
133
134 cmd_seq = [initcmd, confcmd, startcmd, stopcmd]
135
136
137 jstr = json.dumps([c.pod() for c in cmd_seq], indent=4, sort_keys=True)
138 return jstr
139