Experimental Physics and Industrial Control System
|
Subject: |
Re: setting NTP time sync interval on vxWorks |
From: |
Ralph Lange <[email protected]> |
To: |
EPICS Tech-Talk <[email protected]> |
Date: |
Tue, 07 Jul 2015 09:59:20 +0200 |
Hi Yuliang,
On 06/07/2015 04:14, Zhang Yuliang wrote:
Why do you want to change the sync interval?
Originally, i want to improve the accuracy of the vxWorks internal clock by shorter the sync interval.
Now, based on your reply ,it think maybe it will not impove much.
Accuracy is a beast. ;-)
On vxWorks, the resolution of the EPICS timestamp is the resolution of
the system ticks. Look at the code for NTPTimeGetCurrent(): it checks
ticksSince = if ticks have passed since the last clock read time stamp
(skipping ticks if the system clock was > 1 tick faster than the NTP
clock at the last synchronization), and then adds ticksSince * tick
period to the clock read time stamp.
No matter what you do, this will limit the accuracy to the resolution of
+/- 1 tick period = +/- 16.67ms (for the default 60Hz ticks).
Any deviation of the tick clock will be in addition to that. The
deviation correction is done in ticks, too. No matter how often you
sync, the correction will happen when the error has grown to one tick,
pulling down accuracy by another tick period.
The deviation over one sync rate adds on top. In case of your 60.7Hz
tick clock that runs 7.2ms per minute too fast, the worst case is one
tick plus one minute (sync rate) of deviation, i.e. at 23.8ms off NTP time.
Add the worst case resolution error of 16.67ms to get a maximum
difference between system and NTP time stamps of 40.4ms.
Shortening the NTP sync interval will reduce the deviation error towards
its minimum of 16.67ms, but can't do anything against the resolution
error of 16.67ms.
Obviously, the only effective way of improving the accuracy is pushing
up the vxWorks system tick rate. But be careful: This increases the
interrupt load which some smaller systems / slower CPUs might not be
able to cope with. Also I have seen code that hard codes the tick rate
instead of using sysClkRateGet().
Most newer CPUs have hardware on board (e.g. usec precision programmable
32bit counters) that would allow a much more precise time stamp without
increasing the interrupt load. If you give up portability across CPU
types, you can write an EPICS General Time Provider that uses such
hardware to obtain high accuracy time stamping for your records.
[Or use Linux that has a 1kHz tick rate and a real NTP daemon (that is
bending the system clock), which will get you into the 1ms accuracy range.]
Another question:
If the vxWorks clock rate is 60 Hz and measured clock rate is 60.7 Hz, and suppose the networks is ok(ntp client can be synced every time per minute). Is the max deviation less than one tick(16.67ms)?
See above: the worst case for the difference between system and NTP
stamps is always = 2 * tick period + max deviation over one sync interval
Cheers,
~Ralph
-----原始邮件-----
发件人: "Ralph Lange" <[email protected]>
发送时间: 2015年7月3日 星期五
收件人: "EPICS Tech-Talk" <[email protected]>
抄送: "Zhang Yuliang" <[email protected]>
主题: Re: setting NTP time sync interval on vxWorks
Hi Yuliang,
The NTP sync interval is a compile time constant, thus it cannot be
changed at run time.
One question, though.
Your time report shows that the measured tick rate is 60.007 Hz, which
is a difference of about 2 us per tick, 120 us per second, 7.2 ms per
minute. Time resolution is in ticks, i.e. 16.67 ms. That means the NTP
sync will skip a single tick in the counter every two or three minutes.
Why do you want to change the sync interval?
Setting it longer will make the situation worse: more than one tick will
be skipped at larger intervals.
Setting it shorter will increase network traffic without changing the
situation much: a deviation of 7.2 ms per minute will always be
corrected by skipping one tick after between two and three minutes.
Cheers,
~Ralph
On 03/07/2015 10:36, Zhang Yuliang wrote:
Hi all,
I want to know how to set the NTP time sync interval on vxWorks. The output of "NTPTime_Report 1" shows the default interval is 60 seconds:
timingMain>NTPTime_Report 1
NTP driver is synchronized with server
Syncronization interval = 60.0 seconds
Last synchronized at 2015-07-03 16:06:19.062927
OS tick rate = 60 Hz (nominal)
Measured tick rate = 60.007 Hz
NTP Server = 10.1.201.31
value = 0 = 0x0
I can modify the variable "NTPTimeSyncInterval" in file $(EPICS_BASE)\src\libCom\osi\osiNTPTime.c to change the sync interval. Is there a command can be used in ioc shell?
Best regards,
Zhang Yuliang
- References:
- setting NTP time sync interval on vxWorks Zhang Yuliang
- Re: setting NTP time sync interval on vxWorks Ralph Lange
- Re: Re: setting NTP time sync interval on vxWorks Zhang Yuliang
- Navigate by Date:
- Prev:
streamdevice redirective problem Silver
- Next:
Job Opening at the Australian Synchrotron Paul Martin
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
<2015>
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: Re: setting NTP time sync interval on vxWorks Zhang Yuliang
- Next:
cs-studio 4.x BOY performance problem Xinyu.Wu
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
<2015>
2016
2017
2018
2019
2020
2021
2022
2023
2024
|
ANJ, 16 Dec 2015 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
·
Search
·
EPICS V4
·
IRMIS
·
Talk
·
Bugs
·
Documents
·
Links
·
Licensing
·
|