Exemplo n.º 1
0
        public ActionResult Index(ConcreteCoverViewModel viewModel)
        {
            //if (ModelState.IsValid)
            //{
            ConcreteCoverCalculator concreteCoverCalculator = new ConcreteCoverCalculator()
            {
                RebarDiameter       = viewModel.ConvertStringToRebarDiameter(viewModel.SelectedRebarDiameter),
                ArrangementOfBars   = viewModel.ConvertStringToArrangementOfBars(viewModel.SelectedArrangementOfBars),
                ConcreteClass       = viewModel.ConvertStringToConcreteClass(viewModel.SelectedConcreteClass),
                ExposureClass       = viewModel.ConvertStringToExposureClass(viewModel.SelectedExposureClass),
                BaseStructuralClass = viewModel.ConvertStringToStructuralClass(viewModel.SelectedBaseStructuralClass),
                NominalMaximumAggregateSizeIsGreaterThan32mm = viewModel.NominalMaximumAggregateSizeIsGreaterThan32mm,
                DesignWorkingLifeOf100Years = viewModel.DesignWorkingLifeOf100Years,
                MemberWithSlabGeometry      = viewModel.MemberWithSlabGeometry,
                SpecialQualityControlOfTheConcreteProductionEnsured = viewModel.SpecialQualityControlOfTheConcreteProductionEnsured,
                AdditiveSafetyElement = viewModel.AdditiveSafetyElement / 1000d,
                ReductionOfMinimumCoverForUseOfAdditionalProtection = viewModel.ReductionOfMinimumCoverForUseOfAdditionalProtection / 1000d,
                ReductionOfMinimumCoverForUseOfStainlessSteel       = viewModel.ReductionOfMinimumCoverForUseOfStainlessSteel / 1000d,
                AllowanceInDesignForDeviation = viewModel.AllowanceInDesignForDeviation / 1000d
            };

            concreteCoverCalculator.CalculateNominalConcreteCover();
            //}

            viewModel.StructuralClass = concreteCoverCalculator.StructuralClass.ToString();
            viewModel.MinimumCoverDueToBondRequirement         = concreteCoverCalculator.MinimumCoverDueToBondRequirement * 1000d;
            viewModel.MinimumCoverDueToEnvironmentalConditions = concreteCoverCalculator.MinimumCoverDueToEnvironmentalConditions * 1000d;
            viewModel.MinimumCover = concreteCoverCalculator.MinimumCover * 1000d;
            viewModel.NominalCover = concreteCoverCalculator.NominalCover * 1000d;

            viewModel.IsCalculated = true;

            return(View(viewModel));
        }
