2.1 KaltoaClockSync
KaltoaClockSync
objects hold correction values that can be used to synchronize receiver clocks within an array.
Additionally, it can also hold receiver position corrections.
Below is a plot of our receiver array.
Generally, it’s best to use a single receiver as a reference clock.
Here, we’ll use the center receiver 3
(sync-tag 62074
) as this has good connectivity to all the surrounding ones.
We can use the function SyncTagConnectivity
to examine the number of sync-tag detections between receiver pairs.
# Show connectivity
# (number of detections between receiver pairs)
SyncTagConnectivity(exdata_clocksync) |> summary()
## detect
## emit 1 2 3 4 5 6
## 1 0 118 117 117 112 110
## 2 123 0 118 95 114 119
## 3 114 107 0 110 111 111
## 4 114 78 110 0 113 113
## 5 111 106 109 111 0 95
## 6 52 89 133 131 15 0
We’ll need to specify a data.frame
providing the order for the pairwise clock drift corrections, sync_order
, and a vector of times to calculate drift corrections for, offset_times
.
You can string together calls of the sync_pair
function to create a correctly formatted sync_order
data.frame
.
# Create a data.frame holding the order of paired clock synchronizations
sync_order <-
sync_pair("3", "1") +
sync_pair("3", "2") +
sync_pair("3", "4") +
sync_pair("3", "5") +
sync_pair("4", "6")
sync_order
## controller target direction_a direction_b
## 1 3 1 TRUE TRUE
## 2 3 2 TRUE TRUE
## 3 3 4 TRUE TRUE
## 4 3 5 TRUE TRUE
## 5 4 6 TRUE TRUE
Note that you can specify which sync-tag transmissions are used for drift corrections between receiver pairs. Typically you want to use transmissions in both directions, utilizing both sync-tags in a receiver pair.
Here, receiver "3"
will be used as a reference for the receivers "1"
, "2"
, "4"
, and "5"
.
After those pairwise synchronizations, receiver "4"
will then be used as a reference to calibrate "6"
.
Note that the order matters here, and all receivers in your array should be included in your sync_order
table as either a reference—controller—or a clock to be corrected—target.
Take your time on setting up the sync_order
table.
Receivers pairs with poor sync-tag connectivity will result in poor quality drift corrections.
If possible, it is best to have 1 single well connected receiver acting as a controller for the entire array.
We’ve added a second controller above just for the sake of an example.
We’ll calculate drift corrections on an hourly basis by setting appropriate clock times.
# Make a vector of times to calculate clock drift corrections for.
clock_times <- seq(
as.POSIXct("2021-05-08 18:00:00", tz = "CET"),
as.POSIXct("2021-05-09 06:00:00", tz = "CET"), by = 3600)
clock_times
## [1] "2021-05-08 18:00:00 CEST" "2021-05-08 19:00:00 CEST"
## [3] "2021-05-08 20:00:00 CEST" "2021-05-08 21:00:00 CEST"
## [5] "2021-05-08 22:00:00 CEST" "2021-05-08 23:00:00 CEST"
## [7] "2021-05-09 00:00:00 CEST" "2021-05-09 01:00:00 CEST"
## [9] "2021-05-09 02:00:00 CEST" "2021-05-09 03:00:00 CEST"
## [11] "2021-05-09 04:00:00 CEST" "2021-05-09 05:00:00 CEST"
## [13] "2021-05-09 06:00:00 CEST"
Next, we’ll create the KaltoaClockSync
model.
This holds our parameters for clock synchronization.
# Transmission are assumed to travel no farther than 500 meters.
# We can use this to set phi (maximum added latency from a reflected
# transmission)
phi <- 500 / 1500
# Initialize model
sync_model <- KaltoaClockSync(
sync_order = sync_order,
phi = phi,
clock_times = clock_times,
detlst = exdata_clocksync)
print(sync_model)
## KaltoaClockSync Object
##
## --- Parameters
## Detection error phi: 0.3 s
## Detection error beta: 32.0
## Detection-emission grouping threshold: 0.5 s
## Transmission speed: 1500.0 m s⁻¹
##
## 13 clock times ranging: 2021-05-08 18:00:00 -- 2021-05-09 06:00:00 (CET)
##
## --- Clock drift ranges
## 3 ⟷ 1: 0.0000 s -- 0.0000 s
## 3 ⟷ 2: 0.0000 s -- 0.0000 s
## 3 ⟷ 4: 0.0000 s -- 0.0000 s
## 3 ⟷ 5: 0.0000 s -- 0.0000 s
## 4 ⟷ 6: 0.0000 s -- 0.0000 s
##
## --- Clock offsets
## 1: 0.0000 s
## 2: 0.0000 s
## 3: 0.0000 s
## 4: 0.0000 s
## 5: 0.0000 s
## 6: 0.0000 s
##
## --- Position offsets
## 1: 0.0 m, 0.0 m
## 2: 0.0 m, 0.0 m
## 3: 0.0 m, 0.0 m
## 4: 0.0 m, 0.0 m
## 5: 0.0 m, 0.0 m
## 6: 0.0 m, 0.0 m
The next sections will deal with using our sync-tag data to estimate the appropriate drift and offset values for this object.