예제 #1
0
        private static void AssertConfiguration(HeightStructuresCalculationConfiguration configuration)
        {
            Assert.AreEqual(67.1, configuration.StructureNormalOrientation);
            Assert.AreEqual("kunstwerk1", configuration.StructureId);
            Assert.AreEqual("Locatie1", configuration.HydraulicBoundaryLocationName);
            Assert.AreEqual("profiel1", configuration.ForeshoreProfileId);
            Assert.AreEqual(1e-6, configuration.FailureProbabilityStructureWithErosion);

            Assert.AreEqual(4.3, configuration.LevelCrestStructure.Mean);
            Assert.AreEqual(0.1, configuration.LevelCrestStructure.StandardDeviation);

            Assert.AreEqual(0.2, configuration.AllowedLevelIncreaseStorage.Mean);
            Assert.AreEqual(0.01, configuration.AllowedLevelIncreaseStorage.StandardDeviation);
            Assert.AreEqual(2, configuration.CriticalOvertoppingDischarge.Mean);
            Assert.AreEqual(0.1, configuration.CriticalOvertoppingDischarge.VariationCoefficient);
            Assert.AreEqual(15.2, configuration.FlowWidthAtBottomProtection.Mean);
            Assert.AreEqual(0.1, configuration.FlowWidthAtBottomProtection.StandardDeviation);
            Assert.AreEqual(1.10, configuration.ModelFactorSuperCriticalFlow.Mean);
            Assert.AreEqual(0.12, configuration.ModelFactorSuperCriticalFlow.StandardDeviation);
            Assert.AreEqual(15000, configuration.StorageStructureArea.Mean);
            Assert.AreEqual(0.01, configuration.StorageStructureArea.VariationCoefficient);
            Assert.AreEqual(6.0, configuration.StormDuration.Mean);
            Assert.AreEqual(0.12, configuration.StormDuration.VariationCoefficient);
            Assert.AreEqual(15.2, configuration.WidthFlowApertures.Mean);
            Assert.AreEqual(0.1, configuration.WidthFlowApertures.StandardDeviation);

            Assert.AreEqual(ConfigurationBreakWaterType.Dam, configuration.WaveReduction.BreakWaterType);
            Assert.AreEqual(1.234, configuration.WaveReduction.BreakWaterHeight);
            Assert.IsTrue(configuration.WaveReduction.UseBreakWater);
            Assert.IsTrue(configuration.WaveReduction.UseForeshoreProfile);
            Assert.IsTrue(configuration.ShouldIllustrationPointsBeCalculated);
            Assert.IsTrue(configuration.Scenario.IsRelevant);
            Assert.AreEqual(8.8, configuration.Scenario.Contribution);
        }
예제 #2
0
        public void SetStochasts_WithAllStochastsSet_SetExpectedValuesOnInput()
        {
            // Setup
            var configuration = new HeightStructuresCalculationConfiguration("name")
            {
                StructureId         = "some structure",
                LevelCrestStructure = new StochastConfiguration
                {
                    Mean = 1.1,
                    StandardDeviation = 1.5
                },
                AllowedLevelIncreaseStorage = new StochastConfiguration
                {
                    Mean = 2.1,
                    StandardDeviation = 2.5
                },
                FlowWidthAtBottomProtection = new StochastConfiguration
                {
                    Mean = 3.1,
                    StandardDeviation = 3.5
                },
                WidthFlowApertures = new StochastConfiguration
                {
                    Mean = 4.1,
                    StandardDeviation = 4.5
                },
                ModelFactorSuperCriticalFlow = new StochastConfiguration
                {
                    Mean = 5.1
                },
                CriticalOvertoppingDischarge = new StochastConfiguration
                {
                    Mean = 6.1,
                    VariationCoefficient = 0.6
                },
                StorageStructureArea = new StochastConfiguration
                {
                    Mean = 7.1,
                    VariationCoefficient = 0.7
                },
                StormDuration = new StochastConfiguration
                {
                    Mean = 8.1
                }
            };

            var calculation = new StructuresCalculation <HeightStructuresInput>();

            var assigner = new HeightStructuresCalculationStochastAssigner(
                configuration,
                calculation);

            // Call
            bool valid = assigner.Assign();

            // Assert
            Assert.IsTrue(valid);
        }
예제 #3
0
        public void Constructor_WithName_ExpectedValues()
        {
            // Call
            var configuration = new HeightStructuresCalculationConfiguration("some name");

            // Assert
            Assert.IsInstanceOf <StructuresCalculationConfiguration>(configuration);
            Assert.AreEqual("some name", configuration.Name);
            Assert.IsNull(configuration.ModelFactorSuperCriticalFlow);
            Assert.IsNull(configuration.LevelCrestStructure);
        }
예제 #4
0
        public void Constructor_WithParameters_ReturnsNewInstance()
        {
            // Setup
            var configuration = new HeightStructuresCalculationConfiguration("name");
            var calculation   = new StructuresCalculation <HeightStructuresInput>();

            // Call
            var assigner = new HeightStructuresCalculationStochastAssigner(
                configuration,
                calculation);

            // Assert
            Assert.IsInstanceOf <StructuresCalculationStochastAssigner <
                                     HeightStructuresCalculationConfiguration,
                                     HeightStructuresInput, HeightStructure> >(assigner);
        }
예제 #5
0
        public void Assign_WithoutStructureParametersDefinedForStructureDependentStochast_ReturnsFalse(
            Action <HeightStructuresCalculationConfiguration> modify)
        {
            // Setup
            var configuration = new HeightStructuresCalculationConfiguration("name");

            modify(configuration);

            var calculation = new StructuresCalculation <HeightStructuresInput>();

            var assigner = new HeightStructuresCalculationStochastAssigner(
                configuration,
                calculation);

            // Call
            bool valid = assigner.Assign();

            // Assert
            Assert.IsFalse(valid);
        }
예제 #6
0
        public void Assign_WithSpreadForModelFactorSuperCriticalFlow_LogsErrorReturnFalse(bool withStandardDeviation)
        {
            // Setup
            var configuration = new HeightStructuresCalculationConfiguration("name")
            {
                StructureId = "some structure",
                ModelFactorSuperCriticalFlow = new StochastConfiguration
                {
                    Mean = 8.1
                }
            };

            if (withStandardDeviation)
            {
                configuration.ModelFactorSuperCriticalFlow.StandardDeviation = 0.8;
            }
            else
            {
                configuration.ModelFactorSuperCriticalFlow.VariationCoefficient = 0.8;
            }

            var calculation = new StructuresCalculation <HeightStructuresInput>();

            var assigner = new HeightStructuresCalculationStochastAssigner(
                configuration,
                calculation);

            var valid = true;

            // Call
            Action test = () => valid = assigner.Assign();

            // Assert
            const string expectedMessage = "Er kan geen spreiding voor stochast 'modelfactoroverloopdebiet' opgegeven worden. Berekening 'name' is overgeslagen.";

            TestHelper.AssertLogMessageWithLevelIsGenerated(test, Tuple.Create(expectedMessage, LogLevelConstant.Error));
            Assert.IsFalse(valid);
        }