예제 #1
0
        public void Test04_VerifyUnitTest1()
        {
            //NOTE - SCI P406 contains errors hence there are discrepancies between the "real" and calculated results, approximately 2% difference.

            BearingDesignDisplacements b = new BearingDesignDisplacements()
            {
                Tmax               = 41,
                Tmin               = -20,
                T0                 = 16.67,
                Alpha              = 15 * 0.001 * 0.001,
                DesignLife         = 100,
                Altitude           = 136,
                L                  = 68000,
                SurfacingThickness = 155,
                K1                 = 0.666,
                K2                 = 0.07,
                K3                 = 0.410,
                K4                 = -0.17,
                yQ                 = 1.33
            };

            List <double> actual = new List <double>()
            {
                b.Vxexp_ULS, b.Vxcon_ULS, b.Vxexp_SLS, b.Vxcon_SLS,
            };
            List <double> expected = new List <double>()
            {
                56.5811, 69.0918, 47.9512, 57.3577
            };

            for (int i = 0; i < actual.Count; i++)
            {
                double actual1              = actual[i];
                double expected1            = expected[i];
                double percentageDifference = 100 * Math.Abs((actual1 - expected1) / actual1);
                Assert.Equal(actual1, expected1, 3);
            }
        }
예제 #2
0
        private BearingDesignDisplacements ReturnBearingDesignDisplacemetnsObjectFromTBInputs()
        {
            //Convert input boxes to variables and use try-catch to check for illegal input.
            double Tmax               = TextboxHelpers.TextBoxToDouble(txtTmax);
            double Tmin               = TextboxHelpers.TextBoxToDouble(txtTmin);
            double T0                 = TextboxHelpers.TextBoxToDouble(txtT0);
            double Altitude           = TextboxHelpers.TextBoxToDouble(txtAltitude);
            double SurfacingThickness = TextboxHelpers.TextBoxToDouble(txtSurfacing);
            double L = TextboxHelpers.TextBoxToDouble(txtLength) * 1000;  //Convert to mm

            double DesignLife = TextboxHelpers.TextBoxToDouble(txtDesignLife);
            double alpha      = TextboxHelpers.TextBoxToDouble(txtAlpha);
            double k1         = TextboxHelpers.TextBoxToDouble(txtK1);
            double k2         = TextboxHelpers.TextBoxToDouble(txtK2);
            double k3         = TextboxHelpers.TextBoxToDouble(txtK3);
            double k4         = TextboxHelpers.TextBoxToDouble(txtK4);
            double yQ         = TextboxHelpers.TextBoxToDouble(txtGammaQ);

            //Instantiate instance of BearingDesignDisplacements object
            BearingDesignDisplacements b = new BearingDesignDisplacements()
            {
                Alpha              = alpha,
                DesignLife         = DesignLife,
                Altitude           = Altitude,
                L                  = L,
                SurfacingThickness = SurfacingThickness,
                T0                 = T0,
                Tmax               = Tmax,
                Tmin               = Tmin,
                K1                 = k1,
                K2                 = k2,
                K3                 = k3,
                K4                 = k4,
                yQ                 = yQ
            };

            return(b);
        }
예제 #3
0
        public void Test03_VerifySCIP406WorkedExample1()
        {
            //NOTE - SCI P406 contains errors hence there are discrepancies between the "real" and calculated results, approximately 2% difference.

            BearingDesignDisplacements b = new BearingDesignDisplacements()
            {
                Tmax               = 33,
                Tmin               = -17,
                T0                 = 10,
                Alpha              = 12 * 0.001 * 0.001,
                DesignLife         = 120,
                Altitude           = 100,
                L                  = 56000,
                SurfacingThickness = 100,
                K1                 = 0.781,
                K2                 = 0.056,
                K3                 = 0.393,
                K4                 = -0.156,
                yQ                 = 1.45
            };

            List <double> actual = new List <double>()
            {
                b.Vxexp_ULS, b.Vxcon_ULS, b.Vxexp_SLS, b.Vxcon_SLS,
            };
            List <double> expected = new List <double>()
            {
                49, 45, 40, 37
            };

            for (int i = 0; i < actual.Count; i++)
            {
                double actual1              = actual[i];
                double expected1            = expected[i];
                double percentageDifference = 100 * Math.Abs((actual1 - expected1) / actual1);
                Assert.InRange(percentageDifference, 0, 2);
            }
        }
