public void AnchorageLengthTest_CalculateWithMultipleCoefficients_Success()
        {
            var reinforcementPosition = AnchoringHelper.CreateReinforcementPosition();
            var reinforcement         = new Reinforcement(10, 500, false);

            var barFormCoefficient                 = new BarFormCoefficient(reinforcementPosition, reinforcement);
            var coverCoefficient                   = new CoverCoefficient(reinforcementPosition, reinforcement);
            var transversePressureCoefficient      = new TransversePressureCoefficient(reinforcementPosition, 5);
            var transverseReinforcementCoefficient =
                new TransverseReinforcementCoefficient(reinforcementPosition, reinforcement, TypeEnum.Beam, 5);
            var weldedTransverseBarCoefficient = new WeldedTransverseBarCoefficient();

            var coefficients = new List <ICoefficient>();

            coefficients.Add(barFormCoefficient);
            coefficients.Add(coverCoefficient);
            coefficients.Add(transversePressureCoefficient);
            coefficients.Add(transverseReinforcementCoefficient);
            coefficients.Add(weldedTransverseBarCoefficient);

            var anchorageLength = new AnchorageLength(reinforcement, reinforcementPosition,
                                                      ConcreteClassEnum.C25_30, TypeEnum.Beam, BondConditionEnum.Good, coefficients);

            anchorageLength.CalculateAnchorageLengths();

            Assert.AreEqual(375.738, Math.Round(anchorageLength.BasicRequiredAnchorageLength, 3),
                            "BasicRequiredAnchorageLength not calculated properly.");
            Assert.AreEqual(112.721, Math.Round(anchorageLength.MinimumAnchorageLength, 3),
                            "MinimumAnchorageLength not calculated properly.");
            Assert.AreEqual(128.878, Math.Round(anchorageLength.DesignAnchorageLength, 3),
                            "DesignAnchorageLength not calculated properly.");
        }
        public void AnchorageLengthTest_CalculateWithoutCoefficients_Success()
        {
            var reinforcementPosition = AnchoringHelper.CreateReinforcementPosition();
            var reinforcement         = new Reinforcement(12, 500, false);

            var anchorageLength = new AnchorageLength(reinforcement, reinforcementPosition,
                                                      ConcreteClassEnum.C25_30, TypeEnum.Beam, BondConditionEnum.Good, null);

            anchorageLength.CalculateAnchorageLengths();

            Assert.AreEqual(450.886, Math.Round(anchorageLength.BasicRequiredAnchorageLength, 3),
                            "BasicRequiredAnchorageLength not calculated properly.");
            Assert.AreEqual(135.266, Math.Round(anchorageLength.MinimumAnchorageLength, 3),
                            "MinimumAnchorageLength not calculated properly.");
            Assert.AreEqual(450.886, Math.Round(anchorageLength.DesignAnchorageLength, 3),
                            "DesignAnchorageLength not calculated properly.");
        }
        public void AnchorageLengthTest_CalculateWithSameoefficients_Exception()
        {
            var reinforcementPosition = AnchoringHelper.CreateReinforcementPosition();
            var reinforcement         = new Reinforcement(10, 500, false);

            var barFormCoefficient = new BarFormCoefficient(reinforcementPosition, reinforcement);

            var coefficients = new List <ICoefficient>();

            coefficients.Add(barFormCoefficient);
            coefficients.Add(barFormCoefficient);

            var anchorageLength = new AnchorageLength(reinforcement, reinforcementPosition,
                                                      ConcreteClassEnum.C25_30, TypeEnum.Beam, BondConditionEnum.Good, coefficients);

            Assert.Throws <ArgumentException>(() => anchorageLength.CalculateAnchorageLengths(),
                                              "More than one coefficient type should throw ArgumentException.");
        }
        public void AnchorageLengthTest_CalculateWithCoverCoefficient_Success()
        {
            var reinforcementPosition = AnchoringHelper.CreateReinforcementPosition();
            var reinforcement         = new Reinforcement(10, 500, false);

            var coverCoefficient = new CoverCoefficient(reinforcementPosition, reinforcement);

            var coefficients = new List <ICoefficient>();

            coefficients.Add(coverCoefficient);

            var anchorageLength = new AnchorageLength(reinforcement, reinforcementPosition,
                                                      ConcreteClassEnum.C25_30, TypeEnum.Beam, BondConditionEnum.Good, coefficients);

            anchorageLength.CalculateAnchorageLengths();

            Assert.AreEqual(375.738, Math.Round(anchorageLength.BasicRequiredAnchorageLength, 3),
                            "BasicRequiredAnchorageLength not calculated properly.");
            Assert.AreEqual(112.721, Math.Round(anchorageLength.MinimumAnchorageLength, 3),
                            "MinimumAnchorageLength not calculated properly.");
            Assert.AreEqual(347.558, Math.Round(anchorageLength.DesignAnchorageLength, 3),
                            "DesignAnchorageLength not calculated properly.");
        }
