19
Atacama Atacama Large Large Millimeter Millimeter Array Array ACS Training Time System

AtacamaLargeMillimeterArray ACS Training Time System

Embed Size (px)

Citation preview

Page 1: AtacamaLargeMillimeterArray ACS Training Time System

AtacamaAtacamaLargeLargeMillimeterMillimeterArrayArray

ACS Training

Time System

Page 2: AtacamaLargeMillimeterArray ACS Training Time System

Socorro, July 2004 ACS Training 2

Overview• Based on code from the TICS timeService module

• Most functionality is available from standard ACS components

• Used to:– Obtain the current array time

– Convert array time to various other representations including but not limited to ISO-8601, Universal Coordinated Time, etc.

– The ability to set “timeouts” which asynchronously invoke developer code at a specific time and/or frequency

– Convert native language time representations to and from OMG array time. Available natively without the use of CORBA to be fast

• ACS Time System does not include support for the 48ms clock based in the

antennas’ hardware

Page 3: AtacamaLargeMillimeterArray ACS Training Time System

Socorro, July 2004 ACS Training 3

General Terms1. OMG Time The format of time used by the Object Management Group is

based on the beginning of the Gregorian calendar. This is strictly defined as the number of one-hundred nanosecond units that have occurred since October 15, 1582 at precisely 00:00:00. For reference, the last representable date using this format is March 11, 60038.

2. Array Time The synchronized time according to all ALMA antennas???3. TAI TAI is short for International Atomic Time. Based on the second

unit and derived from a large number of clocks all over the world.4. UTC UTC is short for Coordinated Universal Time. Based on the second

unit but unlike TAI, UTC keeps track of so-called leap seconds. Offset from TAI is always an integer number of seconds.

5. Epoch A unique instance in time.6. Duration The difference between two epochs.7. Clock An IDL interface designed to give users the current time.8. Timer An IDL interface designed to execute developer code at a given

time.9. TimeoutHandler The “developer code” mentioned in 4.

Page 4: AtacamaLargeMillimeterArray ACS Training Time System

Socorro, July 2004 ACS Training 4

acstime.idl

An IDL file provided by ACS which contains time-related constants, data type

declarations, and IDL interfaces. This IDL file can be found

$ACSROOT/idl/acstime.idl on a PC where ACS has been installed (or

in ACS/LGPL/CommonSoftware/acstime/ws/idl/acstime.idl from the ALMA

CVS repository).

Page 5: AtacamaLargeMillimeterArray ACS Training Time System

Socorro, July 2004 ACS Training 5

acstime.idl (miscellaneous)

