Пример #1
0
        public void UpdateTrajectoryModel(double setThrust, double setGravity, double setInitSpeed, double setParachuteReleaseHeight, double setDropHeight,
                                          double setTargetDescentVelocityLarge, double setTargetDescentVelocitySmall, double setTargetDescentVelocitySmallAltitude)
        {
            guidanceTrajectory = new TrajectoryModel(setThrust, setGravity, setInitSpeed, setParachuteReleaseHeight, setDropHeight, setTargetDescentVelocityLarge,
                                                     setTargetDescentVelocitySmall, setTargetDescentVelocitySmallAltitude);
            AxialAlpha   = new AxialThruster(setThrust);
            AxialBeta    = new AxialThruster(setThrust);
            AxialCharlie = new AxialThruster(setThrust);

            altitude = setParachuteReleaseHeight;
            velocity = setInitSpeed;
            PrescribedIgnitionAltitude = setParachuteReleaseHeight;
        }
 /// <summary>
 /// This method will process the testing of application components when the user clicks the "Preflight" button.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TestThruster_Click(object sender, EventArgs e)
 {
     textBox2.Text = "Running pre-flight checks...\r\n";
     textBox2.Refresh();
     textBox2.Text += "Trajectory Model: ";
     textBox2.Text += ThrottleCalculator.SelfTest() == true ? "Success\r\n" : "Failure\r\n";
     textBox2.Text += "Thruster: ";
     textBox2.Text += MainThruster.SelfTest() == true ? "Success\r\n" : "Failure\r\n";
     textBox2.Text += "RollThruster: ";
     textBox2.Text += RollThruster.SelfTest() == true ? "Success\r\n" : "Failure\r\n";
     textBox2.Text += "AxialThruster: ";
     textBox2.Text += AxialThruster.SelfTest() == true ? "Success\r\n" : "Failure\r\n";
     textBox2.Text += "Guidance Control: ";
     textBox2.Text += GuidanceSystem.SelfTest() == true ? "Success\r\n" : "Failure\r\n";
     textBox2.Text += "Pre-flight checks completed.";
 }
Пример #3
0
        // Test cases
        public bool SelfTest()
        {
            AxialThruster testThruster;
            bool          returnVal = true;

            /* For these test cases we test 5 different scenarios looking for expected, manually calculated outputs:
             *  -1 throttle = should fail
             *  0 throttle = should equal 0 thrust
             *  .5 throttle = should equal 12 thrust
             *  1 throttle = should equal 24 thrust
             *  2 throttle = should fail
             */

            // Test creation/constructor
            try
            {
                testThruster = new AxialThruster(24);
            }
            catch
            {
                // Log a failure or output message
                return(false);
            }

            if (returnVal == true)
            {
                returnVal = RunThrottleTest(ref testThruster, -1, -1);
            }
            if (returnVal == true)
            {
                returnVal = RunThrottleTest(ref testThruster, 0, 0);
            }
            if (returnVal == true)
            {
                returnVal = RunThrottleTest(ref testThruster, .5, 12);
            }
            if (returnVal == true)
            {
                returnVal = RunThrottleTest(ref testThruster, 1, 24);
            }
            if (returnVal == true)
            {
                returnVal = RunThrottleTest(ref testThruster, 2, -1);
            }

            return(returnVal);
        }
Пример #4
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);
        }