Kerbal Space Program  1.12.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
TransferMath Class Reference

Public Member Functions

delegate double BisectFunc (double x)
 Delegate for Bisect method. More...
 

Static Public Member Functions

static double AlignmentTime (TransferDataSimple transferDataSimple, Orbit sourceOrbit, Orbit targetOrbit, double startUT, double offsetDegrees=0d)
 The time in seconds from current UT that the phase angles of the Source and Target body orbits will align. More...
 
static double Bisect (BisectFunc f, double minimum, double maximum, double acceptableRange=0.01, int maxIter=15)
 Bisection method More...
 
static double CalcCircularizeDV (TransferDataSimple transferDataSimple, double newApoapsis)
 Calculate Circularization dV. More...
 
static double CalcSameSOITransferDV (TransferDataSimple transferDataSimple, Orbit startOrbit)
 Calculate same SOI Hohmann Transfer dV. More...
 
static bool CalculateCorrection (TransferDataSimple transferDataSimple, double startUT, SafeAbortBackgroundWorker bw)
 Calculate a Correction Burn if orbits are inclined. Will only process if relative inclination is > 1. More...
 
static void CalculateStartEndXferTimes (CelestialBody sourceBody, CelestialBody targetBody, double offsetDegrees, out double startTime, out double endTime)
 Calculates the start and end transfer window times where the phase angle between source and target planet is within offset degrees occuring after the current time. More...
 
static void CalculateStartEndXferTimes (CelestialBody sourceBody, CelestialBody targetBody, double afterUT, double offsetDegrees, out double startTime, out double endTime)
 Calculates the start and end transfer window times where the phase angle between source and target planet is within offset degrees. More...
 
static void CalculateStartEndXferTimes (TransferDataSimple transferDataSimple, CelestialBody sourceBody, CelestialBody targetBody, double offsetDegrees, out string startTime, out string endTime)
 Calculates the start and end transfer window times where the phase angle between source and target planet is within offset degrees. More...
 
static bool ChangingPeriapsis (Orbit start, Orbit target, double UT)
 Are we changing Periapsis to reach target. More...
 
static Vector3d DeltaVToInterceptAtTime (Orbit o, double initialUT, Orbit target, double DT, out Vector3d secondDV)
 
static double FinalizeLambert (TransferDataSimple transferDataSimple, double startUT, Orbit startOrbit, Orbit targetOrbit)
 Finalize Lambert solution. More...
 
static bool FindIntercept (TransferDataSimple transferDataSimple, Orbit startOrbit, CelestialBody targetBody, Vector3d dV, double UT, bool sameSOIXfer, double initialClosestApproach, SafeAbortBackgroundWorker bw, out Vector3d adjustedDV)
 
static double HohmannTimeOfFlight (Orbit origin, Orbit destination)
 Calculates the time of flight for a Hohmann transfer between origin and destination , assuming the orbits are circular and coplanar. More...
 
static void LambertSolver (double mu, Vector3d r1, Vector3d v1, Vector3d r2, Vector3d v2, double tof, int nrev, out Vector3d vi, out Vector3d vf)
 Solve Lambert's Problem. More...
 
static double Root (BisectFunc f, double a, double b, double tol, int maxIterations=50, int sign=0)
 Brent's Algorithm for root finding. More...
 
static double SafeOrbitRadius (CelestialBody body)
 Returns the minimum safe orbit radius for body. More...
 
static bool SameSOITransfer (TransferDataSimple transferDataSimple)
 Is the transfer within the Same SOI? More...
 
static void SuperiorLambert (double mu, Vector3d r1, Vector3d v1, Vector3d r2, Vector3d v2, double tof, out Vector3d vi, out Vector3d vf)
 Superior Lambert solution using Gim J. Der derivative on Sun's solution. More...
 
static double TransferDV (TransferDataSimple transferDataSimple, double startUT)
 Calculate the Transfer dV for a simple Transfer. Target and Source body must have already been set. More...
 

Static Public Attributes

