IncrementalUpdate() публичный Метод

public IncrementalUpdate ( ) : void
Результат void
Пример #1
0
        private static IEnumerable <bool> ComputeTrajectoryIncrement()
        {
            // create or update aerodynamic model
            if (aerodynamicModel_ == null || !aerodynamicModel_.IsValidFor(Trajectories.AttachedVessel.mainBody))
            {
                aerodynamicModel_ = AerodynamicModelFactory.GetModel(Trajectories.AttachedVessel.mainBody);
            }
            else
            {
                aerodynamicModel_.IncrementalUpdate();
            }

            // create new VesselState from vessel, or null if it's on the ground
            VesselState state = Trajectories.AttachedVessel.LandedOrSplashed ? null : new VesselState(Trajectories.AttachedVessel);

            // iterate over patches until MaxPatchCount is reached
            for (int patchIdx = 0; patchIdx < Settings.MaxPatchCount; ++patchIdx)
            {
                // stop if we don't have a vessel state
                if (state == null)
                {
                    break;
                }

                // If we spent more time in this calculation than allowed, pause until the next frame
                if (incrementTime_.ElapsedMilliseconds > MaxIncrementTime)
                {
                    yield return(false);
                }

                // if we have a patched conics solver, check for maneuver nodes
                if (null != Trajectories.AttachedVessel.patchedConicSolver)
                {
                    // search through maneuver nodes of the vessel
                    List <ManeuverNode> maneuverNodes = Trajectories.AttachedVessel.patchedConicSolver.maneuverNodes;
                    foreach (ManeuverNode node in maneuverNodes)
                    {
                        // if the maneuver node time corresponds to the end time of the last patch
                        if (node.UT == state.Time)
                        {
                            // add the velocity change of the burn to the velocity of the last patch
                            state.Velocity += node.GetBurnVector(CreateOrbitFromState(state));
                            break;
                        }
                    }

                    // Add one patch, then pause execution after every patch
                    foreach (bool result in AddPatch(state))
                    {
                        yield return(false);
                    }
                }

                state = AddPatch_outState;
            }
        }
Пример #2
0
        private IEnumerable <bool> computeTrajectoryIncrement(Vessel vessel, DescentProfile profile)
        {
            if (aerodynamicModel_ == null || !aerodynamicModel_.isValidFor(vessel, vessel.mainBody))
            {
                aerodynamicModel_ = AerodynamicModelFactory.GetModel(vessel, vessel.mainBody);
            }
            else
            {
                aerodynamicModel_.IncrementalUpdate();
            }

            var state = vessel.LandedOrSplashed ? null : new VesselState(vessel);

            for (int patchIdx = 0; patchIdx < Settings.fetch.MaxPatchCount; ++patchIdx)
            {
                if (state == null)
                {
                    break;
                }

                if (incrementTime_.ElapsedMilliseconds > MaxIncrementTime)
                {
                    yield return(false);
                }

                if (null != vessel_.patchedConicSolver)
                {
                    var maneuverNodes = vessel_.patchedConicSolver.maneuverNodes;
                    foreach (var node in maneuverNodes)
                    {
                        if (node.UT == state.time)
                        {
                            state.velocity += node.GetBurnVector(createOrbitFromState(state));
                            break;
                        }
                    }
                    foreach (var result in AddPatch(state, profile))
                    {
                        yield return(false);
                    }
                }

                state = AddPatch_outState;
            }
        }