RendezvousTrajectory new_trajectory(double StartUT, double transfer_time) { var solver = new LambertSolver(VesselOrbit, TargetOrbit.getRelativePositionAtUT(StartUT + transfer_time), StartUT); var dV = solver.dV4Transfer(transfer_time); return(new RendezvousTrajectory(VSL, dV, StartUT, CFG.Target, MinPeR, transfer_time)); }
public static Vector3d dV4ApV(Orbit old, Vector3d ApV, double UT) { solver_s.Init(old, ApV, UT); var ApR = ApV.magnitude; var minT = solver_s.ParabolicTime; var maxT = solver_s.MinEnergyTime; var dV = solver_s.dV4TransferME(); Orbit orb = null; while (maxT - minT > 0.1) { var T = (maxT + minT) / 2; dV = solver_s.dV4Transfer(T); orb = NewOrbit(old, dV, UT, orb); if (orb.timeToAp > T) { minT = T; } else { maxT = T; } } return(dV); }
void start_orbit() { ToOrbit = null; var dV = Vector3d.zero; var old = VesselOrbit; var StartUT = VSL.Physics.UT + CorrectionOffset; CFG.BR.OffIfOn(BearingMode.Auto); update_trajectory(); if (VesselOrbit.PeR < MinPeR) { StartUT = Math.Min(trajectory.AtTargetUT, VSL.Physics.UT + (VesselOrbit.ApAhead()? VesselOrbit.timeToAp : CorrectionOffset)); if (trajectory.DistanceToTarget < REN.ApproachThreshold * 2 && StartUT.Equals(trajectory.AtTargetUT)) { //approach is close enough to directly match orbits match_orbits(); return; } var transfer_time = Utils.ClampL(TargetOrbit.period * (0.25 - AngleDelta(VesselOrbit, TargetOrbit, StartUT) / 360), 1); var solver = new LambertSolver(VesselOrbit, TargetOrbit.getRelativePositionAtUT(StartUT + transfer_time), StartUT); dV = solver.dV4Transfer(transfer_time); var trj = new RendezvousTrajectory(VSL, dV, StartUT, CFG.Target, MinPeR, transfer_time); if (!dV.IsZero() && !trj.KillerOrbit) { //approach orbit is possible compute_start_orbit(StartUT); return; } //starting from circular orbit and proceeding to TTR fitting... StartUT = VesselOrbit.ApAhead()? VSL.Physics.UT + VesselOrbit.timeToAp : VSL.Physics.UT + CorrectionOffset; dV = dV4C(old, hV(StartUT), StartUT); old = NewOrbit(old, dV, StartUT); } else if (trajectory.RelDistanceToTarget < REN.CorrectionStart || TargetLoaded) { if (trajectory.RelDistanceToTarget > REN.CorrectionStart / 4 && !TargetLoaded) { fine_tune_approach(); } else { match_orbits(); } return; } //compute orbit with desired TTR and activate maneuver autopilot dV += dV4TTR(old, TargetOrbit, REN.MaxTTR, REN.MaxDeltaV, MinPeR, StartUT); if (!dV.IsZero()) { add_node(dV, StartUT); CFG.AP1.On(Autopilot1.Maneuver); } stage = Stage.StartOrbit; }
RendezvousTrajectory new_trajectory(double StartUT, double transfer_time) { var endUT = StartUT + transfer_time; var solver = new LambertSolver(NextOrbit(endUT), NextOrbit(TargetOrbit, endUT).getRelativePositionAtUT(endUT), StartUT); if (solver.NotElliptic(transfer_time)) { transfer_time = solver.ParabolicTime + 1; } var dV = solver.dV4Transfer(transfer_time); return(new RendezvousTrajectory(VSL, dV, StartUT, CFG.Target, MinPeR, transfer_time)); }