01-29-2024 10:23 AM
I apologize if something like this has been posted before. While I was able to find multiple discussions about synchronization, I wasn't able to find one representing my exact use case. I have two computers each connected to a cDAQ chassis. One chassis is a 9189 and the other is a 9185. Researching some of the documentation posted it seems there are two different categories of synchronization: Signal-based and timing-based. I have worked some with signal-based synchronization before sharing start triggers and sample clocks over PFI ports using BNC cables. However, given both of these chassis are timing aware, it seems the recommendation for the most robust solution is to leverage that technology to synchronize them. My understanding then is that I have two options:
My understanding is that with both cDAQ chassis connected to the same network, they will automatically synchronize their master time bases. Therefore, I just need to get both tasks started at the same time for them to be in sync. In the Figure 2 example linked above, they do this by using a host time start trigger of the same time set for both tasks. That is straight forward enough, but I am not sure how to implement that with two separate VIs running across two computers. I was thinking something leveraging network shared variables? If I designate one machine the master and the other as slave then I could share a "ready" boolean and a timestamp variable. If the slave VI is started first, I could program it to poll and wait on the ready boolean to be True from the master. Once the master task is started it could set the task start timestamp shared variable and the ready boolean to true. The slave could then read both values during its task configuration. I would have to ensure that there is sufficient time after the master sets the start timestamp to allow the slave to configure its task before that time has passed. But, I can easily set a 5 to 10 second delay without impacting our application, so I don't imagine this would be an issue. Does this sound like a reasonable way to go about this? I appreciate any advice!
01-30-2024 08:16 AM - edited 01-30-2024 08:16 AM
I think your idea is pretty reasonable to me. Most computers connected to the internet are synced to the NTP server by default. See How Accurate Is Network Time Protocol (NTP)?. Passing a start flag and the start time should be sufficient.
Just a reminder that the TSN protocol requires TSN-enabled switches hence eth1 of 9185 and 9189 should be connected while their eth0 connected to the host. Finding a TSN-Enabled Switch for Synchronizing NI TSN Devices