gnss

package
v0.7.7 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// gravitational constants
	MU_GPS float64 = 3.9860050e14
	MU_GLO float64 = 3.9860044e14
	MU_GAL float64 = 3.986004418e14
	MU_CMP float64 = 3.986004418e14

	// WGS84 value of Earth's gravatational constant (m^3/s^2)
	GM float64 = 3.986005e14
	// WGS84 value of Earth's rotation rate (rad/s)
	OMEGAEDOT float64 = 7.2921151467e-5
	// Speed of light (m/s)
	CLIGHT float64 = 299792458.0
	// PI as defined by GPS for computation of orbits
	PI              float64 = 3.1415926535898
	RTOL_KEPLER     float64 = 1e-14
	MAX_ITER_KEPLER int     = 30
)
View Source
var (
	// earth semimajor axis (m)
	RE_GRS80 float64 = 6378137.0
	RE_WGS84 float64 = 6378137.0
	// earth flattening
	FE_GRS80 float64 = 1.0 / 298.257222101
	FE_WGS84 float64 = 1.0 / 298.257223563
)

Functions

func ECEF2LLH

func ECEF2LLH(x, y, z float64, degrees bool) (latitude, longitude, height float64)

ECEF2LLH - Transform Earth-Centered, Earth-Fixed (ECEF) coordinates to Latitude, Longitude, and Height (LLH)

func Klobuchar

func Klobuchar(dt time.Time, ion [8]float64, pos [3]float64, azel [2]float64) (delay float64)

Klobuchar - compute ionospheric delay by broadcast ionosphere model (klobuchar model) pos - receiver position {lat,lon,h} (rad,m) azel - azimuth/elevation angle {az,el} (rad)

func LLH2ECEF

func LLH2ECEF(latitude, longitude, height float64, degrees bool) (x, y, z float64)

LLH2ECEF - Transform Latitude, Longitude, and Height (LLH) to Earth-Centered, Earth-Fixed (ECEF) coordinates

func Niell added in v0.7.2

func Niell(elev, lat, alt, doy float64) float64

func NiellWet added in v0.7.2

func NiellWet(elev, lat float64) float64

func Sasstamoinen

func Sasstamoinen(ele_degrees, recX, recY, recZ float64) float64

Sasstamoinen - find the troposhere delay for a given height

and elevation angle using the Sasstamoinen mapping function.

func SatAzEl

func SatAzEl(recX, recY, recZ, satX, satY, satZ float64) (azi, ele float64)

SatAzEl - Calculate satellite azimuth and elevation in degrees

func Stanag

func Stanag(ele_degrees, recX, recY, recZ float64) float64

func TimeToGPSWeekSec

func TimeToGPSWeekSec(dt time.Time) (gpsWeek int, SoW float64)

func XYZ2NEU

func XYZ2NEU(refX, refY, refZ, x, y, z float64) (n, e, u float64)

XYZ2NEU - Calculate East, North, Up

Types

type Attribute

type Attribute struct {
	Key   string  `json:"name"`
	Value float64 `json:"value"`
}

type Ephemeris

type Ephemeris struct {
	// EDID - Earthscope Datasource Identifier
	EDID string `json:"edid"`
	// ToC - Time of Clock
	ToC time.Time `json:"toc"`
	// System - gnss system (e.g. GPS, GLONAS, ..)
	System `json:"system"`
	// SvID - satellite PRN or slot number
	SvID int `json:"svid"`
	// DataType - (e.g. EPH, STO, ...)
	DataType string `json:"dtype"`
	// MsgType - (e.g. LNAV, FDMA, INAV, ...)
	MsgType string `json:"mtype"`
	// Reserved - for future use
	Reserved uint8 `json:"reserved"`
	// Values - slice containing ephemeris values
	Values []float64 `json:"values"`
}

func (Ephemeris) GetGALSatPos added in v0.6.18

func (eph Ephemeris) GetGALSatPos(gpsWeek int, gpsSoW float64) (satPos SatPosition, err error)

GetGALSatPos - Galileo I/NAV & F/NAV

