solsys

package
v0.0.0-...-46d2e35 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: CC0-1.0 Imports: 5 Imported by: 4

README

Package solsys

import "gitlab.com/fospathi/phyz/celestial/solsys"

Go package solsys calculates a planet's position from its Keplerian orbital elements. Six orbital elements describe a planet's orbit.

Go package keplerian contains the actual orbital elements for each planet.

Documentation

Index

Constants

View Source
const (
	// Mercury is the planet Mercury.
	Mercury = Planet(iota)
	// Venus is the planet Venus.
	Venus
	// Earth is the planet Earth.
	Earth
	// Mars is the planet Mars.
	Mars
	// Jupiter is the planet Jupiter.
	Jupiter
	// Saturn is the planet Saturn.
	Saturn
	// Uranus is the planet Uranus.
	Uranus
	// Neptune is the planet Neptune.
	Neptune
	// Pluto is the planet Pluto.
	Pluto
)
View Source
const (
	// Y250 specifies a 250 year interval from 1800 AD to 2050 AD.
	Y250 = Interval(iota)
	// Y6000 specifies a 6000 year interval from 3000 BC to 3000 AD.
	Y6000
)
View Source
const (
	Y250Start = 1800
	Y250End   = 2050

	Y6000Start = -3000
	Y6000End   = 3000
)

Start and end years of the orbital element validity intervals in the proleptic Gregorian calendar.

View Source
const (
	// EclipticObliquity is the angle, measured in degrees, between the ecliptic
	// and equatorial frames at [epoch J2000.0].
	//
	// [epoch J2000.0]:
	// https://en.wikipedia.org/wiki/Epoch_(astronomy)#Julian_dates_and_J2000
	EclipticObliquity = celestial.Degree(23.43928)
)

Variables

View Source
var ElementsY250 = map[Planet]Elements{
	Mercury: PlanetsElementsY250.Mercury,
	Venus:   PlanetsElementsY250.Venus,
	Earth:   PlanetsElementsY250.Earth,
	Mars:    PlanetsElementsY250.Mars,
	Jupiter: PlanetsElementsY250.Jupiter,
	Saturn:  PlanetsElementsY250.Saturn,
	Uranus:  PlanetsElementsY250.Uranus,
	Neptune: PlanetsElementsY250.Neptune,
	Pluto:   PlanetsElementsY250.Pluto,
}

ElementsY250 is a map of nine sets of orbital elements of the planets of the Solar System and they are valid over the time period 1800 AD to 2050 AD.

View Source
var ElementsY6000 = map[Planet]Elements{
	Mercury: PlanetsElementsY6000.Mercury,
	Venus:   PlanetsElementsY6000.Venus,
	Earth:   PlanetsElementsY6000.Earth,
	Mars:    PlanetsElementsY6000.Mars,
	Jupiter: PlanetsElementsY6000.Jupiter,
	Saturn:  PlanetsElementsY6000.Saturn,
	Uranus:  PlanetsElementsY6000.Uranus,
	Neptune: PlanetsElementsY6000.Neptune,
	Pluto:   PlanetsElementsY6000.Pluto,
}

ElementsY6000 is a map of nine sets of orbital elements of the planets of the Solar System and they are valid over the time period 3000 BC to 3000 AD.

Planets of our Solar System in order of average distance from the Sun.

View Source
var PlanetsElementsY250 = NewPlanetsElements(Y250)

PlanetsElementsY250 is the orbital elements of the planets of the Solar System and they are valid over the time period 1800 AD to 2050 AD.

View Source
var PlanetsElementsY6000 = NewPlanetsElements(Y6000)

PlanetsElementsY6000 is the orbital elements of the planets of the Solar System and they are valid over the time period 3000 BC to 3000 AD.

Functions

func KeplerRoot

func KeplerRoot(M, e float64) float64

KeplerRoot numerically approximates the eccentric anomaly (E), in radians, using Kepler's equation: M = E - e sin(E)

The meanAnomaly (M) should be given in radians in the range -PI..PI inclusive. e is the eccentricity which is a number between 0 and 1.

func PlanetToString

func PlanetToString(planet Planet) string

PlanetToString is the all-lowercase name of the given planet.

Types

type Element

type Element struct {
	// The name of the orbital element.
	Name string
	// The base value of the orbital element.
	Value float64
	// The rate of the orbital element which is used to improve the accuracy of
	// the base value.
	Rate float64
}

Element is an orbital element.

func (Element) OnDate

func (e Element) OnDate(jd celestial.JD) float64

OnDate returns the computed value of the receiver element on the argument date.

type Elements

