-
Notifications
You must be signed in to change notification settings - Fork 7
/
17-piservo
executable file
·41 lines (34 loc) · 1.02 KB
/
17-piservo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
. test.common
test_start "ptp4l and phc2sys with various PI servo configurations"
wander=1e-9
limit=4000
max_sync_time=2000
for jitter in 1e-8 1e-7 1e-6 1e-5; do
kp=$(awk 'BEGIN {x=1.5 / sqrt('$jitter'/'$wander'); print x < 0.7 ? x : 0.7}')
ki=$(awk 'BEGIN {x=1.2 / ('$jitter'/'$wander'); print x < 0.3 ? x : 0.3}')
time_rms_limit=$(awk 'BEGIN {print 1.5e-8 * ('$jitter'/1e-8)**0.75}')
freq_rms_limit=$(awk 'BEGIN {print 1.5e-8 * ('$jitter'/1e-8)**0.5}')
time_max_limit=$(awk 'BEGIN {print 8 * '$time_rms_limit'}')
freq_max_limit=$(awk 'BEGIN {print 8 * '$freq_rms_limit'}')
refclock_jitter=$jitter
master_conf=""
slave_conf=""
phc2sys_conf="-s /dev/ptp0 -O 0 -P $kp -I $ki"
nodes=1
master_nodes="0"
phc2sys_node=1
run_test || test_fail
check_sync || test_fail
master_conf="delay_mechanism P2P"
slave_conf="delay_mechanism P2P
pi_proportional_const $kp
pi_integral_const $ki"
phc2sys_conf=""
nodes=2
master_nodes="1"
phc2sys_node=0
run_ptp4l || test_fail
check_sync || test_fail
done
test_pass