コード例 #1
0
        private void AdjustThrust()
        {
            double calculatedThrottle;

            //check to see lander is at PrescribedIgnitionAltitude
            if (PrescribedIgnitionAltitude >= altitude)
            {
                calculatedThrottle = guidanceTrajectory.calcThrottle(altitude, velocity);
                if (calculatedThrottle > 0)
                {
                    AxialAlpha.SetThrottle(calculatedThrottle);
                    AxialBeta.SetThrottle(calculatedThrottle);
                    AxialCharlie.SetThrottle(calculatedThrottle);
                }
                else
                {
                    AxialAlpha.SetThrottle(0);
                    AxialBeta.SetThrottle(0);
                    AxialCharlie.SetThrottle(0);
                }
            }
        }//end IgniteAxialThrusters()
コード例 #2
0
        private bool RunThrottleTest(ref AxialThruster testThruster, double throttleTest, int resultTest)
        {
            // Try setting throttle
            try
            {
                testThruster.SetThrottle(throttleTest);
            }
            catch
            {
                if (resultTest != -1)
                {
                    // Log a failure or output message
                    return(false);
                }
            }

            // Try getting throttle
            if (resultTest == -1)
            {
                try
                {
                    if (testThruster.GetThrottle() != 0)
                    {
                        Debug.Write(testThruster.GetThrottle());
                        // Log a failure or output message
                        return(false);
                    }
                }
                catch
                {
                    // Log a failure or output message
                    return(false);
                }
            }
            else
            {
                if (testThruster.GetThrottle() != throttleTest)
                {
                    // Log a failure or output message
                    return(false);
                }
            }

            // Try getting thrust
            if (resultTest == -1)
            {
                try
                {
                    if (testThruster.GetThrust() != 0)
                    {
                        // Log a failure or output message
                        return(false);
                    }
                }
                catch
                {
                    // We expect failure possibilities depending on input
                }
            }
            else
            {
                try
                {
                    if (testThruster.GetThrust() != resultTest)
                    {
                        // Log a failure or output message
                        return(false);
                    }
                }
                catch
                {
                    // Log a failure or output message
                    return(false);
                }
            }

            // Get generated thrust
            try
            {
                if (testThruster.GetThrustGenerated() != 24)
                {
                    // Log a failure or output message
                    return(false);
                }
            }
            catch
            {
                return(false);
            }

            // Nothing else made us fail, so it looks good
            return(true);
        }