Gravity Engine 12.0
Unity Asset for Gravity
Loading...
Searching...
No Matches
LambertUniversal Class Reference

Calculate the universal Lambert transfer. This algorithm allows the transfer to be elliptic or hyperbolic as necessary to meet the designated transfer time. The transfer code can be used to determine the minimum energy transfer between the desired points/orbits - in this case the time of transfer is not specified. Additional API calls can be used to request a specific transfer time. It is frquently useful to obtain the most efficient transfer time and then use this as a baseline from which to investigate the dV cost of faster transfers. More...

Inheritance diagram for LambertUniversal:
OrbitTransfer

Public Member Functions

 LambertUniversal (OrbitData _fromOrbit, OrbitData _toOrbit, bool shortPath)
 Setup for Lambert Universal construction. Calculation is done via ComputeXfer and may be done more than once for different transit times.
 
 LambertUniversal (OrbitData _fromOrbit, Vector3d r_from, Vector3d r_to, bool shortPath)
 Create a Lambert transfer from a given NBody orbit to a position in physics space.
 
void SetPlanetRadius (double radius)
 Set the radius of the planet around which transfer is to be computed. This is used when calls to ComputeTransferWithPhasing(). In the event that the requested trajectory hits the planet.
 
void ClearPlanetRadius ()
 
int ComputeXferWithPhasing (bool reverse, bool df, int nrev, double dtsec, bool rendezvous)
 Determine the Lambert transfer in the specified time to the position that target object will be at in that time. If the rendezvous flag is set, then a maneuver will be generated to match the target. If not set then the ship will intercept the target.
 
Vector3d GetR2 ()
 Get the final position of the Lambert trajectory. Typically used when doing a xfer with phasing.
 
int ComputeXfer (bool reverse, bool df, int nrev, double dtsec)
 Compute the transfer for the setup via the constructor for the specified transit time dtsec.
 
void ComputeMinDvSquared (Vector3d r1_, Vector3d v1_, Vector3d r2_, Vector3d v2_)
 Compute the path from (r1,v1) to (r2,v2) that minimizes the value of (dV)^2. This uses the algorithm developed in "A closed-form solution to the minimum (delta Vtotal)^2 Lambert's Problem" by M. Avendano and D. Mortari, Celest.Mech.Dyn.Ast(2010) 106:25-37.
 
void ComputeIntercept ()
 
Vector3d GetTransferPositionDouble ()
 
Vector3 GetTransferVelocity ()
 
Vector3d GetTransferVelocityDouble ()
 
Vector3 GetFinalVelocity ()
 
Vector3d GetFinalVelocityDouble ()
 
double GetTMin ()
 Time of flight for minimum energy trajectory.
 
string Log ()
 
- Public Member Functions inherited from OrbitTransfer
 OrbitTransfer (OrbitData fromOrbit, OrbitData toOrbit)
 
 OrbitTransfer (OrbitData fromOrbit)
 
float GetDeltaV ()
 
float GetDeltaT ()
 
List< ManeuverGetManeuvers ()
 
override string ToString ()
 

Public Attributes

double[] v1
 
double[] v2
 

Static Public Attributes

const int G_NOT_CONVERGED = 1
 Error codes.
 
const int Y_NEGATIVE = 2
 
const int XFER_180 = 3
 
const int IMPACT = 4
 

Additional Inherited Members

