Skip to main content

Module altimax_als

Module altimax_als 

Source
Expand description

Rocketronics’ AltiMAX altimeters: a flight’s .ALS file, the samples as the altimeter stores them, before the PC software works heights and a speed out of them.

An AltiMAX with a memory card writes each flight to it as an .als file, which the maker’s PC software reads directly (AltiMAX G2 Handbuch, Louis Schreyer, 2010, p. 12). No manual describes the bytes, so the layout here was worked out from the one sample file, decoded against the software’s Excel export of the same flight (altimax): the file holds one record for each of the export’s rows, and every value it stores is the export’s, to the export’s 15 significant digits.

Layout. Little-endian throughout: a header of 32 bytes, then one record of 22 bytes a sample, then a trailer.

BytesFieldRead as
header 4–7u32the zero pressure, Pa: every height in the export is the standard atmosphere’s height of a pressure less that of this one
header 8–11u32the apogee’s pressure, Pa: the least filtered pressure, to the pascal
header 26–27u16the index of the last record: the records are one more
record 0u8the record’s kind: bit 0 always set, bit 1 never; bit 2 set when the record was stored 25 ms after the one before, clear when 5 ms; bits 3–7 the voltage channel the record’s count is, 1 to 5 in turn
record 1u8the event’s code, 0 for none
record 2–5f32the filtered pressure, Pa
record 6–9u32the raw pressure, Pa
record 10–11i16the acceleration, in counts of 0.01 g along an axis down the rocket
record 12–13u16the voltage channel’s count
record 14–218 byteszero in every sample record

The header’s other bytes, and the trailer, aren’t read: in the sample, the trailer is 2,616 bytes, nearly all zero.

The clock isn’t stored: each record is 5 ms or 25 ms after the one before, as its kind’s bit 2 says, and the first is at 5 ms, as in the export. The maker’s table gives storage rates of 200 and 40 samples a second (AltiMAX G4 Manual, Rocketronics, 2021, p. 10); its text says the rate drops to 50 a second 500 ms after the peak (p. 8), but the sample’s slower records are 25 ms apart, the table’s 40 a second. The clock is the running sum of the steps, as the export’s TIME.

Channels, each on that clock, named as the export names the column each becomes:

ChannelQuantityUnit
PRESS FILTER, PRESS RAWQuantity::PressurePa, as stored; the export’s header says hPa, but its values are these pascals
ACCELQuantity::Accelerationm/s²: each count 0.0981 m/s², 0.01 g with g taken as 9.81 m/s², the export’s own factor; the axis points down the rocket, so the pad reads about −1 g
EVENTQuantity::Numberthe event’s code, as written
VOLT. CHANNELQuantity::Numberthe record’s voltage channel, 1 to 5
VOLTAGE count (channel N)Quantity::Unrecognized, as writteneach channel’s count, on the records that hold it

The counts are kept as written. The export turns them into volts by one factor for channels 1 and 5 and another for 2 to 4, but no document states either, and the software lists five voltages without saying which channel is which (AltiMAX G4 Manual, p. 42).

Events. A record whose event code isn’t 0 is an event, named as the export names its code:

CodeNameCodeName
3BARO-LIFTOFF14LAND
5MACHDELAY20, 21PYRO1 ON, PYRO1 OFF
6, 7, 8TIMER1 END, TIMER2 END, TIMER3 END22, 23PYRO2 ON, PYRO2 OFF
9APOGEE PRESSURE28, 29, 30TIMER1 START, TIMER2 START, TIMER3 START
10, 11HEIGHT ASCEND, HEIGHT DESCEND

Any other code, which the sample doesn’t show, is named event N.

Stated. The record count, and the zero and apogee pressures as figures, zero pressure and apogee pressure.

No primary track. The file holds no height and no clock, so FlightLog::time_s and FlightLog::altitude_m are empty, as for the Raven’s raw .FIPa, and every value is a channel. The export’s heights are the software’s: the standard atmosphere’s height of each pressure, less that of the zero pressure.

Recognition. recognizes takes a file whose header states at least one record and a zero pressure of 50,000 to 110,000 Pa, a pad’s, and whose first records, up to 1,000, are each a kind with bit 0 set and bit 1 clear and a voltage channel one past the record before’s (1 after 5). It doesn’t read the eight zero bytes, so a file that differs only there is refused by read, naming the byte, not left unrecognized.

Refused, naming the byte: a record whose kind or zero bytes aren’t as above; a raw pressure on the first record that isn’t a pad’s, 50,000 to 110,000 Pa; a filtered pressure that isn’t finite; and a record past the header’s count, as a flight of more than 65,536 records, whose count 16 bits can’t hold, would have. A file shorter than its header and one record isn’t this format. A file that ends before its header’s count is read to its last whole record, with a note.

use hpr_flightdata::altimax_als;

// An invented file: two records, the second an event, then no trailer.
let mut bytes = vec![0_u8; 32];
bytes[4..8].copy_from_slice(&98_000_u32.to_le_bytes());
bytes[26..28].copy_from_slice(&1_u16.to_le_bytes());
for (channel, event, pressure) in [(1_u8, 0_u8, 98_000.0_f32), (2, 3, 97_990.0)] {
    bytes.push(channel << 3 | 1);
    bytes.push(event);
    bytes.extend(pressure.to_le_bytes());
    bytes.extend((pressure as u32).to_le_bytes());
    bytes.extend((-100_i16).to_le_bytes());
    bytes.extend(512_u16.to_le_bytes());
    bytes.extend([0; 8]);
}
let log = altimax_als::read(&bytes)?;
assert_eq!(log.events[0].name, "BARO-LIFTOFF");
assert_eq!(log.events[0].time_s, 0.01);

Functions§

read
Reads an AltiMAX .ALS file.
recognizes
Whether bytes are an AltiMAX .ALS file: a header stating at least one record and a zero pressure a pad’s, 50,000 to 110,000 Pa, and the first records, up to 1,000, each with its kind’s bit 0 set and bit 1 clear and its voltage channel the one after the record before’s. The bytes held to the sample aren’t read here: read refuses a file that differs there, naming the byte.