func (Ephemeris) GetGPSSatPosLNAV

func (eph Ephemeris) GetGPSSatPosLNAV(gpsWeek int, gpsSoW float64) (satPos SatPosition, err error)

GetGPSSatPosLNAV - GPS L/NAV

func (Ephemeris) GetSatPos

func (eph Ephemeris) GetSatPos(gpsWeek int, gpsSOW float64) (s SatPosition, err error)

type Epoch

type Epoch struct {
	Time                time.Time     `json:"time"`
	ReceiverClockOffset time.Duration `json:"receiver_clock_offset"`
	EpochFlag           EpochFlag     `json:"epoch_flag"`
	Event               string        `json:"event"`
	Observations        []Observation `json:"obs"`
}

Epoch is a struct containing the observations

func (*Epoch) ToEpochMap added in v0.3.9

func (e *Epoch) ToEpochMap(s *Set) (epochMap EpochMap, err error)

ToEpochMap converts observations from a slice to a map keeps track of observable types as a function system

func (Epoch) ToJson added in v0.5.6

func (e Epoch) ToJson(w io.Writer) (err error)

type EpochFlag added in v0.3.9

type EpochFlag uint8

EpochFlag enumerates possible RINEX epoch flag cases

const (
	Ok EpochFlag = iota
	PowerFailure
	MovingAntenna
	NewSite
	HeaderInfo
	ExternalEvent
	CycleSlip
)

Note: these will not guard against unassigned integers

func (EpochFlag) String added in v0.3.9

func (epochFlag EpochFlag) String() string

String strigifies the epoch flag

type EpochMap

type EpochMap struct {
	Time           time.Time                         `json:"time"`
	ObservationMap map[string]map[string]Observation `json:"obs"`
}

EpochMap stores observations for a given epoch as a nested map

type Metadata

type Metadata struct {
	Time   time.Time
	Source byte
	F_0x00 string     // comment
	F_0x01 string     // software
	F_0x02 string     // program operator
	F_0x03 string     // location
	F_0x04 string     // site name/marker name
	F_0x05 string     // site number
	F_0x06 string     // monument description
	F_0x07 string     // monument number/marker number
	F_0x08 string     // marker name
	F_0x09 string     // marker number
	F_0x0c string     // date est.
	F_0x14 string     // site operator/observer
	F_0x15 string     // agency
	F_0x17 string     // antenna type
	F_0x18 string     // antenna number
	F_0x19 string     // receiver type
	F_0x1a string     // receiver number
	F_0x1b string     // receiver fw
	F_0x1d [3]float64 // ECEF X/Y/Z
	F_0x1e [3]float64 // ECEF Lon/Lat/Ht
	F_0x1f [3]float64 // Delta H/E/N
}

Metadata -

type Observation

type Observation struct {
	// Satellite System
	// G:0, R:1, S:2, E:3, C:4, J:5, I:6
	Sys System `json:"system"`
	// Satellite PRN or Slot (R)
	SvID int `json:"sv"`
	// Observation Type Code (e.g 1C, 1W, 2C, 2W, ...)
	Code string `json:"code"`
	// Frequency [Mhz] (e.g. 1575.42)
	Freq float64 `json:"freq"`
	// Frequency Channel Number (GLONASS Only)
	Fcn int `json:"fcn"`
	// Pseudorange [m]
	Range float64 `json:"range"`
	// Phase [cyc]
	Phase float64 `json:"phase"`
	// Doppler [Hz]
	Doppler float64 `json:"doppler"`
	// Signal-to-noise [db-Hz]
	SNR float32 `json:"snr"`
	// Slip count or timer
	LLI uint16 `json:"lli"`
	// Flags - bit 0,1,2 same as rinex
	Flags uint16 `json:"flags"`
}

Observation - a struct for holding GNSS observation data

type PositionEpoch

type PositionEpoch struct {
	Time       time.Time   `json:"time"`
	Site       string      `json:"site"`
	Frame      string      `json:"frame"`
	Center     string      `json:"center"`
	Solution   string      `json:"solution"`
	Release    time.Time   `json:"release_date"`
	Attributes []Attribute `json:"attributes"`
}

