Documentation ¶
Overview ¶
package signal contains code to handle the data from a signal cell from a Multiple Signal Message type 4 (message type 1074, 1084 etc.). Various values are defined from values in the signal cell and its associated satellite cell. For convenience the ones from the satellite cell are copied here.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cell ¶
type Cell struct { // ID is the ID of the signal that was observed: 1-32. ID uint // Wavelength is the wavelength of the signal Wavelength float64 // RangeDelta - int15. A scaled value representing a small signed delta to be added to // the range values from the satellite to get the range as the transit time of the // signal. The value is in units of (two to the power of -24) milliseconds. To get // the range in metres, multiply the result by one light millisecond (the distance // light travels in a millisecond). The function RangeInMetres combines the 3 values // and returns th result in metres. RangeDelta int // PhaseRangeDelta - int22. Invalid if the top bit is set and the others are all zero // (-2097152). The true phase range for the signal is derived by scaling this and adding // it to the approximate value in the satellite cell. If this value is invalid, use just // the approximate value. PhaseRangeDelta int // LockTimeIndicator - uint4. LockTimeIndicator uint // HalfCycleAmbiguity flag - 1 bit. HalfCycleAmbiguity bool // CarrierToNoiseRatio - uint6. CarrierToNoiseRatio uint // The satellite that sent the signal. Satellite *satellite.Cell // LogLevel controls the data output by String. LogLevel slog.Level }
Cell holds the data from an MSM4 message for one signal from one satellite, plus values copied from the satellite.
func New ¶
func New( signalID uint, satelliteCell *satellite.Cell, rangeDelta, phaseRangeDelta int, lockTimeIndicator uint, halfCycleAmbiguity bool, cnr uint, wavelength float64, logLevel slog.Level, ) *Cell
New creates an MSM Signal Cell.
func (*Cell) GetAggregatePhaseRange ¶
GetAggregatePhaseRange takes a header, satellite cell and signal cell, extracts the phase range values, aggregates them and returns them as a 41-bit scaled unsigned unsigned integer, 8 bits whole part and 33 bits fractional part. Use getPhaseRangeCycles to convert this to the phase range in cycles.
func (*Cell) GetAggregateRange ¶
GetAggregateRange takes the range values from an MSM4 signal cell (including some copied from the MSM4satellite cell) and returns the range as a 37-bit scaled unsigned integer with 8 bits whole part and 29 bits fractional part. This is the transit time of the signal in milliseconds. Use RangeInMetres to convert it to a distance in metres. The whole millis value and/or the delta value can indicate that the measurement was invalid. If the approximate range value in the satellite cell is invalid, the result is 0. If the delta in the signal cell is invalid, the result is the approximate range.
This is a helper function for RangeInMetres, exposed for unit testing.
func (*Cell) PhaseRange ¶
PhaseRange combines the range and the phase range from an MSM4 message and returns the result in cycles. It returns zero if the input measurements are invalid and an error if the signal is not in use.
func (*Cell) RangeInMetres ¶
RangeInMetres gives the distance from the satellite to the GPS device derived from the satellite and signal cell, in metres.
func (*Cell) RangeInMillis ¶
RangeInMillis gives the distance from the satellite to the GPS device derived from the satellite and signal cell as the transit time in milliseconds.