module acstime{ // The time systems that have some form of ACS support. enum TimeSystem { TSArray, // array time TSTAI, // International Atomic Time (TAI) TSUTC // Universal Coordinate Time (UTC) }; };

Page 6: AtacamaLargeMillimeterArray ACS Training Time System

Socorro, July 2004 ACS Training 6

Epoch• A unique instance in (OMG) time• An epoch is encoded in units of 100 nanoseconds, i.e.10^-7 seconds,

since October 15, 1582 at 00:00:00. • October 15, 1582 is the beginning of the Gregorian calendar.• It is stored in an unsigned 64-bit integer, giving it a range of more than

58,454 years. • The last representable date is around March 11, 60038. • This same encoding is used by the CORBA and X/Open DCE Time

Services. • In IDL, an epoch unit is represented by the typedef ACS::Time (i.e.,

unsigned long long) embedded within a struct.

Page 7: AtacamaLargeMillimeterArray ACS Training Time System

Socorro, July 2004 ACS Training 7

Epoch (IDL Definition)module acstime{ struct Epoch { ACS::Time value; };};

Page 8: AtacamaLargeMillimeterArray ACS Training Time System

Socorro, July 2004 ACS Training 8

Duration• The difference between two epochs. • It is not related to any particular instant of time. • A duration is encoded in units of 100 nanoseconds, i.e. 10^-7 seconds,

and can be positive or negative. • A Duration is stored in a signed 64-bit integer, giving it a range of more

than +/- 29,227 years. • This same representation is used by the CORBA and X/Open DCE Time

Services. • A signed value and in IDL it’s represented by the ACS::TimeInterval

typedef (i.e., long long) embedded inside a struct.

Page 9: AtacamaLargeMillimeterArray ACS Training Time System

Socorro, July 2004 ACS Training 9

Duration (IDL Definition)module acstime{ struct Duration { ACS::TimeInterval value; };};

Page 10: AtacamaLargeMillimeterArray ACS Training Time System

Socorro, July 2004 ACS Training 10

Clock

• An IDL interface implemented as a standard component which gives users the current OMG array time.

• Additionally, Clock provides a few time conversion functions along with public access to the variations between array, TAI, and UTC times.

• Clock is normally only used as a collocated object and will normally be present on all machines (i.e. on both LCUs and general-purpose workstations).

Page 11: AtacamaLargeMillimeterArray ACS Training Time System

Socorro, July 2004 ACS Training 11

Clock (IDL Definition)module acsnc { interface Clock : ACS::CharacteristicComponent { Duration getTimeInterval(in Epoch prevEpoch);

readonly attribute ACS::ROuLongLong now;

Epoch fromISO8601(in TimeSystem ts, in string iso) raises (ACSTimeError::ArgErrorEx);

string toISO8601(in TimeSystem ts, in Epoch timeValue) raises (ACSTimeError::ArgErrorEx); };};

Page 12: AtacamaLargeMillimeterArray ACS Training Time System

Socorro, July 2004 ACS Training 12

Timer

• An IDL interface implemented as a standard component which is capable of executing developer code (i.e., timeouts) at a given instance in time.

• Scheduled timeouts can occur only once or periodically.• Timeouts can be cancelled before they occur. • The code to be invoked is passed to the Timer component via the

implementation of a TimeoutHandler interface.

Page 13: AtacamaLargeMillimeterArray ACS Training Time System

Socorro, July 2004 ACS Training 13

Timer (IDL Definition)module acsnc { interface Timer : ACS::ACSComponent { long schedule(in TimeoutHandler handler,

in Epoch start, in Duration period) raises(ACSTimeError::ArgErrorEx);

void cancel(in long id) raises(ACSTimeError::InvalidIDEx); };};

Page 14: AtacamaLargeMillimeterArray ACS Training Time System

Socorro, July 2004 ACS Training 14

TimoutHandler (Offshoot)

• An IDL interface which must be implemented by the developer to be used.

• Create an object of this class to receive timeout events (not to be confused with channel events).

• This interface provides a callback type mechanism and can really be thought of as an alarm.

• A reference to this CORBA object is passed as an argument to Timer’s schedule method. Other arguments to schedule are when the timeout(s) will occur and how often.

• TimeoutHandler defines a “handleTimeout” method which shall only be invoked by Timer components.

Page 15: AtacamaLargeMillimeterArray ACS Training Time System

Socorro, July 2004 ACS Training 15

TimeoutHandler (IDL Definition)module acsnc { interface TimeoutHandler : ACS::OffShoot { void handleTimeout(in Epoch time); };};

Page 16: AtacamaLargeMillimeterArray ACS Training Time System

Socorro, July 2004 ACS Training 16

CORBA-less ACS Time LibrariesC++:http://www.eso.org/~almamgr/AlmaAcs/OnlineDocs/ACS_docs/cpp/classTimeUtil.htmlhttp://www.eso.org/~almamgr/AlmaAcs/OnlineDocs/ACS_docs/cpp/classDurationHelper.htmlhttp://www.eso.org/~almamgr/AlmaAcs/OnlineDocs/ACS_docs/cpp/classEpochHelper.html

Python:http://www.eso.org/~almamgr/AlmaAcs/OnlineDocs/ACS_docs/py/Acspy.Common.TimeHelper.htmlhttp://www.eso.org/~almamgr/AlmaAcs/OnlineDocs/ACS_docs/py/Acspy.Common.EpochHelper.htmlhttp://www.eso.org/~almamgr/AlmaAcs/OnlineDocs/ACS_docs/py/Acspy.Common.DurationHelper.html

Java:http://www.eso.org/~almamgr/AlmaAcs/OnlineDocs/ACS_docs/java/classalma_1_1acs_1_1util_1_1UTCUtility.html

Page 17: AtacamaLargeMillimeterArray ACS Training Time System

Socorro, July 2004 ACS Training 17

TimeoutHandler Implementations

In the ALMA CVS repository, take a look at:ACS/LGPL/CommonSoftware/acstime/ws/test/testTimeout.cppACS/LGPL/CommonSoftware/acspyexmpl/src/acspyexmplTimeoutHandler.pyACS/LGPL/CommonSoftware/jcontexmpl/src/alma/demo/client/TimeoutHandlerClient.java

These examples and tests are well documented and straightforward so unless someone wants to go over them…we’ll skip them.

Page 18: AtacamaLargeMillimeterArray ACS Training Time System

Socorro, July 2004 ACS Training 18

Questions???

Page 19: AtacamaLargeMillimeterArray ACS Training Time System

Socorro, July 2004 ACS Training 19

Demo(s)