Exemplo n.º 2
0
        public void ConcreteCoverController_ViewModel_ReturnProperValues(string testCaseName, string selectedRebarDiameter, string selectedArrangementOfBars, string selectedConcreteClass,
                                                                         string selectedExposureClass, string selectedBaseStructuralClass, bool nominalMaximumAggregateSizeIsGreaterThan32mm, bool designWorkingLifeOf100Years,
                                                                         bool memberWithSlabGeometry, bool specialQualityControlOfTheConcreteProductionEnsured, double additiveSafetyElement, double reductionOfMinimumCoverForUseOfAdditionalProtection,
                                                                         double reductionOfMinimumCoverForUseOfStainlessSteel, double allowanceInDesignForDeviation,
                                                                         string expectedStructuralClass, double expectedMinimumCoverDueToBondRequirement, double expectedMinimumCoverDueToEnvironmentalConditions, double expectedMinimumCover, double expectedNominalCover)
        {
            var viewModel = new ConcreteCoverViewModel();

            viewModel.SelectedRebarDiameter = selectedRebarDiameter;
            //viewModel.SelectedArrangementOfBars = selectedArrangementOfBars;
            viewModel.SelectedConcreteClass       = selectedConcreteClass;
            viewModel.SelectedExposureClass       = selectedExposureClass;
            viewModel.SelectedBaseStructuralClass = selectedBaseStructuralClass;
            viewModel.NominalMaximumAggregateSizeIsGreaterThan32mm = nominalMaximumAggregateSizeIsGreaterThan32mm;
            viewModel.DesignWorkingLifeOf100Years = designWorkingLifeOf100Years;
            viewModel.MemberWithSlabGeometry      = memberWithSlabGeometry;
            viewModel.SpecialQualityControlOfTheConcreteProductionEnsured = specialQualityControlOfTheConcreteProductionEnsured;
            viewModel.AdditiveSafetyElement = additiveSafetyElement;
            viewModel.ReductionOfMinimumCoverForUseOfAdditionalProtection = reductionOfMinimumCoverForUseOfAdditionalProtection;
            viewModel.ReductionOfMinimumCoverForUseOfStainlessSteel       = reductionOfMinimumCoverForUseOfStainlessSteel;
            viewModel.AllowanceInDesignForDeviation = allowanceInDesignForDeviation;

            ConcreteCoverCalculator concreteCoverCalculator = new ConcreteCoverCalculator()
            {
                RebarDiameter = viewModel.ConvertStringToRebarDiameter(viewModel.SelectedRebarDiameter),
                //ArrangementOfBars = viewModel.ConvertStringToArrangementOfBars(viewModel.SelectedArrangementOfBars),
                ConcreteClass       = viewModel.ConvertStringToConcreteClass(viewModel.SelectedConcreteClass),
                ExposureClass       = viewModel.ConvertStringToExposureClass(viewModel.SelectedExposureClass),
                BaseStructuralClass = viewModel.ConvertStringToStructuralClass(viewModel.SelectedBaseStructuralClass),
                NominalMaximumAggregateSizeIsGreaterThan32mm = viewModel.NominalMaximumAggregateSizeIsGreaterThan32mm,
                DesignWorkingLifeOf100Years = viewModel.DesignWorkingLifeOf100Years,
                MemberWithSlabGeometry      = viewModel.MemberWithSlabGeometry,
                SpecialQualityControlOfTheConcreteProductionEnsured = viewModel.SpecialQualityControlOfTheConcreteProductionEnsured,
                AdditiveSafetyElement = viewModel.AdditiveSafetyElement / 1000d,
                ReductionOfMinimumCoverForUseOfAdditionalProtection = viewModel.ReductionOfMinimumCoverForUseOfAdditionalProtection / 1000d,
                ReductionOfMinimumCoverForUseOfStainlessSteel       = viewModel.ReductionOfMinimumCoverForUseOfStainlessSteel / 1000d,
                AllowanceInDesignForDeviation = viewModel.AllowanceInDesignForDeviation / 1000d
            };

            concreteCoverCalculator.CalculateNominalConcreteCover();

            viewModel.StructuralClass = concreteCoverCalculator.StructuralClass.ToString();
            viewModel.MinimumCoverDueToBondRequirement         = concreteCoverCalculator.MinimumCoverDueToBondRequirement * 1000d;
            viewModel.MinimumCoverDueToEnvironmentalConditions = concreteCoverCalculator.MinimumCoverDueToEnvironmentalConditions * 1000d;
            viewModel.MinimumCover = concreteCoverCalculator.MinimumCover * 1000d;
            viewModel.NominalCover = concreteCoverCalculator.NominalCover * 1000d;

            Assert.AreEqual(expectedStructuralClass, viewModel.StructuralClass);
            Assert.AreEqual(expectedMinimumCoverDueToBondRequirement, viewModel.MinimumCoverDueToBondRequirement);
            Assert.AreEqual(expectedMinimumCoverDueToEnvironmentalConditions, viewModel.MinimumCoverDueToEnvironmentalConditions);
            Assert.AreEqual(expectedMinimumCover, viewModel.MinimumCover);
            Assert.AreEqual(expectedNominalCover, viewModel.NominalCover);
        }
Exemplo n.º 3
0
        public ConcreteCoverOutputString GetResults(ConcreteCoverInput input)
        {
            var calculator = new ConcreteCoverCalculator();
            var output     = calculator.CalculateNominalConcreteCover(input);

            return(new ConcreteCoverOutputString {
                StructuralClass = "S" + output.StructuralClass.ToString(),
                MinimumCover = (output.MinimumCover * 1000).ToString() + " mm",
                MinimumCoverDueToBondRequirement = (output.MinimumCoverDueToBondRequirement * 1000).ToString() + " mm",
                MinimumCoverDueToEnvironmentalConditions = (output.MinimumCoverDueToEnvironmentalConditions * 1000).ToString() + " mm",
                NominalCover = (output.NominalCover * 1000).ToString() + " mm"
            });
        }
Exemplo n.º 4
0
        public void CalculateNominalConcreteCoverTests_(int testCaseNumber, double minimumCover, double allowanceInDesignForDeviation, double expectedCover)
        {
            ConcreteCoverInput inputData = new ConcreteCoverInput()
            {
                ArrangementOfBars             = "Separated",
                RebarDiameter                 = "16 mm",
                ExposureClass                 = "XC3",
                ConcreteClass                 = "C30/37",
                BaseStructuralClass           = "S4",
                AllowanceInDesignForDeviation = allowanceInDesignForDeviation
            };

            ConcreteCoverCalculator coverCalculator = new ConcreteCoverCalculator();

            coverCalculator.outputData.MinimumCover = minimumCover;

            var result = coverCalculator.CalculateNominalConcreteCover(inputData);

            Assert.AreEqual(expectedCover, result.NominalCover);
        }