Almost all the WXM data products go through the following pipeline:
1. Raw data is acquired by the DSP in port C, using the Serial Synchronous Interface (SSI), and stored in the SSI queue.
2. A background task initiated by the 4ms IRQB interrupt runs through the SSI queue, takes the raw data and extracts it into the various data products.
3. The data products are shipped from the DSP to the transputer. some of them are treated intelligently by the transputer, others are pretty much just relayed to ground.
4. The data sits in a circular buffer on the transputer, written in at the head of the buffer. A separate process reads the data from the tail of the queue and inserts it into the telemetry stream.
5. This telemetry processes reduces the volume of data significantly; it does this mostly by adding several histograms (integrating in time) unless there is burst activity.
The reason for the separate process to generate the telemetry is that the "receiving" process has to be ready to read its input, otherwise new data coming from the DSP might not get serviced quickly.
The time history data is formed by the principal histogram-dispenser in the DSP IRQB handler. The histograms are collected every 20ms and stored up in an IPP message until n of them have been accumulated, at which point they are scheduled to be sent to the transputer in an IPP message. The upper bound on n is 13, since that is all that will fit in a single message. (This could change in the future, if I start using bytes instead of 16 bit words to store the counts.)
The binning for time histories is the following: 4 energy bands and 4 detectors (XA, XB, YA, YB).
The time history data is meant to be the high-time-resolution, low-energy-resolution data which is used by the transputer for detecting burst triggers. It closely resembles the format of the the gamma ray instrument (FREGATE) time history data, which is also used for triggering.
In fact, the combined data from the WXM and FREGATE is put into a single data structure with 8 energy bands (4 xray and 4 gamma ray).
Because of the correspondence between WXM and FREGATE time history data, the time history binning is synchronized between the two processors.
The current method of synchronization is the following:
Both instruments use the 4ms IRQB interrupt to set the pace of their histograms. The IRQB interrupts are also synchronized with the satellite microsecond clock, which means that IRQB will always fall on exact 4094 microsecond boundaries, for both processors. To synchronize the 20ms histogram freezing, therefore, when we start data collection we check the satellite clock in IRQB until it is very close to an exact multiple of 20ms (actually 20*1024 microseconds). Then we always count 5 IRQBs to determine when the next 20ms have elapsed.
Once the time history data is received by the transputer, it is stored in a large circular buffer so that it can be used for triggering (see section Triggering).
There is not enough telemetry bandwidth to downlink all the time history data that is collected. The solution we adopt is to integrate the time histories over time during quiescent periods, so that the resolution is (TBD) 4 seconds instead of 20 miliseconds (we integrate 200 time histories).
During bursts, instead, we send to ground the full time history information.
The algorithm to do this is the following:
wait() system call, until it is woken up. The
watermark should be equal to the number of time history samples we
integrate into one telemetry sample.
wakeup() to signal the telemetry process that it should do its
work. wakeup() is less time consuming than sending a message.
...
The Pulse Height Analysis data (PHA) is high-energy-resolution low-time-resolution data, to be used for analyzing spectra.
When a photon gets clocked in by the SSI interrupt handler in the DSP, the following data gets put in the SSI queue:
This gets packed into a more compact format by the routine
tag_pack(), from the common utilities set, in file
tag_utils.c.
The more compact format consists of two words: a 16 bit data word and an n-bit time difference word (n can be chosen to minimize the telemetry; right now it is set to 16). The time difference word stores the amount of time (in microseconds) which has elapsed since the previous photon tag was sent.
If more more than 2^16 microseconds (about 64ms) have elapsed since the previous photon came in, the high order 4 bits of the data word, which normally contain the wire information (0 through 11), are set to a value of 12, 13, 14 or 15 to indicate that we have had a wraparound. A value of 12 corresponds to a single wraparound of 2^16; 13 corresponds to 2*2^16, 14 corresponds to 3*2^16. A value of 15 means that there have been too many wraparounds, and the next 2 photon tags will contain the full spacecraft time value to be used as a new starting time.
The normal scenario is that less than 2^16 microseconds have passed. In that case, the photon tag consists of:
Problem (???): how do I get the wire information in there if I am wrapping around? Two mutually exclusive solutions:
What do we do with the photon tag data? It gets stored in a large queue on the transputer (which we hope will be big enough to store a few minutes of it), and sits there until there is a trigger. When there is a trigger, the triggering process sends a message to the photon tag archiving process, which transmits the current photon tag queue to ground (see section Triggering). This way we hope to have the photon tag data for the period before, during and after the burst.