예제 #4
0
        private void BtnCalculate_Click_1(object sender, EventArgs e)
        {
            try
            {
                //Instantiate new instances of BDD class.

                BearingDesignDisplacements b = ReturnBearingDesignDisplacemetnsObjectFromTBInputs();

                //Validate incoming data using FluentValidation

                var validator = new BearingDesignDisplacementsValidator();
                var results   = validator.Validate(b);

                if (results.IsValid == false)
                {
                    //Clear results textboxes
                    ClearCalculationTextboxes();

                    //Report error messages.

                    foreach (var failure in results.Errors)
                    {
                        MessageBox.Show(failure.ErrorMessage);
                    }
                }
                else
                {
                    //Write values to calculation window

                    WriteDoubleToTextBox(ref txtTmax2, b.Tmax, 1);
                    WriteDoubleToTextBox(ref txtTmin2, b.Tmin, 1);
                    WriteDoubleToTextBox(ref txtAltitude2, b.Altitude, 1);
                    WriteDoubleToTextBox(ref txtTmaxA, b.Tmax_A, 1);
                    WriteDoubleToTextBox(ref txtTminA, b.Tmin_A, 1);

                    WriteDoubleToTextBox(ref txtDesignLife2, b.DesignLife, 1);
                    WriteDoubleToTextBox(ref txtP, b.p, 4);
                    WriteDoubleToTextBox(ref txtTmaxADL, b.Tmax_A_120, 1);
                    WriteDoubleToTextBox(ref txtTminADL, b.Tmin_A_120, 1);

                    //2. Calculate effective bridge temperatures
                    WriteDoubleToTextBox(ref txtType2, b.Type, 0);
                    WriteDoubleToTextBox(ref txtTemax, b.Temax, 1);
                    WriteDoubleToTextBox(ref txtTemin, b.Temin, 1);
                    WriteDoubleToTextBox(ref txtSurfacing2, b.SurfacingThickness, 0);
                    WriteDoubleToTextBox(ref txtTemaxadj, b.Temax_Adj, 1);
                    WriteDoubleToTextBox(ref txtTeminadj, b.Temin_Adj, 1);

                    //3. Calculate characteristic values of temperature change.
                    WriteDoubleToTextBox(ref txtT02, b.T0, 1);
                    WriteDoubleToTextBox(ref txtTNexp, b.TN_exp, 1);
                    WriteDoubleToTextBox(ref txtTNcon, b.TN_con, 1);

                    //4. Calculate design movement ranges
                    WriteDoubleToTextBox(ref txtTemaxadj2, b.Temax_Adj, 1);
                    WriteDoubleToTextBox(ref txtTeminadj2, b.Temin_Adj, 1);
                    WriteDoubleToTextBox(ref txtT02, b.T0, 1);
                    WriteDoubleToTextBox(ref txtTNexp, b.TN_exp, 1);
                    WriteDoubleToTextBox(ref txtTNcon, b.TN_con, 1);

                    WriteDoubleToTextBox(ref txtLength2, b.L, 0);
                    WriteDoubleToTextBox(ref txtAlpha2, b.Alpha, 6);
                    WriteDoubleToTextBox(ref txtVxexp, b.Vxexp, 1);
                    WriteDoubleToTextBox(ref txtVxcon, b.Vxcon, 1);
                    WriteDoubleToTextBox(ref txtTol, b.tol, 1);

                    WriteDoubleToTextBox(ref txtVxexpULS, b.Vxexp_ULS, 1);
                    WriteDoubleToTextBox(ref txtVxconULS, b.Vxcon_ULS, 1);
                    WriteDoubleToTextBox(ref txtVxexpSLS, b.Vxexp_SLS, 1);
                    WriteDoubleToTextBox(ref txtVxconSLS, b.Vxcon_SLS, 1);

                    //5. Summary Table

                    txtULS.Text = $"+{Math.Ceiling(b.Vxexp_ULS)}/-{Math.Ceiling(b.Vxcon_ULS)}";
                    txtSLS.Text = $"+{Math.Ceiling(b.Vxexp_SLS)}/-{Math.Ceiling(b.Vxcon_SLS)}";

                    WriteDoubleToTextBox(ref txtULSRange, b.Range_ULS, 1);
                    WriteDoubleToTextBox(ref txtSLSRange, b.Range_SLS, 1);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Invalid input. Please ensure all textboxes contain numbers/decimals and not characters.");
                ClearCalculationTextboxes();
            }
        }