public class TwoLineElementSet extends Sgp4Elements
The following example shows how to create a TLE from a string and then use it to create an Sgp4Propagator
:
String tleString =
"1 20724U 90068A 02173.73395695 -.00000086 00000-0 00000-0 0 1771\n" +
"2 20724 56.1487 21.0845 0183651 226.6216 131.8780 2.00562381 85500\n";
TwoLineElementSet tle = new TwoLineElementSet(tleString);
Sgp4Propagator propagator = new Sgp4Propagator(tle);
Warning: If the EphemerisType
(get
/ set
) is 4, the TLE field for BStar
(get
/ set
) is actually the
ballistic coefficient (Coefficient of drag times area over mass), the TLE field for MeanMotionDotDot
(get
/ set
)
is actually the AGOM (Area times coefficient of solar radiation pressure over mass), and Sgp4Propagator
will throw an exception if the TLE is input.
Constructor and Description |
---|
TwoLineElementSet()
Initializes a new Two Line Element Set with default parameters.
|
TwoLineElementSet(Sgp4Elements elements,
String name,
String satelliteNumber,
String classification,
String internationalDesignator,
double meanMotionDot,
double meanMotionDotDot,
int elementNumber,
int revolutions)
Initializes a new Two Line Element Set (TLE) from a set of
Sgp4Elements and additional
meta-data contained in the TLE format. |
TwoLineElementSet(String tle)
Initializes a new Two Line Element Set from a string representation of the TLE.
|
TwoLineElementSet(String tle,
boolean verifyChecksums)
Initializes a new Two Line Element Set from a string representation of the TLE
and optionally verifies the checksums.
|
TwoLineElementSet(String tle,
boolean verifyChecksums,
char[] whiteSpaceCharacters)
Initializes a new Two Line Element Set from a string representation of the TLE
and optionally verifies the checksums.
|
TwoLineElementSet(TwoLineElementSet existingInstance)
Initializes a new instance as a copy of an existing instance.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone(CopyContext context)
Clones this object using the specified context.
|
static ArrayList<TwoLineElementSet> |
downloadTles(String satelliteIdentifier,
JulianDate startDate,
JulianDate stopDate)
Downloads TLE data for a given satellite from an AGI server.
|
static ArrayList<TwoLineElementSet> |
downloadTles(String satelliteIdentifier,
JulianDate startDate,
JulianDate stopDate,
Proxy proxy)
Downloads TLE data for a given satellite from an AGI server.
|
int |
getChecksumLine1()
Gets the checksum for line 1.
|
int |
getChecksumLine2()
Gets the checksum for line 2.
|
String |
getClassification()
Gets the classification.
|
int |
getElementNumber()
Gets the element number
|
int |
getEphemerisType()
Gets the ephemeris type.
|
JulianDate |
getEpoch()
Gets the epoch at which these initial conditions are defined.
|
String |
getInternationalDesignator()
Gets the international designator
|
double |
getMeanMotionDot()
Gets the first derivative of mean motion divided by two, in revolutions per day squared.
|
double |
getMeanMotionDotDot()
Gets the second derivative of mean motion divided by six, in revolutions per day cubed.
|
String |
getName()
Gets the spacecraft name
|
double |
getRawEpoch()
Gets the epoch at which these initial conditions are defined,
represented in the standard form:
YYDDD.DDDD . |
int |
getRevolutionNumber()
Gets the revolution number at epoch.
|
String |
getSatelliteNumber()
Gets the satellite number.
|
void |
setChecksumLine1(int value)
Sets the checksum for line 1.
|
void |
setChecksumLine2(int value)
Sets the checksum for line 2.
|
void |
setClassification(String value)
Sets the classification.
|
void |
setElementNumber(int value)
Sets the element number
|
void |
setEphemerisType(int value)
Sets the ephemeris type.
|
void |
setEpoch(JulianDate value)
Sets the epoch at which these initial conditions are defined.
|
void |
setInternationalDesignator(String value)
Sets the international designator
|
void |
setMeanMotionDot(double value)
Sets the first derivative of mean motion divided by two, in revolutions per day squared.
|
void |
setMeanMotionDotDot(double value)
Sets the second derivative of mean motion divided by six, in revolutions per day cubed.
|
void |
setName(String value)
Sets the spacecraft name
|
void |
setRawEpoch(double value)
Sets the epoch at which these initial conditions are defined,
represented in the standard form:
YYDDD.DDDD . |
void |
setRevolutionNumber(int value)
Sets the revolution number at epoch.
|
void |
setSatelliteNumber(String value)
Sets the satellite number.
|
String |
toTleString()
Returns a TLE string representing this
TwoLineElementSet in the standard NORAD format,
described by CelesTrak. |
String |
toTleStringLine0()
Returns line 0 of the TLE represented in standard NORAD format,
described by CelesTrak.
|
String |
toTleStringLine1()
Returns line 1 of the TLE represented in standard NORAD format,
described by CelesTrak.
|
String |
toTleStringLine2()
Returns line 2 of the TLE represented in standard NORAD format,
described by CelesTrak.
|
static boolean |
tryConvertAlpha5SatelliteCatalogNumbersToIntegers(String alphaFiveSatelliteCatalogNumberString,
String[] intSatelliteCatalogNumberString)
Tries to convert an Alpha-5 satellite catalog number into its corresponding integer representation.
|
static boolean |
tryConvertIntegerSatelliteCatalogNumbersToAlpha5(String intSatelliteCatalogNumberString,
String[] alphaFiveSatelliteCatalogNumberString)
Tries to convert an integer satellite catalog number into its corresponding Alpha-5 representation.
|
static boolean |
verifyChecksum(String line)
Verifies the checksum of the specified TLE line.
|
getArgumentOfPerigee, getBStar, getEccentricity, getInclination, getMeanAnomaly, getMeanMotion, getRightAscensionOfAscendingNode, getSwitchingMethod, setArgumentOfPerigee, setBStar, setEccentricity, setInclination, setMeanAnomaly, setMeanMotion, setRightAscensionOfAscendingNode, setSwitchingMethod
public TwoLineElementSet()
public TwoLineElementSet(@Nonnull String tle)
tle
- The TLE represented in the standard format.ArgumentNullException
- Thrown when tle
is null
.ArgumentException
- Thrown when tle
contains less than two lines,
or when tle
has an invalid format for line 1 or line 2.public TwoLineElementSet(@Nonnull String tle, boolean verifyChecksums)
tle
- The TLE represented in the standard format.verifyChecksums
- true
to verify the checksums and throw an exception if they are invalid.
false
to ignore the checksums.ArgumentNullException
- Thrown when tle
is null
.ArgumentException
- Thrown when tle
contains more than two lines,
or when verifyChecksums
is true
and tle
has an invalid checksum for line 1 or line 2,
or when tle
has an invalid format for line 1 or line 2.public TwoLineElementSet(@Nonnull String tle, boolean verifyChecksums, @Nonnull char[] whiteSpaceCharacters)
tle
- The TLE represented in the standard format.verifyChecksums
- true
to verify the checksums and throw an exception if they are invalid.
false
to ignore the checksums.whiteSpaceCharacters
- An array of Unicode characters to be treated as white space within the TLE string.ArgumentNullException
- Thrown when tle
or whiteSpaceCharacters
is null
.ArgumentException
- Thrown when tle
contains less than two lines,
or when verifyChecksums
is true
and tle
has an invalid checksum for line 1 or line 2,
or when tle
has an invalid format for line 1 or line 2.public TwoLineElementSet(@Nonnull Sgp4Elements elements, String name, String satelliteNumber, String classification, String internationalDesignator, double meanMotionDot, double meanMotionDotDot, int elementNumber, int revolutions)
Sgp4Elements
and additional
meta-data contained in the TLE format.elements
- The elements specifying the essential orbit ephemeris data.name
- The name of the satellite to appear on the line just prior to the TLE.satelliteNumber
- The NORAD satellite catalog number, as a string.classification
- The single character classification for the satellite. All civilian
space objects are classified with 'U' for 'Unclassified'.internationalDesignator
- The international catalog number assigned by the
World Data Center-A for Rockets and Satellites.meanMotionDot
- The first time derivative of the mean motion at epoch.meanMotionDotDot
- The second time derivative of the mean motion at epoch.elementNumber
- A number assigned to indicate the number of times this ephemeris has been regenerated.revolutions
- The number of times the spacecraft has passed through its ascending node (since launch).ArgumentNullException
- Thrown when elements
is null
.public TwoLineElementSet(@Nonnull TwoLineElementSet existingInstance)
existingInstance
- The existing instance to copy.ArgumentNullException
- Thrown when existingInstance
is null
.public Object clone(CopyContext context)
This method should be implemented to call a copy constructor on the class of the
object being cloned. The copy constructor should take the CopyContext
as a parameter
in addition to the existing instance to copy. The copy constructor should first call
CopyContext.addObjectMapping(T, T)
to identify the newly constructed instance
as a copy of the existing instance. It should then copy all fields, using
CopyContext.updateReference(T)
to copy any reference fields.
A typical implementation of ICloneWithContext
:
public static class MyClass implements ICloneWithContext {
public MyClass(MyClass existingInstance, CopyContext context) {
context.addObjectMapping(existingInstance, this);
someReference = context.updateReference(existingInstance.someReference);
}
@Override
public final Object clone(CopyContext context) {
return new MyClass(this, context);
}
private Object someReference;
}
In general, all fields that are reference types should be copied with a call to
CopyContext.updateReference(T)
. There are a couple of exceptions:
If one of these exceptions applies, the CopyContext
should be given an opportunity
to update the reference before the reference is copied explicitly. Use
CopyContext.updateReference(T)
to update the reference. If CopyContext.updateReference(T)
returns
the original object, indicating that the context does not have a replacement registered,
then copy the object manually by invoking a Clone method, a copy constructor, or by manually
constructing a new instance and copying the values.
alwaysCopy = context.updateReference(existingInstance.alwaysCopy);
if (existingInstance.alwaysCopy != null && alwaysCopy == existingInstance.alwaysCopy) {
alwaysCopy = (AlwaysCopy) existingInstance.alwaysCopy.clone(context);
}
If you are implementing an evaluator (a class that implements IEvaluator
), the
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
method shares some responsibilities with the
copy context constructor. Code duplication can be avoided by doing the following:
CopyContext.updateReference(T)
. You should still call CopyContext.updateReference(T)
on any references to
non-evaluators.
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
as the last line in the constructor and pass it the
same CopyContext
passed to the constructor.
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
as normal. See the reference documentation for
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
for more information on implementing that method.
public MyClass(MyClass existingInstance, CopyContext context) {
super(existingInstance, context);
someReference = context.updateReference(existingInstance.someReference);
evaluatorReference = existingInstance.evaluatorReference;
updateEvaluatorReferences(context);
}
@Override
public void updateEvaluatorReferences(CopyContext context) {
evaluatorReference = context.updateReference(evaluatorReference);
}
@Override
public Object clone(CopyContext context) {
return new MyClass(this, context);
}
private Object someReference;
private IEvaluator evaluatorReference;
clone
in interface ICloneWithContext
clone
in class Sgp4Elements
context
- The context to use to perform the copy.@Nonnull public JulianDate getEpoch()
TwoLineElementSet
format from the RawEpoch
(get
/ set
). For greater precision, use Sgp4Elements
directly.getEpoch
in class Sgp4Elements
public void setEpoch(@Nonnull JulianDate value)
TwoLineElementSet
format from the RawEpoch
(get
/ set
). For greater precision, use Sgp4Elements
directly.setEpoch
in class Sgp4Elements
public double getRawEpoch()
YYDDD.DDDD
. Note: this will
be represented to only the precision of the TwoLineElementSet
format.
For greater precision, use Sgp4Elements
directly.getRawEpoch
in class Sgp4Elements
public void setRawEpoch(double value)
YYDDD.DDDD
. Note: this will
be represented to only the precision of the TwoLineElementSet
format.
For greater precision, use Sgp4Elements
directly.setRawEpoch
in class Sgp4Elements
@Nonnull public final String toTleStringLine0()
Name
(get
/ set
) padded to 24 characters.
The returned line does not contain any new line or line break characters.PropertyInvalidException
- The properties of this instance cannot be represented as a TLE string because the
Name
(get
/ set
) property is longer than 24 characters.@Nonnull public final String toTleStringLine1()
PropertyInvalidException
- The properties of this instance cannot be represented as a TLE string because a value is outside the
allowed range.@Nonnull public final String toTleStringLine2()
PropertyInvalidException
- The properties of this instance cannot be represented as a TLE string because a value is outside the
allowed range.@Nonnull public final String toTleString()
TwoLineElementSet
in the standard NORAD format,
described by CelesTrak. The
format consists of two or three lines with a new line after each. If the Name
(get
/ set
) is not
null
and not empty, the output contains three lines where the first
is the result of TwoLineElementSet.toTleStringLine0()
, the second is the result of
TwoLineElementSet.toTleStringLine1()
, and the third is the result of TwoLineElementSet.toTleStringLine2()
.
If the name is null
or empty, line zero is omitted. In either case, the lines are separated by
your platform's new line string, usually "\n" or "\r\n".PropertyInvalidException
- The properties of this instance cannot be represented as a TLE string because a value is outside the
allowed range or the Name
(get
/ set
) property is longer than 24 characters.TwoLineElementSet.toTleStringLine0()
,
TwoLineElementSet.toTleStringLine1()
,
TwoLineElementSet.toTleStringLine2()
@Nonnull public static ArrayList<TwoLineElementSet> downloadTles(String satelliteIdentifier, @Nonnull JulianDate startDate, @Nonnull JulianDate stopDate)
satelliteIdentifier
- The NORAD identifier for the satellite whose TLEs are desired.startDate
- The start Julian date for the first TLE to return.stopDate
- the stop Julian date for the last TLE to return.TwoLineElementSet
instances, created from the retrieved TLEs. The first TLE's epoch is just before startDate
and the last TLE's epoch is just after stopDate
.DataUnavailableException
- Thrown when the data cannot be retrieved from the server.@Nonnull public static ArrayList<TwoLineElementSet> downloadTles(String satelliteIdentifier, @Nonnull JulianDate startDate, @Nonnull JulianDate stopDate, Proxy proxy)
satelliteIdentifier
- The NORAD identifier for the satellite whose TLEs are desired.startDate
- The start Julian date for the first TLE to return.stopDate
- the stop Julian date for the last TLE to return.proxy
- Proxy to use when connecting.TwoLineElementSet
instances, created from the retrieved TLEs. The first TLE's epoch is just before startDate
and the last TLE's epoch is just after stopDate
.DataUnavailableException
- Thrown when the data cannot be retrieved from the server.public static boolean tryConvertAlpha5SatelliteCatalogNumbersToIntegers(String alphaFiveSatelliteCatalogNumberString, @Nonnull String[] intSatelliteCatalogNumberString)
alphaFiveSatelliteCatalogNumberString
- The satellite catalog number represented as a 5-digit string where the first digit
is alpha-numerical with only capital letters (other than I or O) and 0-9 accepted,
and the final 4 digits are numerical with only 0-9 accepted for each digit.
Strings with 1 to 4 digits are also accepted if all of the available digits are
numerical with only 0-9 accepted for each digit.
Leading and trailing whitespace will be removed automatically.intSatelliteCatalogNumberString
- On return, a string containing the integer representation of the satellite catalog number that can be up to 6 digits in length.true
if a valid string has been entered; otherwise false
.public static boolean tryConvertIntegerSatelliteCatalogNumbersToAlpha5(String intSatelliteCatalogNumberString, @Nonnull String[] alphaFiveSatelliteCatalogNumberString)
intSatelliteCatalogNumberString
- The satellite catalog number represented as an integer that must be positive and less than 340000
in order to be able to be converted into an Alpha-5 satellite catalog number representation.
Leading and trailing whitespace will be automatically trimmed.alphaFiveSatelliteCatalogNumberString
- On return, a string of up to 5 digits where the first digit
is alpha-numerical containing only capital letters (other than I or O) and 0-9,
and the final 4 digits are numerical containing only 0-9 for each digit.true
if a valid string has been entered; otherwise false
.public final String getName()
public final void setName(String value)
public final double getMeanMotionDot()
public final void setMeanMotionDot(double value)
public final double getMeanMotionDotDot()
Warning: This is equal to the solar radiation pressure model parameter, AGOM [m^2/kg] if the
EphemerisType
(get
/ set
) is equal to 4. AGOM is the area times the coefficient of
solar radiation pressure (gamma) divided by the mass of the spacecraft.
public final void setMeanMotionDotDot(double value)
Warning: This is equal to the solar radiation pressure model parameter, AGOM [m^2/kg] if the
EphemerisType
(get
/ set
) is equal to 4. AGOM is the area times the coefficient of
solar radiation pressure (gamma) divided by the mass of the spacecraft.
public final int getRevolutionNumber()
public final void setRevolutionNumber(int value)
public final String getSatelliteNumber()
public final void setSatelliteNumber(String value)
public final int getEphemerisType()
Sgp4Propagator
.
Ephemeris type 4 is not supported by Sgp4Propagator
, and it will throw an argument exception
if a TwoLineElementSet
has ephemeris type 4.public final void setEphemerisType(int value)
Sgp4Propagator
.
Ephemeris type 4 is not supported by Sgp4Propagator
, and it will throw an argument exception
if a TwoLineElementSet
has ephemeris type 4.public final String getClassification()
public final void setClassification(String value)
public final String getInternationalDesignator()
public final void setInternationalDesignator(String value)
public final int getChecksumLine1()
public final void setChecksumLine1(int value)
public final int getChecksumLine2()
public final void setChecksumLine2(int value)
public final int getElementNumber()
public final void setElementNumber(int value)
public static boolean verifyChecksum(String line)
line
- The TLE line to verify.true
if the checksum matches the rest of the line; otherwise false
.