CRIS/SIS: Data Archive Libraries

Last Modified Tuesday, 13-Jan-1998 13:26:36 PST.

This is a description of Level 1 data archival (to "level 1.1" data) C libraries for both CRIS and SIS. These libraries will be referred to as the "putData" libraries. Differences between CRIS and SIS will be noted as needed.

Note:

The putData (and utilities) libraries are locally available at
	/home/idunn1/rgr/prototype/lib/
and are called
	libCrisPutData.a
	libSisPutData.a
	libUtilities.a
and the associated header files
	crisPutData.h
	sisPutData.h
	utilities.h
are at
	/home/idunn1/rgr/prototype/src/include/
Also contained in the headers in this directory and its sub-directories are the definitions of the CRIS and SIS data structures.

The actual code is kept in

	/home/idunn1/rgr/prototype/src/lib/
For download and remote installation of these libraries, see the put data lib transfer and setup notes. Also, mostly for the purposes of porting the libraries, here is the documentation on the low level routines used in the libraries. Some utility routines less specific to the putData libraries are also occasionally used.

Finally, here is a sample Makefile which is used to compile test code which is used in some of the code examples which follow.

General Information:

First, all data structs are indexed by time tags in atomic seconds since the beginning of 1996 (which is also referred to as spacecraft time), and is here associated with the variable "secondsSince1996."

All data structs have a time interval in which they are valid. Most of the data structs have a constant periododicity, such as an event cycle's 256 second period or a summary's 1 second period. A few data structs, such as browse parameter structs and command table structs do not have a constant periododicity, but instead have an explicit end time stamp associated with the data. In the descriptions here, "endSecond" will refer either to ((secondsSince1996 - 1 sec) + period) for those structs with a constant periododicity, or to the ending time stamp in non-periodic data structs.

All files in the data archive cover a time interval of one day. The location of a particular day's data in the archive is described in the document Structure of the CRIS/SIS Level 1.1 Data Archives.

The first time a particular type of data is archived for a given day, the archive routines first create any necessary directories (as specified in the Structure of the CRIS/SIS Level 1.1 Data Archives document) and then create the appropriate archive file. For periodic data (such as high priority rate structs), a file is created which is large enough to contain all of the day's data of the given type, and the passed data struct is placed into a particular "time slot" in the file. The number of such slots in the archive file depends on the periododicity of the data type. Details.

In order to make it easy to write to different archive locations when and if desired, the archiver must set the environment variable L1_CRIS_DATA_BASE_DIRECTORY to write CRIS archives and L1_SIS_DATA_BASE_DIRECTORY to write SIS archives. For example,

setenv L1_SIS_DATA_BASE_DIRECTORY /home/idunn1/rgr/prototype/data/sis

THE ROUTINES:

Archiving Individual Data Structs

These routines take a pointer to a struct of a particular type of data, write the contents of the struct into the archive, and return a status integer to identify any problems or abnormalities during the process.
CRIS:
int putCrisBrowseParameters(struct BrowseCris *pDataStruct);
int putCrisCommandEcho(struct L1CrisCommandEcho *pDataStruct);
int putCrisCommandTable(struct L1CrisCommandTable *pDataStruct);
int putCrisEvents(struct L1CrisEventCycle *pDataStruct);
int putCrisHighPriorityRates(struct L1CrisHighPriorityRate *pDataStruct);
int putCrisHskp(struct L1CrisHskp *pDataStruct);
int putCrisLowPriorityRates(struct L1CrisLowPriorityRate *pDataStruct);
int putCrisSubset(struct L1CrisSubset *pDataStruct);
int putCrisSummary(struct L1CrisSummary *pDataStruct);
SIS:
int putSisBrowseParameters(struct BrowseSis *pDataStruct);
int putSisCommandEcho(struct L1SisCommandEcho *pDataStruct);
int putSisCommandTable(struct L1SisCommandTable *pDataStruct);
int putSisDacOffset0(struct L1SisDacOffset0 *pDataStruct);
int putSisDacOffset1(struct L1SisDacOffset1 *pDataStruct);
int putSisDiagnosticEvent(struct L1SisDiagnosticEvent *pDataStruct);
int putSisEvents(struct L1SisEventCycle *pDataStruct);
int putSisHighPriorityRates(struct L1SisHighPriorityRate *pDataStruct);
int putSisHskp(struct L1SisHskp *pDataStruct);
int putSisLowPriorityRates(struct L1SisLowPriorityRate *pDataStruct);
int putSisSubset(struct L1SisSubset *pDataStruct);
int putSisSummary(struct L1SisSummary *pDataStruct);

Sample code.


Archiving Arrays of Data Structures

In some cases, the archival process will be much more efficient if data structs are handed to the putData routines as arrays of a particular type of struct instead of one by one. The following routines provide such support for several of the data types.

The group put routines do not return a status.

CRIS:
void putCrisDiagnosticEventGroup(struct L1CrisDiagnosticEvent *pDataStructs);
void putCrisHighPriorityRatesGroup(struct L1CrisHighPriorityRate *pDataStructs);
void putCrisSubsetGroup(struct L1CrisSubset *pDataStructs);
void putCrisSummaryGroup(struct L1CrisSummary *pDataStructs);
SIS:
void putSisDiagnosticEventGroup(struct L1SisDiagnosticEvent *pDataStructs);
void putSisHighPriorityRatesGroup(struct L1SisHighPriorityRate *pDataStructs);
void putSisSubsetGroup(struct L1SisSubset *pDataStructs);
void putSisSummaryGroup(struct L1SisSummary *pDataStructs);

Sample code.


bruce