static double safetyEnvelope = 1.025
 The safety Envelope for setting minimum Radius on Transfer Orbits. More...
 

Member Function Documentation

static double TransferMath.AlignmentTime ( TransferDataSimple  transferDataSimple,
Orbit  sourceOrbit,
Orbit  targetOrbit,
double  startUT,
double  offsetDegrees = 0d 
)
inlinestatic

The time in seconds from current UT that the phase angles of the Source and Target body orbits will align.

Parameters
transferDataSimpleThis is the instance of the TransferDataSimple.
sourceOrbitThis is the source Orbit
targetOrbitThis is the target Orbit
startUTThis is the starting UT to use for the calcs.
offsetDegreesThis optional offset in degrees will be applied to the optimal angle calculation
Returns
static double TransferMath.Bisect ( BisectFunc  f,
double  minimum,
double  maximum,
double  acceptableRange = 0.01,
int  maxIter = 15 
)
inlinestatic

Bisection method

Parameters
fsingle dimension function
minimumminimum value
maximummaximum value
acceptableRangeacceptable range
maxItermaximum iterations
Returns
delegate double TransferMath.BisectFunc ( double  x)

Delegate for Bisect method.

Parameters
x
Returns
static double TransferMath.CalcCircularizeDV ( TransferDataSimple  transferDataSimple,
double  newApoapsis 
)
inlinestatic

Calculate Circularization dV.

Parameters
transferDataSimple
newApoapsisShould include radius of CB
Returns
static double TransferMath.CalcSameSOITransferDV ( TransferDataSimple  transferDataSimple,
Orbit  startOrbit 
)
inlinestatic

Calculate same SOI Hohmann Transfer dV.

Parameters
transferDataSimpleTransferDataSimple data instance
startOrbitThe starting orbit
Returns
The dV to complete the transfer and circularization dV if required.
static bool TransferMath.CalculateCorrection ( TransferDataSimple  transferDataSimple,
double  startUT,
SafeAbortBackgroundWorker  bw 
)
inlinestatic

Calculate a Correction Burn if orbits are inclined. Will only process if relative inclination is > 1.

Parameters
bwBackgroundWorker
transferDataSimplethe TransferDataSimple data instance
startUTThe start UT to start from
Returns
True if a correction was made. False If a correct was not made.
static void TransferMath.CalculateStartEndXferTimes ( CelestialBody  sourceBody,
CelestialBody  targetBody,
double  offsetDegrees,
out double  startTime,
out double  endTime 
)
inlinestatic

Calculates the start and end transfer window times where the phase angle between source and target planet is within offset degrees occuring after the current time.

Parameters
sourceBodyStarting Celestial Body for the Transfer
targetBodyEnding Celestial Body for the Transfer
offsetDegreesHow many degrees either side of the optimum phase angle do we want to use for start and finish
startTimeThe start time in UT of the TRansfer Window
endTimeThe end time in UT of the TRansfer Window
static void TransferMath.CalculateStartEndXferTimes ( CelestialBody  sourceBody,
CelestialBody  targetBody,
double  afterUT,
double  offsetDegrees,
out double  startTime,
out double  endTime 
)
inlinestatic

Calculates the start and end transfer window times where the phase angle between source and target planet is within offset degrees.

Parameters
sourceBodyStarting Celestial Body for the Transfer
targetBodyEnding Celestial Body for the Transfer
afterUTThe time after which the middled of the transfer should be
offsetDegreesHow many degrees either side of the optimum phase angle do we want to use for start and finish
startTimeThe time in seconds from afterUT to the start of the window
endTimeThe time in seconds from afterUT to the end of the window
static void TransferMath.CalculateStartEndXferTimes ( TransferDataSimple  transferDataSimple,
CelestialBody  sourceBody,
CelestialBody  targetBody,
double  offsetDegrees,
out string  startTime,
out string  endTime 
)
inlinestatic

Calculates the start and end transfer window times where the phase angle between source and target planet is within offset degrees.