- Protected Attributes inherited from OrbitTransfer
string name = "base (error)"
 Name of the transfer (will be over-riden by implementing class.
 
List< Maneuvermaneuvers
 Maneuvers required to execute the transfer.
 
float deltaV
 total cost of the manuevers
 
float deltaT
 
OrbitData fromOrbit
 
OrbitData toOrbit
 
NBody centerBody
 

Detailed Description

Calculate the universal Lambert transfer. This algorithm allows the transfer to be elliptic or hyperbolic as necessary to meet the designated transfer time. The transfer code can be used to determine the minimum energy transfer between the desired points/orbits - in this case the time of transfer is not specified. Additional API calls can be used to request a specific transfer time. It is frquently useful to obtain the most efficient transfer time and then use this as a baseline from which to investigate the dV cost of faster transfers.

Usage of this class differs from the the other orbit transfer classes. The constructor is used to provide initial details in one of several ways: fromOrbit/toOrbit: use this when the goal is to attain the toOrbit or rendezvous with an object in the toOrbit

fromOrbit/R-to: use when want to get to the specific point R_to

Both constructors will invoke ComputeMinTime() and determine the minimum transfer time. This is then retrieved by: GetTMin()

Calls to ComputeXfer() are then used to calculate the maneuvers required for the specified transfer time.

This algorithm does not provide an answer when the transfer is 180 degrees (Battin is a good alternative in this case).

This algorithm is more general than the Lambert minimum energy solution since it provides the path for a specified time of flight and also the final velocity.

Code adapted from Vallado, Fundamentals of Astrophysics and Applications https://celestrak.com/software/vallado-sw.asp

Constructor & Destructor Documentation

◆ LambertUniversal() [1/2]

LambertUniversal.LambertUniversal ( OrbitData  _fromOrbit,
OrbitData  _toOrbit,
bool  shortPath 
)

Setup for Lambert Universal construction. Calculation is done via ComputeXfer and may be done more than once for different transit times.

Initial conditions are passed in when created.

The transfer assumes there is an active NBody at the fromOrbit to be maneuvered to the orbit specified by the toOrbit. If the toOrbit has a NBody, then it is used as the target point, otherwise the phase in the targetOrbit is used to designate a target point. One of the from/to orbit data elements must have a centerNBody.

The time for a minimum energy transfer is computed using the provided value of shortPath.

Parameters
fromOrbit
toOrbit
shortPathTake shortest path along the ellipse (if xfer is an ellipse)

◆ LambertUniversal() [2/2]

LambertUniversal.LambertUniversal ( OrbitData  _fromOrbit,
Vector3d  r_from,
Vector3d  r_to,
bool  shortPath 
)

Create a Lambert transfer from a given NBody orbit to a position in physics space.

The constructor will compute the minimum energy transfer to the point taking the shortest path setting into account. The time for the transfer can then be retreived.

Parameters
_fromOrbit
r_from
r_to
shortPath

Member Function Documentation

◆ ComputeMinDvSquared()

void LambertUniversal.ComputeMinDvSquared ( Vector3d  r1_,
Vector3d  v1_,
Vector3d  r2_,
Vector3d  v2_ 
)

Compute the path from (r1,v1) to (r2,v2) that minimizes the value of (dV)^2. This uses the algorithm developed in "A closed-form solution to the minimum (delta Vtotal)^2 Lambert's Problem" by M. Avendano and D. Mortari, Celest.Mech.Dyn.Ast(2010) 106:25-37.

Note that this solution is not the minimum dV solution but will never exceed it by more than 17% (and for non-aligned r1, r2 is typically very close to the dV solution).

Currently need to exclude transfer requests where angle between r1 and r2 is in range (165, 195) either get excessive dV or no real roots in the solution.

Parameters
r1GE position of the start (not relative to center)
v1GE velocity of the start (not relative to center)
r2GE position of the start (not relative to center)
v2GE velocity of the start (not relative to center)

◆ ComputeXfer()

int LambertUniversal.ComputeXfer ( bool  reverse,
bool  df,
int  nrev,
double  dtsec 
)

Compute the transfer for the setup via the constructor for the specified transit time dtsec.

This determines the maneuvers requires and places them in the parent classes maneuver list. They can be retrieved by GetManeuvers().

There will be 1 or 2 maneuvers depending on the configuration. If a target orbit is specified and the mode is not intercept then a second maneuver will be used to attain the desired target orbit.

The algorithm used comes from Vallado 4th edition Algorithm 58 (p492).

Note: Unlike the min. energy calculation it does NOT require r1 < r2.

Parameters
reversedirection of motion, true for reverse path (long way around)
dfControls intial guess, undocumented in Vallado. False seems to work.
nrevNumber of revolutions until transfer (typically 0)
dtsecRequired time of flight
Returns
error ()

error = 1; // g not converged error = 2; // y negative error = 3; // impossible 180 transfer
error = 4; // trajectory impacts planet radius specified with SetPlanetRadius()

◆ ComputeXferWithPhasing()

int LambertUniversal.ComputeXferWithPhasing ( bool  reverse,
bool  df,
int  nrev,
double  dtsec,
bool  rendezvous 
)

Determine the Lambert transfer in the specified time to the position that target object will be at in that time. If the rendezvous flag is set, then a maneuver will be generated to match the target. If not set then the ship will intercept the target.

This method requires that the class was created with the constructor that defines toOrbit.

In some cases the transfer trajectory may intersect the central body. This can optionally be checked if the API SetPlanetRadius() is called prior to the use of this method. If the requested trajectory hits the planet an error code 4.

Parameters
reverse
df
nrev
dtsectime for the transfer
rendezvous
Returns
error ()

error = 1; // g not converged error = 2; // y negative error = 3; // impossible 180 transfer
error = 4; // trajectory impacts planet radius specified with SetPlanetRadius()

◆ GetR2()

Vector3d LambertUniversal.GetR2 ( )

Get the final position of the Lambert trajectory. Typically used when doing a xfer with phasing.

Returns

◆ SetPlanetRadius()

void LambertUniversal.SetPlanetRadius ( double  radius)

Set the radius of the planet around which transfer is to be computed. This is used when calls to ComputeTransferWithPhasing(). In the event that the requested trajectory hits the planet.

Parameters
radius

The documentation for this class was generated from the following file: