GeneralTime Proposal Status at SNS and Ideas for EPICS base

10
ICS – Software Engineering Group 1 GeneralTime Proposal Status at SNS and Ideas for EPICS base David Thompson Sheng Peng Kay-Uwe Kasemir

description

GeneralTime Proposal Status at SNS and Ideas for EPICS base. David Thompson Sheng Peng Kay-Uwe Kasemir. Times used in EPICS. epicsTimeGetCurrent() “Now”, used to schedule tasks, delays, timeouts, … epicsTimeGetEvent(event number) Used to time-stamp records. Event number might select … - PowerPoint PPT Presentation

Transcript of GeneralTime Proposal Status at SNS and Ideas for EPICS base

Page 1: GeneralTime Proposal Status at SNS and  Ideas for EPICS base

ICS – Software Engineering Group

1

GeneralTime ProposalStatus at SNS

and Ideas for EPICS base

David Thompson

Sheng Peng

Kay-Uwe Kasemir

Page 2: GeneralTime Proposal Status at SNS and  Ideas for EPICS base

ICS – Software Engineering Group

2

Times used in EPICS

epicsTimeGetCurrent()“Now”, used to schedule tasks, delays, timeouts, …

epicsTimeGetEvent(event number)Used to time-stamp records. Event number might select … » “Now” (typically event # 0)

» Time of last beam pulse

» Time of last XYZ event

» …

Different implementations for RTEMS, Posix, Win32, … almost all of which ignore the event number andsimply pick the ‘system’ time from the OSi.e. GetCurrent() == GetEvent().

Page 3: GeneralTime Proposal Status at SNS and  Ideas for EPICS base

ICS – Software Engineering Group

3

iocClock

… implements epicsTimeGetCurrent()/GetEvent() for vxWorks as func. ptr. table.

Installs default handlers which call vxWorks’ NTP client routines.» We found some possible errors in the ‘ticksToSkip’

code.

iocClockRegister((*getCurrent)(), (*getEvent)())allows users to install routines that access site-specific timing hardware» Only one user can register.» This will hide iocClock’s NTP implementation.

Page 4: GeneralTime Proposal Status at SNS and  Ideas for EPICS base

ICS – Software Engineering Group

4

drvTS

Installs its GetCurrent()/GetEvent() routines via iocClockRegister().

Supports» NTP from boot host (different code from iocClock)» Custom soft time master & soft time slave protocol» Hooks for hardware timing system

Problem: No fall-back» For example, hardware timing system plug-in can’t tell

drvTS to temporarily use NTP, or fall back further to system clock when NTP host is also inaccessible.

» Complexity

Page 5: GeneralTime Proposal Status at SNS and  Ideas for EPICS base

ICS – Software Engineering Group

5

New: generalTime as currently used at SNS

Installs its GetCurrent()/GetEvent() routines via iocClockRegister().

Supports various time source plug-ins, currently:» SNS hardware (utility board), vxWorks clock, NTP, CMOS

clock.

Prioritizes the time sources» Always selects the “best available” time source,

depending on whether an event time or the current time is requested.

» When timing source reports error (no carrier, no connection to NTP host, …), the next available source is used.

» One can add a custom timing source and still benefit from the existing timing sources as a fall-back.

Page 6: GeneralTime Proposal Status at SNS and  Ideas for EPICS base

ICS – Software Engineering Group

6

API (extending iocClockRegister)

General time calls: iocClockRegister().

A time driver calls: generalTimeTpRegister().Arguments:» Tcp_priority: Priority of current time function.» getCurrent: Pointer to current time function in your

driver.» syncTime: A pointer to a function that general time calls

to synchronize the time in the driver if needed.» Tep_priority: Priority of event time function.» getEvent: The event time function in your driver.

Page 7: GeneralTime Proposal Status at SNS and  Ideas for EPICS base

ICS – Software Engineering Group

7

API (Continued)

When an EPICS API function requests a current time or an event time, general time calls registered time functions in order of priority.

When a time driver returns OK the search for the time is stopped and that time is returned to the Epics system caller.

If the time function returns ERROR then the next lower priority driver is called.

The lowest priority time is the system time which should always be available, even if it is wrong.

Page 8: GeneralTime Proposal Status at SNS and  Ideas for EPICS base

ICS – Software Engineering Group

8

General time features:

General time is an Epics driver with device support.

The drvGeneralTime report function reports status and a list of time providers.

Device support provides string and ai record support for status of current time providers for both event time and current time lists.

Page 9: GeneralTime Proposal Status at SNS and  Ideas for EPICS base

ICS – Software Engineering Group

9

Idea behind generalTime

generalTime:

Implements epicsTimeGetCurrent &

epicsTimeGetEventUsing a prioritized list

of time sources

drvSystemTimedevSystemTime

drvHWTimingSystem

drvTimeNTPdevTimeNTP

drvTimeCMOSdevTimeCMOS

GeneralTime returns the highest priority time source available

This is completely transparent to epics time and record processing functions.

Each of the time sources also supports dbior and AI records, returning seconds since 1/1/1990 and stat/sevr for diagnostics displays.

Page 10: GeneralTime Proposal Status at SNS and  Ideas for EPICS base

ICS – Software Engineering Group

10

Proposal for EPICS base

Instead of iocClock(single Current/Event routine, user replaceable),use generalTime(prioritized list of routines, user configurable).

Don’t limit it to vxWorks. Make generalTime the common code. Timing sources are OS specific, with a “System clock” timing source provided for all OS as the default.

Maybe provide soft time slave timing source for all OS? Then drvTS can be simplified to be soft time master.