type SP3Element

type SP3Element struct {
	// Type can be P or V
	Type   string  `json:"type"`
	System int     `json:"system"`
	SvId   int     `json:"satellite"`
	X      float64 `json:"x"`
	Y      float64 `json:"y"`
	Z      float64 `json:"z"`
	Clk    float64 `json:"clk"`
	Xs     int     `json:"x_sigma"`
	Ys     int     `json:"y_sigma"`
	Zs     int     `json:"z_sigma"`
	ClkS   int     `json:"clk_sigma"`
	ClkE   string  `json:"clk_event"`
	ClkP   string  `json:"clk_predict"`
	OrbE   string  `json:"orb_event"`
	OrbP   string  `json:"orb_predict"`
}

type SP3Epoch

type SP3Epoch struct {
	Time     time.Time    `json:"time"`
	Elements []SP3Element `json:"elements"`
}

type SatPosition

type SatPosition struct {
	// X - ECEF X (meters)
	X float64 `json:"x"`
	// Y - ECEF Y (meters)
	Y float64 `json:"y"`
	// Z - ECEF Z (meters)
	Z float64 `json:"z"`
	// Clk - Satellite Clock [s]
	Clk float64 `json:"clock"`
	// Relativity - subtract from satellite clock
	Relativity float64 `json:"relativity"`
}

type Set

type Set struct {
	// contains filtered or unexported fields
}

Set - implemented as a map with an empty struct as the value

func NewSet

func NewSet() *Set

NewSet - A constuctor

func (*Set) Add

func (s *Set) Add(value sysCode)

Add - adds a new element to the set

func (*Set) Contains

func (s *Set) Contains(value sysCode) bool

Contains - returns true if value exists

func (*Set) GetObsBySys

func (s *Set) GetObsBySys(sys int) (obsType []string)

func (*Set) GetObsTypeMap

func (s *Set) GetObsTypeMap() (m map[string][]string)

func (*Set) Remove

func (s *Set) Remove(value sysCode)

Remove - removes an element from the set

type System added in v0.3.9

type System int

System stores the GNSS constellation type

const (
	GPS System = iota
	GLONASS
	SBAS
	GALILEO
	BEIDOU
	QZSS
	IRNSS
)

Here we enumerate the current constellations

func NewSystemFromChar added in v0.4.0

func NewSystemFromChar(sysChar string) (system System, err error)

func (System) Char added in v0.3.9

func (sys System) Char() string

Char returns the letter representing the system as a string

func (System) Int added in v0.3.9

func (sys System) Int() int

Int returns the integer represnting the system as an int

type TDCPEpoch

type TDCPEpoch struct {
	// Time of the epoch
	Time time.Time
	// A map containing satellite specific values
	Satellites map[string]*TDCPSatellite
	// Estimated XYZ delta in meters
	DeltaXYZ [3]float64
	// Estimated NEU delta in meters
	DeltaNEU [3]float64
	// Estimated receiver clock delta in meters
	DeltaCLK float64
	// Time difference between epochs (nanoseconds)
	DeltaTime time.Duration
}

A structure for storing TDCP results

type TDCPSatellite

type TDCPSatellite struct {
	// receiver position
	ReceiverXYZ [3]float64
	// satellite positon at time of transmission
	SatelliteXYZ [3]float64
	// clock bias at time of transmission
	ClockBias float64
	// relativity correction
	ClockRelativity float64
	// azimuth between receiver and satellite
	Azimuth float64
	// elevation angle between receiver and satellite
	Elevation float64
	// slant delay in meters
	Tropo float64
	// slant delay in meters
	Iono float64
	// satellite system (GPS:0, GLONASS:1, Galileo:2, BeiDou:3, QZSS:4)
	System int
	// satellite ID (PRN, SLOT, ...)
	SvID int
	// observations
	Observations []Observation
}

A structure for storing satellite specific TDCP results

Jump to

Keyboard shortcuts

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