Esempio n. 1
0
        public void Update()
        {
            // Extra tests for low level tracking station not supporting patched conics and maneuver nodes
            if (FlightGlobals.ActiveVessel.patchedConicSolver == null ||
                FlightGlobals.ActiveVessel.patchedConicSolver.maneuverNodes == null ||
                FlightGlobals.ActiveVessel.patchedConicSolver.maneuverNodes.Count == 0 ||
                !SimulationProcessor.ShowDetails)
            {
                ShowDetails = false;
                return;
            }

            var node   = FlightGlobals.ActiveVessel.patchedConicSolver.maneuverNodes[0];
            var deltaV = node.DeltaV;

            ProgradeDeltaV      = deltaV.z;
            NormalDeltaV        = deltaV.y;
            RadialDeltaV        = deltaV.x;
            TotalDeltaV         = node.GetBurnVector(FlightGlobals.ship_orbit).magnitude;
            PostBurnAp          = node.nextPatch != null ? node.nextPatch.ApA : 0;
            PostBurnEcc         = node.nextPatch != null ? node.nextPatch.eccentricity : 0;
            PostBurnPe          = node.nextPatch != null ? node.nextPatch.PeA : 0;
            PostBurnInclination = node.nextPatch != null ? node.nextPatch.inclination : 0;
            PostBurnPeriod      = node.nextPatch != null ? node.nextPatch.period : 0;

            UniversalTime     = FlightGlobals.ActiveVessel.patchedConicSolver.maneuverNodes[0].UT;
            AngleToPrograde   = OrbitExtensions.GetAngleToPrograde(FlightGlobals.ActiveVessel.patchedConicSolver.maneuverNodes[0].patch, UniversalTime);
            AngleToRetrograde = OrbitExtensions.GetAngleToRetrograde(FlightGlobals.ActiveVessel.patchedConicSolver.maneuverNodes[0].patch, UniversalTime);

            var burnTime     = 0.0;
            var midPointTime = 0.0;

            HasDeltaV       = GetBurnTime(TotalDeltaV, ref burnTime, ref midPointTime);
            AvailableDeltaV = SimulationProcessor.LastStage.totalDeltaV;

            BurnTime     = burnTime;
            HalfBurnTime = midPointTime;

            var tripDeltaV = TotalDeltaV;

            foreach (var n in FlightGlobals.ActiveVessel.patchedConicSolver.maneuverNodes.Skip(1))
            {
                tripDeltaV += n.DeltaV.magnitude;
            }
            TripDeltaV = tripDeltaV;

            ShowDetails = true;
        }
 public override void Draw(Unity.Flight.ISectionModule section)
 {
     this.DrawLine(OrbitExtensions.GetAngleToPrograde(FlightGlobals.ship_orbit).ToAngle(), section.IsHud);
 }