Exemple #5
0
        public ActionResult CalculateReinforcementAnchoring(ReinforcementAnchoringViewModel reinforcementAnchoringViewModel)
        {
            var antyCoefficients = new List <Type>();

            if (!reinforcementAnchoringViewModel.CalculateBarFormCoefficient)
            {
                antyCoefficients.Add(typeof(BarFormCoefficient));
            }
            if (!reinforcementAnchoringViewModel.CalculateCoverCoefficient)
            {
                antyCoefficients.Add(typeof(CoverCoefficient));
            }
            if (!reinforcementAnchoringViewModel.CalculateTransverseReinforcementCoefficient)
            {
                antyCoefficients.Add(typeof(TransverseReinforcementCoefficient));
            }
            if (!reinforcementAnchoringViewModel.CalculateWeldedTransverseBarCoefficient)
            {
                antyCoefficients.Add(typeof(WeldedTransverseBarCoefficient));
            }
            if (!reinforcementAnchoringViewModel.CalculateTransversePressureCoefficient)
            {
                antyCoefficients.Add(typeof(TransversePressureCoefficient));
            }

            var reinforcement = new Reinforcement(
                reinforcementAnchoringViewModel.ReinforcementDiameter ?? 0,
                reinforcementAnchoringViewModel.PressInReinforcement ?? 0,
                reinforcementAnchoringViewModel.IsPairOfBars);
            var reinforcementPosition = new ReinforcementPosition(
                reinforcementAnchoringViewModel.AreAnchoragesInTension,
                reinforcementAnchoringViewModel.AnchorageType,
                reinforcementAnchoringViewModel.SideCoverDistance ?? 0,
                reinforcementAnchoringViewModel.BottomCoverDistance ?? 0,
                reinforcementAnchoringViewModel.DistanceBetweenBars ?? 0,
                reinforcementAnchoringViewModel.TransverseBarPosition);

            ICoefficient barFormCoefficient = new BarFormCoefficient(
                reinforcementPosition, reinforcement);
            ICoefficient coverCoefficient = new CoverCoefficient(
                reinforcementPosition, reinforcement);
            ICoefficient transverseReinforcementCoefficient = new TransverseReinforcementCoefficient(
                reinforcementPosition, reinforcement, reinforcementAnchoringViewModel.Type,
                reinforcementAnchoringViewModel.TransverseReinforcementArea ?? 0);
            ICoefficient weldedTransverseBarCoefficient = new WeldedTransverseBarCoefficient();
            ICoefficient transversePressureCoefficient  = new TransversePressureCoefficient(
                reinforcementPosition, reinforcementAnchoringViewModel.TransversePressure ?? 0);

            var coefficients = new List <ICoefficient>();

            coefficients.Add(barFormCoefficient);
            coefficients.Add(coverCoefficient);
            coefficients.Add(transverseReinforcementCoefficient);
            coefficients.Add(weldedTransverseBarCoefficient);
            coefficients.Add(transversePressureCoefficient);

            var filteredCoefficients =
                coefficients.Where(c => !antyCoefficients.Contains(c.GetType())).ToList();

            var anchorageLength = new AnchorageLength(reinforcement, reinforcementPosition,
                                                      reinforcementAnchoringViewModel.ConcreteClassName,
                                                      reinforcementAnchoringViewModel.Type,
                                                      reinforcementAnchoringViewModel.BondCondition,
                                                      filteredCoefficients, reinforcementAnchoringViewModel.TransversePressure ?? 0);

            anchorageLength.CalculateAnchorageLengths();

            reinforcementAnchoringViewModel.AnchoringAnchorageLength = new AnchoringAnchorageLength()
            {
                AnchorageLength = anchorageLength
            };

            reinforcementAnchoringViewModel.ShowResults = true;

            return(View("ReinforcementAnchoring", reinforcementAnchoringViewModel));
        }