Files
gitea-pages/software/generalTime.html
T
2025-07-08 08:18:09 +02:00

368 lines
14 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="author" content="Babak Kalantari">
<style type="text/css">
<!--
body { font-family:Arial,sans-serif,espy;
background:white; margin:0; }
body,p,ul,ol,dl,div,table {font-size:12pt; }
p { line-height:120%; }
pre,code,tt { font-family:"Courier New",Courier,monospace; }
code,tt { font-size:13pt; }
h1 { font-size: 24pt; margin-top:1ex; margin-bottom:0; text-align:center; }
h2 { font-size: 18pt; margin-bottom:0.5ex; }
h3 { font-size: 14pt; margin-bottom:0.5ex; }
h4 { font-size: 13pt; margin-bottom:0.5ex; }
h5 { font-size: 12pt; margin-bottom:0.5ex; }
small { font-size: 9pt; }
code { color:#0000C0; }
li { margin-top: 2pt; margin-bottom: 2pt; }
pre { font-size: 13pt;
white-space:pre; }
.box { border:1px solid #000000;
background-color:#f4f4f4;
padding:1ex;
margin: 0 2ex 1ex 2ex; font-size:90%; }
th.PageTitle {
font-size : 14pt;
font-weight : bold; }
.menuf {
font-size:11pt;
color:#333333;
font-weight:600;
text-decoration:none;
}
.menuf:link {color:#333333;}
.menuf:visited {color:#666666;}
.menuf:hover {color:#FF0000;}
.menuf:active {color:#FF0000;}
.menus, .menus a {
font-size:10pt;
color:#333333;
text-decoration:none;
}
.menus:visited, .menus a:visited {color:#666666;}
.menus:hover, .menus a:hover {color:#FF0000;}
.menus:active, .menus a:active {color:#FF0000;}
a:hover {color:#FF0000;}
.red {color:#FF0000;}
.green {color:#008000;}
.blue {color:#0000C0;}
@media screen {
.printlayout {display:none;}
}
@media print {
.screenlayout {display:none;}
code { color:#000000; }
a:link {color:#000000;text-decoration:none}
a:visited {color:#000000;text-decoration:none}
a:hover {color:#000000;text-decoration:none}
a:active {color:#000000;text-decoration:none}
}
-->
</style>
<link rel="shortcut icon" href="http://epics.web.psi.ch/images/sls_icon.ico">
<title>generalTime</title>
</head>
<body bgcolor="#FFFFFF">
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr class="screenlayout">
<td bgcolor="#267ab8" colspan="5" valign="bottom" height="10">
<img
src="../images/black"
width="100%" height="1" alt=""></td>
</tr>
<tr class="screenlayout">
<td rowspan="2" colspan="2" align="center">
<a class="menuf" href="http://www.psi.ch"><img
src="../images/psi_logo" border="0"
alt="PAUL SCHERRER INSTITUT"></a></td>
<td rowspan="2"><img
src="../images/space"
width="1" height="65" alt=""></td>
<th class="PageTitle"><center>
<big>EPICS at PSI<big>
</center>
</th>
<td><img
src="../images/space"
width="10" height="1" alt=""></td>
</tr>
<tr class="screenlayout">
<th width="100%" valign="bottom" align="left">
<table border="0" cellspacing="0" cellpadding="0"><tr><td><a
href="https://www.psi.ch"
class="menuf">PSI</a></td><td><img
src="../images/space"
width="10" height="1" alt=""></td><td bgcolor="black"><img
src="../images/space"
width="1" height="1" alt=""></td><td><img
src="../images/space"
width="10" height="1" alt=""></td><td><a
href="https://www.aps.anl.gov/epics"
class="menuf">EPICS</a></td><td><img
src="../images/space"
width="10" height="1" alt=""></td><td bgcolor="black"><img
src="../images/space"
width="1" height="1" alt=""></td><td><img
src="../images/space"
width="10" height="1" alt=""></td><td><a
href="https://www.psi.ch/en/sls"
class="menuf">SLS</a></td><td><img
src="../images/space"
width="10" height="1" alt=""></td><td bgcolor="black"><img
src="../images/space"
width="1" height="1" alt=""></td><td><img
src="../images/space"
width="10" height="1" alt=""></td><td><a
href="https://www.psi.ch/en/swissfel"
class="menuf">SwissFEL</a></td><td><img
src="../images/space"
width="10" height="1" alt=""></td><td bgcolor="black"><img
src="../images/space"
width="1" height="1" alt=""></td><td><img
src="../images/space"
width="10" height="1" alt=""></td><td><a
href="https://www.psi.ch/en/protontherapy"
class="menuf">Proscan</a></td></tr></table>
</th>
</tr>
<tr class="screenlayout">
<td height="5" bgcolor="#267ab8" colspan="6" valign="bottom">
<img
src="../images/black"
width="100%" height="1" alt=""></td>
</tr>
<tr>
<td class="screenlayout" bgcolor="#e3eaf6" valign="top" align="center" width="179">
<br><a href="http://www.aps.anl.gov/epics"><img
src="../images/EPICS_small"
alt="EPICS" border=0></a><br><br>
<table cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td><img
src="../images/space"
width="20" height="29" alt=""></td><th width="100%" align="left"><a
href="../index.html"
class="menuf">EPICS at PSI</a>
<img
src="../images/black"
height="1" width="100%" alt=""></th></tr></table>
<table cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td><img
src="../images/space"
width="20" height="29" alt=""></td><th width="100%" align="left"><a
href="../software.html"
class="menuf">Software</a>
<ul style="margin:0 0 0 0; padding-left:1em;">
<li class="menus"><a href="s7plc.html"
>PLC Communication</a></li>
<li class="menus"><a href="streamdevice.html"
>StreamDevice</a></li>
<li class="menus"><a href="regDev.html"
>regDev</a></li>
<li class="menus"><a href="iocmon.html"
>IOC Monitoring</a></li>
<li class="menus"><a href="pcmon.html"
>PC Monitoring</a></li>
<li class="menus"><a href="firewire.html"
>Firewire Camera</a></li>
<li class="menus"><a href="http://dps.web.psi.ch/template.html?/psc/"
>Digital PS Control</a></li>
<li class="menus"><a href="tclioc.html"
>Tcl-IOC</a></li>
<li class="menus"><a href="iocLogBrowser.html"
>iocLogBrowser</a></li>
<li class="menus"><a href="ioc-octave.html"
>IOC-Octave</a></li>
<li class="menus"><a href="http://gfa-it.web.psi.ch/epicsSharp/"
>C# EPICS</a></li>
<li class="menus"><a href="generalTime.html"
>generalTime</a></li>
<li class="menus"><a href="GPMM.html"
>GPMM</a></li>
<li class="menus"><a href="sequencer.html"
>SNC/SEQ</a></li>
<li class="menus"><a href="caqtdm.html"
>caQtDM</a></li>
<li class="menus"><a href="CSDataQuick.html"
>CSDataQuick</a></li>
</ul>
<img
src="../images/black"
height="1" width="100%" alt=""></th></tr></table>
<table cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td><img
src="../images/space"
width="20" height="29" alt=""></td><th width="100%" align="left"><a
href="../training.html"
class="menuf">Training</a>
<ul style="margin:0 0 0 0; padding-left:1em;">
<li class="menus"><a href="../training/PSI-training.html"
>Courses at PSI</a></li>
<li class="menus"><a href="../training/caClientLessons.html"
>CA client lessons</a></li>
<li class="menus"><a href="../training/downloads.html"
>Downloads</a></li>
</ul>
<img
src="../images/black"
height="1" width="100%" alt=""></th></tr></table>
<form method="get" action="http://www.google.com/search">
<table border="0" cellpadding="0" cellspacing="0">
<tr><td align="center" nowrap>
<input type="search" placeholder="search" name="q" size="13" maxlength="255" value=""><br>
<input type="hidden" name="domains" value="epics.web.psi.ch">
<small>
<input type="radio" name="sitesearch" value=""> web
<input type="radio" name="sitesearch" value="epics.web.psi.ch"
checked="checked"> epics.web.psi.ch<br>
</small>
</td></tr></table>
</form><p></p><small>
Author: <a href="mailto:Babak Kalantari &lt;babak.kalantari&#64;psi.&#99;&#104;&gt;?subject=http://epics.web.psi.ch%2Fsoftware%2FgeneralTime%2F">Babak Kalantari</a><br>
Phone: +41 56 310 5122<br>
Updated: 11.09.2007<br>
<br><a
href="http://epics.web.psi.ch/software/generalTime/%2Fsoftware%2FgeneralTime%2Findex.php?forprint"><img
src="../images/printer"
border="0" alt=""></a>
<br><a
href="http://epics.web.psi.ch/software/generalTime/%2Fsoftware%2FgeneralTime%2Findex.php?forprint">Printer friendly version</a>
<br>&nbsp;</small><img
src="../images/space"
width="179" height="1" alt=""></td>
<td width="1" bgcolor="#000000"><img
src="../images/space"
width="1" height="1" alt=""></td>
<td><img
src="../images/space"
width="10" height="1" alt=""></td>
<td valign="top" width="100%" colspan="2">
<a name="top"></a><center><h1>generalTime</h1></center>
<body>
<h2>Contents</h2>
<ul>
<li><a href="generalTime.html#whatis">What is <em>generalTime</em>?</a></li>
<li><a href="generalTime.html#download">Download</a></li>
<li><a href="generalTime.html#config">How to use it?</a></li>
<li><a href="generalTime.html#Timekeeping">Timekeeping mechanism</a></li>
<li><a href="generalTime.html#Acknowledgements">Acknowledgements</a></li>
</ul>
<a name="whatis"></a>
<h2>What is <em>generalTime</em>?</h2>
<p>
<em>generalTime</em> is a timekeeping mechanism implemented as an
<a href="http://www.aps.anl.gov/epics" target="ex">EPICS</a>
device and driver support to provide and maintain clock time for an EPICS IOC. It is a replacement for
<em>drvTS</em> in iocCore of previous EPICS versions (before 3.14.8). It is meant to provide reliable and consistent time
across IOC's and combine different timekeeping methods on the same (EPICS) network.
It implements a failover mechanism specially in case of hardware-assisted time providers which may fail for different reasons.
</p>
<a name="Download"></a>
<h2>Download</h2>
<p>
The package includes drvGeneralTime, drvDevNTPTime, drvDevVWTime and drvDevEventTime:
<ul>
<li>Latest, <a href="generalTime/genTime_1_2.tar.gz">genTime_1_2.tar.gz</a> (29kB).
<br> (a) EventTime relies only on generalTime for a reference time and has no direct
contact to external time refrences such as NTP server.
<br> (b) For EventTime validation aoRecord type is used instead of bo to allow a desired
tolerance in time diffrence.
<br> (c) NTPTime fixed to handle arbitrary system clock rates.
<br> (d) generalTime init routine is called at <em>initHookAtBeginning</em>
</li>
<li>Prev. , <a href="generalTime/genTime_1_1.tar.gz">genTime_1_1.tar.gz</a> (29kB).
<br>EventTime driver was added to the initial version of generalTime (including NTP and VxWorks Time).
</li>
</ul>
</p>
<a name="#config"></a>
<h2>How to use it?</h2>
The first thing is to compile the package (for EPICS 3.14.8 and later). The supported OS at the moment is VxWorks.
You need to load the driver at IOC startup in an arbitrary stage.
For the <a href="generalTime.html#ntp">NTPTime</a> and <a href="generalTime.html#vxworks">VWTime</a> no configuration at startup is required, they
will be initilized automatically. For the <a href="generalTime.html#event">EventTime</a> a configuration command must be called at the
startup to configure the IOC with the right parameters such as master/slave, clock rate, UDP ports, etc. For detailed info see the
<a href="generalTime/EVENT_README.php.html">README.txt</a> in the package and follow the section <em>System requirements & configurations</em>.
<a name="Timekeeping"></a>
<h2>Timekeeping mechanism</h2>
<p>
<em>generalTime</em> maintains a list of prioritized clocks or time providers.
When a client (i.e. EPICS record) requests the time to update its timestamp, <em>generalTime</em> gives the time of
the highest avaiable and correct time provider (see the following figure). The idea behind is as the
following:
The <em>generalTime</em> device support has a central role.
Any time-provider acts as an independent driver, therefore they can be added to existing ones like a plug-in.
When a record wants to get a timestmap (i.e. when it is processed) it always uses the same method by a call to generalTime. generalTime goes through
the list of the registered time providers from the highest priority and returns the first correct time. Time providers are responsible
to determine whether or not they are correct.
<p><img src="generalTime/pclk.jpg"></p>
At the moment the folowing time providers are available:
<ul>
<li>
<a name="ntp"></a>
<h4>NTP Time</h4>
<p>
<em>drvDevNTPTime</em> maintains a clock (time provider) which relies on the NTP server of its
subnet. It is a pure soft clock. The NTPTime has been given a higher priority than VWTime which is logical. Each IOC
periodically syncs its time with the NTP server.
</p>
</li>
<li>
<a name="vxworks"></a>
<h4>VxWorks Time</h4>
<p>
<em>drvDevVWTime</em> maintains a clock (time provider) which synchronizes itself with the highest available
and correct time provider (which has been registered to generalTime, e.g. NTPTime). <em>VWTime</em> is the lowest priority clock and must always be avaiable.
It uses on-board real-time clock of the CPU.
</p>
</li>
<li>
<a name="event"></a>
<h4>Event Time</h4>
<p>
<em>drvDevEventTime</em> maintains a clock using the event system (APS/SLS/Diamond) timing hardware.
It uses a master-slave mechanism to achieve tightly synchronized clocks with high quality timetamps.
The master IOC generates and distributes clock ticks (event) to slave IOC's via the event system. Therefore
EventTime clocks in all IOC's (master and all slaves) tick exactly at the same rate which provides us with perfect
time synchrony. The highest timestamp resolution supported at the moment is about 333 nanosecond corresponding
to 3 MHz clock rate, however the event system hardware is capable to provide up to 125 MHz rates. The limitation of
3 MHz at the moment is only due to PLL algorithm in drvDevEventTime running on the event master IOC which regulates the clock rate to folllow
global time (provided by generalTime via drvDevNTPTime); otherwise if the user can live without runnig PLL algorithm at
the risk of drifing from global time, then one can go to higher clock rates as well.
</p>
</li>
</ul>
<a name="Acknowledgements"></a>
<h2>Acknowledgements</h2>
<p>
I should like to thank Jim Kowalkowsky for initial development of <em>drvTS</em>, Dave Thompson and Sheng Peng for priority-based clock concept, Timo
Korhonen for the fruitful discussions we've had during the <em>EventTime</em> dvelopment, Andrew Johnson
for his valuable comments.
</p>
</body>
<hr noshade size=1><small>
<span class="printlayout">Author:&nbsp;Babak Kalantari&nbsp;&nbsp; Phone:&nbsp;+41&nbsp;56&nbsp;310&nbsp;5122&nbsp;&nbsp; Email:&nbsp;babak.kalantari&#64;psi.&#99;&#104;&nbsp;&nbsp; Updated:&nbsp;11.09.2007&nbsp;&nbsp; </span>
Source:&nbsp;/afs/psi.ch/project/epics/webhosting/software/generalTime/index.php&nbsp;&nbsp;
</small>
</td></tr></table>
</body></html>