Parameters
transferDataSimpleTransfer data object related to this transfer
sourceBodyStarting Celestial Body for the Transfer
targetBodyEnding Celestial Body for the Transfer
offsetDegreesHow many degrees either side of the optimum phase angle do we want to use for start and finish
startTimeThe time in seconds from current UT to the start of the window
endTimeThe time in seconds from current UT to the end of the window
static bool TransferMath.ChangingPeriapsis ( Orbit  start,
Orbit  target,
double  UT 
)
inlinestatic

Are we changing Periapsis to reach target.

Parameters
startStart orbit
targetTarget orbit
UTThe burn start UT
Returns
static Vector3d TransferMath.DeltaVToInterceptAtTime ( Orbit  o,
double  initialUT,
Orbit  target,
double  DT,
out Vector3d  secondDV 
)
inlinestatic
static double TransferMath.FinalizeLambert ( TransferDataSimple  transferDataSimple,
double  startUT,
Orbit  startOrbit,
Orbit  targetOrbit 
)
inlinestatic

Finalize Lambert solution.

Parameters
transferDataSimple
startUT
startOrbit
targetOrbit
Returns
static bool TransferMath.FindIntercept ( TransferDataSimple  transferDataSimple,
Orbit  startOrbit,
CelestialBody  targetBody,
Vector3d  dV,
double  UT,
bool  sameSOIXfer,
double  initialClosestApproach,
SafeAbortBackgroundWorker  bw,
out Vector3d  adjustedDV 
)
inlinestatic
static double TransferMath.HohmannTimeOfFlight ( Orbit  origin,
Orbit  destination 
)
inlinestatic

Calculates the time of flight for a Hohmann transfer between origin and destination , assuming the orbits are circular and coplanar.

Returns
The time of flight.
Parameters
originThe origin orbit.
destinationThe destination orbit.
static void TransferMath.LambertSolver ( double  mu,
Vector3d  r1,
Vector3d  v1,
Vector3d  r2,
Vector3d  v2,
double  tof,
int  nrev,
out Vector3d  vi,
out Vector3d  vf 
)
inlinestatic

Solve Lambert's Problem.

Parameters
muGravity
r1Position at Origin
v1Velocity at Origin
r2Position at Destination
v2Velocity at Destination
tofTime of Flight (secs)
nrevNumber of Orbits
viVelocity Vector at Ejection
vfVelocity Vector at Arrival
static double TransferMath.Root ( BisectFunc  f,
double  a,
double  b,
double  tol,
int  maxIterations = 50,
int  sign = 0 
)
inlinestatic

Brent's Algorithm for root finding.

Parameters
fsingle dimension function to find the root of
afirst value
bsecond value
toltolerance
maxIterationsmaximum iterations
sign
Returns
static double TransferMath.SafeOrbitRadius ( CelestialBody  body)
inlinestatic

Returns the minimum safe orbit radius for body.

Parameters
body
Returns
static bool TransferMath.SameSOITransfer ( TransferDataSimple  transferDataSimple)
inlinestatic

Is the transfer within the Same SOI?

Parameters
transferDataSimple
Returns
static void TransferMath.SuperiorLambert ( double  mu,
Vector3d  r1,
Vector3d  v1,
Vector3d  r2,
Vector3d  v2,
double  tof,
out Vector3d  vi,
out Vector3d  vf 
)
inlinestatic

Superior Lambert solution using Gim J. Der derivative on Sun's solution.

Parameters
mu
r1
v1
r2
v2
tof
vi
vf
static double TransferMath.TransferDV ( TransferDataSimple  transferDataSimple,
double  startUT 
)
inlinestatic

Calculate the Transfer dV for a simple Transfer. Target and Source body must have already been set.

Parameters
transferDataSimpleThis is the instance of the TransferDataSimple.
vesselThis is the Vessel - should be the ActiveVessel.
startUTThis is the starting UT to use for the calcs.
Returns

Member Data Documentation

double TransferMath.safetyEnvelope = 1.025
static

The safety Envelope for setting minimum Radius on Transfer Orbits.


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