lf-lang / reactor-uc

A lightweight reactor runtime targeted at resource-constrained embedded systems
BSD 2-Clause "Simplified" License
2 stars 2 forks source link

Add support for clock-synchronization #78

Open erlingrj opened 1 week ago

erlingrj commented 1 week ago

Clock synchronization is necessary for federations to operate correctly in real-time. We have two alternatives: 1) Add clock-sync as a runtime feature. Inspired by reactor-c 2) Develop a library reactor doing clock sync that can be instantiated in the federate

erlingrj commented 1 week ago

After a discussion with @edwardalee and @tanneberger we will initially go with (2). A few points:

  1. Clock-sync ports should be connected with physical connections, because then the time-of-reception will be the logical tag of the event triggering the reaction handling it.
  2. To minimize the time between reading physical time and storing it in the payload of an event, and the time where the event is sent over a connection, we should make this happen at a very odd tag where nothing else is happening in the federate. We can do that by scheduling an action at (current_time, UINT32_MAX) which is unlikely to coincide with anything.