type Elements struct {
	// The semi-major axis, with respect to the mean equinox and ecliptic of
	// J2000.0, measured in astronomical units (au).
	//
	// Its rate is measured in astronomical units/century (au/cty).
	SemiMajorAxis Element `json:"a"`
	// The eccentricity, with respect to the mean equinox and ecliptic of J2000.0.
	//
	// Its rate is measured in per century (/cty).
	Eccentricity Element `json:"e"`
	// The inclination, with respect to the mean equinox and ecliptic of
	// J2000.0, measured in degrees (deg).
	//
	// Its rate is measured in degrees/century (deg/cty).
	Inclination Element `json:"I"`
	// The mean longitude, with respect to the mean equinox and ecliptic of
	// J2000.0, measured in degrees (deg).
	//
	// Its rate is measured in degrees/century (deg/cty).
	MeanLongitude Element `json:"L"`
	// The longitude of perihelion, with respect to the mean equinox and
	// ecliptic of J2000.0, measured in degrees (deg).
	//
	// Its rate is measured in degrees/century (deg/cty).
	LongitudeOfPerihelion Element `json:"lp"`
	// The longitude of the ascending node, with respect to the mean equinox and
	// ecliptic of J2000.0, measured in degrees (deg).
	//
	// Its rate is measured in degrees/century (deg/cty).
	LongitudeOfTheAscendingNode Element `json:"lan"`
	// Note that these extra constants may not always be present after
	// un-marshalling the raw data.
	Extra Extra
}

Elements is a collection of six orbital elements for a planet plus some extra arbitrary constants.

type Extra

type Extra struct {
	B, C, S, F float64
}

Extra contains some numerical constants which may be used in the calculations of the planet positions.

Note that these constants are only needed and provided for a few planets within the longer time period.

func (Extra) MeanAnomalyExtra

func (e Extra) MeanAnomalyExtra(
	planet Planet,
	period Interval,
	jd celestial.JD,
) float64

MeanAnomalyExtra returns an extra accuracy improving component which shall in a few cases be added to the mean anomaly when calculating a planet's position.

The returned component is non zero only when

  • the time period is 3000 BC to 3000 AD
  • the planet is one of: Jupiter, Saturn, Uranus, Neptune, Pluto

type Interval

type Interval int

Interval specifies one of the possible time periods over which the orbital elements are valid.

type Planet

type Planet int

Planet specifies one of the nine possible planets for which a position may be calculated.

type PlanetPosition

type PlanetPosition struct {
	// The rectangular ecliptic coordinates of the planet.
	Ecliptic maf.Vec
	// The unit tangent vector to the planet's orbit in rectangular ecliptic
	// coordinates.
	EclipticTangent maf.Vec

	// The rectangular equatorial coordinates of the planet in the ICRF/J2000
	// frame.
	Equatorial celestial.EquatorialCoordinates
	// The rectangular heliocentric coordinates of the planet.
	Heliocentric maf.Vec

	ArgumentOfPerihelion        celestial.Radian
	EccentricAnomaly            celestial.Radian
	Eccentricity                float64
	Inclination                 celestial.Radian
	LongitudeOfTheAscendingNode celestial.Radian
	LongitudeOfPerihelion       celestial.Radian
	MeanAnomaly                 celestial.Radian
	MeanLongitude               celestial.Radian
	SemiMajorAxis               float64 // The semi-major axis measured in astronomical units.
}

PlanetPosition and associated Keplerian elements of a planet with respect to the mean equinox and ecliptic of J2000.0.

func NewPlanetPosition

func NewPlanetPosition(
	planet Planet,
	jd celestial.JD,
	period Interval,
) PlanetPosition

NewPlanetPosition returns the approximate position of the argument planet on the argument date which shall be a date within the argument time period.

For the planet Earth it is the position of the Earth-Moon Barycenter which is calculated.

type PlanetsElements

type PlanetsElements struct {
	Mercury Elements
	Venus   Elements
	Earth   Elements
	Mars    Elements
	Jupiter Elements
	Saturn  Elements
	Uranus  Elements
	Neptune Elements
	Pluto   Elements
}

PlanetsElements is a collection of nine sets of orbital elements for the planets of the Solar System.

func NewPlanetsElements

func NewPlanetsElements(period Interval) PlanetsElements

NewPlanetsElements creates and initialises a new planets elements which is valid over the argument time period.

Directories

Path Synopsis
Package horizons interfaces with the JPL Horizons online solar system data and ephemeris computation service (https://ssd.jpl.nasa.gov/horizons/).
Package horizons interfaces with the JPL Horizons online solar system data and ephemeris computation service (https://ssd.jpl.nasa.gov/horizons/).
Package keplerian reproduces orbital elements from
Package keplerian reproduces orbital elements from

Jump to

Keyboard shortcuts

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