signal

package
v0.0.0-...-4d64c08 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 6 Imported by: 0

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

func GetSignalCells

func GetSignalCells(
	bitStream []byte,
	startOfSignalCells uint,
	header *msmHeader.Header,
	satCells []satellite.Cell,
	logLevel slog.Level,
) ([][]Cell, error)

GetSignalCells gets the data from the signal cells of an MSM4 message.

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

func (cell *Cell) GetAggregatePhaseRange() uint64

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

func (cell *Cell) GetAggregateRange() uint64

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

func (cell *Cell) PhaseRange() float64

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

func (cell *Cell) RangeInMetres() float64

RangeInMetres gives the distance from the satellite to the GPS device derived from the satellite and signal cell, in metres.

func (*Cell) RangeInMillis

func (cell *Cell) RangeInMillis() float64

RangeInMillis gives the distance from the satellite to the GPS device derived from the satellite and signal cell as the transit time in milliseconds.

func (*Cell) String

func (cell *Cell) String() string

String returns a readable version of a signal cell.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL