示例#1
0
 /// <summary>
 /// Creates a new instance of <see cref="TestClosingStructure"/>.
 /// </summary>
 /// <param name="name">The name of the structure.</param>
 /// <param name="id">The id of the structure</param>
 /// <param name="location">The location of the structure.</param>
 /// <param name="type">The inflow model type of the structure.</param>
 /// <exception cref="ArgumentNullException">Thrown when <paramref name="location"/>
 /// is <c>null</c>.</exception>
 /// <exception cref="ArgumentException">Thrown when <paramref name="name"/>
 /// or <paramref name="id"/> is <c>null</c>, empty or consists of only whitespaces.</exception>
 private TestClosingStructure(string name, string id, Point2D location, ClosingStructureInflowModelType type)
     : base(new ConstructionProperties
 {
     Name                 = name,
     Id                   = id,
     Location             = location,
     StorageStructureArea =
     {
         Mean                   = (RoundedDouble)20000,
         CoefficientOfVariation = (RoundedDouble)0.1
     },
     AllowedLevelIncreaseStorage =
     {
         Mean              = (RoundedDouble)0.2,
         StandardDeviation = (RoundedDouble)0.1
     },
     StructureNormalOrientation = (RoundedDouble)10.0,
     WidthFlowApertures         =
     {
         Mean              = (RoundedDouble)21,
         StandardDeviation = (RoundedDouble)0.05
     },
     LevelCrestStructureNotClosing =
     {
         Mean              = (RoundedDouble)4.95,
         StandardDeviation = (RoundedDouble)0.05
     },
     InsideWaterLevel =
     {
         Mean              = (RoundedDouble)0.5,
         StandardDeviation = (RoundedDouble)0.1
     },
     ThresholdHeightOpenWeir =
     {
         Mean              = (RoundedDouble)4.95,
         StandardDeviation = (RoundedDouble)0.1
     },
     AreaFlowApertures =
     {
         Mean              = (RoundedDouble)31.5,
         StandardDeviation = (RoundedDouble)0.01
     },
     CriticalOvertoppingDischarge =
     {
         Mean                   = (RoundedDouble)1.0,
         CoefficientOfVariation = (RoundedDouble)0.15
     },
     FlowWidthAtBottomProtection =
     {
         Mean              = (RoundedDouble)25.0,
         StandardDeviation = (RoundedDouble)0.05
     },
     ProbabilityOpenStructureBeforeFlooding = 1.0,
     FailureProbabilityOpenStructure        = 0.1,
     IdenticalApertures           = 4,
     FailureProbabilityReparation = 1.0,
     InflowModelType = type
 })
 {
 }
示例#2
0
        private void SetDefaultSchematizationProperties()
        {
            FailureProbabilityOpenStructure        = 0;
            FailureProbabilityReparation           = 0;
            ProbabilityOpenStructureBeforeFlooding = 1.0;

            ThresholdHeightOpenWeir = new NormalDistribution
            {
                Mean = RoundedDouble.NaN,
                StandardDeviation = RoundedDouble.NaN
            };

            AreaFlowApertures = new LogNormalDistribution
            {
                Mean = RoundedDouble.NaN,
                StandardDeviation = RoundedDouble.NaN
            };

            LevelCrestStructureNotClosing = new NormalDistribution
            {
                Mean = RoundedDouble.NaN,
                StandardDeviation = RoundedDouble.NaN
            };

            InsideWaterLevel = new NormalDistribution
            {
                Mean = RoundedDouble.NaN,
                StandardDeviation = RoundedDouble.NaN
            };

            IdenticalApertures = 1;
            InflowModelType    = 0;
        }
示例#3
0
 public override void SynchronizeStructureInput()
 {
     if (Structure != null)
     {
         StructureNormalOrientation    = Structure.StructureNormalOrientation;
         LevelCrestStructureNotClosing = Structure.LevelCrestStructureNotClosing;
         FlowWidthAtBottomProtection   = Structure.FlowWidthAtBottomProtection;
         CriticalOvertoppingDischarge  = Structure.CriticalOvertoppingDischarge;
         WidthFlowApertures            = Structure.WidthFlowApertures;
         StorageStructureArea          = Structure.StorageStructureArea;
         AllowedLevelIncreaseStorage   = Structure.AllowedLevelIncreaseStorage;
         InflowModelType   = Structure.InflowModelType;
         AreaFlowApertures = Structure.AreaFlowApertures;
         FailureProbabilityOpenStructure = Structure.FailureProbabilityOpenStructure;
         FailureProbabilityReparation    = Structure.FailureProbabilityReparation;
         IdenticalApertures = Structure.IdenticalApertures;
         InsideWaterLevel   = Structure.InsideWaterLevel;
         ProbabilityOpenStructureBeforeFlooding = Structure.ProbabilityOpenStructureBeforeFlooding;
         ThresholdHeightOpenWeir = Structure.ThresholdHeightOpenWeir;
     }
     else
     {
         SetDefaultSchematizationProperties();
     }
 }
        public void ConvertTo_VariousCases_ReturnExpectedText(ConfigurationClosingStructureInflowModelType value,
                                                              ClosingStructureInflowModelType expectedResult)
        {
            // Setup
            var converter = new ConfigurationClosingStructureInflowModelTypeConverter();

            // Call
            object result = converter.ConvertTo(value, typeof(ClosingStructureInflowModelType));

            // Assert
            Assert.AreEqual(expectedResult, result);
        }
示例#5
0
        public void InflowModelType_AlwaysOnChange_CorrectColumnStates(ClosingStructureInflowModelType inflowModelType, bool isEnabled)
        {
            // Setup
            var calculation = new StructuresCalculationScenario <ClosingStructuresInput>();

            // Call
            var row = new ClosingStructuresCalculationRow(calculation, new ObservablePropertyChangeHandler(calculation, new ClosingStructuresInput()))
            {
                InflowModelType = inflowModelType
            };

            // Assert
            IDictionary <int, DataGridViewColumnStateDefinition> columnStateDefinitions = row.ColumnStateDefinitions;

            DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[meanInsideWaterLevelColumnIndex], isEnabled);
        }
示例#6
0
        /// <summary>
        /// Copies the property values of the <paramref name="fromStructure"/> to the
        /// <see cref="ClosingStructure"/>.
        /// </summary>
        /// <param name="fromStructure">The <see cref="ClosingStructure"/> to get the property
        /// values from.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="fromStructure"/>
        /// is <c>null</c>.</exception>
        public void CopyProperties(ClosingStructure fromStructure)
        {
            base.CopyProperties(fromStructure);

            AllowedLevelIncreaseStorage.Mean = fromStructure.AllowedLevelIncreaseStorage.Mean;
            AllowedLevelIncreaseStorage.StandardDeviation = fromStructure.AllowedLevelIncreaseStorage.StandardDeviation;

            AreaFlowApertures.Mean = fromStructure.AreaFlowApertures.Mean;
            AreaFlowApertures.StandardDeviation = fromStructure.AreaFlowApertures.StandardDeviation;

            CriticalOvertoppingDischarge.Mean = fromStructure.CriticalOvertoppingDischarge.Mean;
            CriticalOvertoppingDischarge.CoefficientOfVariation = fromStructure.CriticalOvertoppingDischarge.CoefficientOfVariation;

            FailureProbabilityOpenStructure = fromStructure.FailureProbabilityOpenStructure;

            FailureProbabilityReparation = fromStructure.FailureProbabilityReparation;

            IdenticalApertures = fromStructure.IdenticalApertures;

            FlowWidthAtBottomProtection.Mean = fromStructure.FlowWidthAtBottomProtection.Mean;
            FlowWidthAtBottomProtection.StandardDeviation = fromStructure.FlowWidthAtBottomProtection.StandardDeviation;

            InflowModelType = fromStructure.InflowModelType;

            InsideWaterLevel.Mean = fromStructure.InsideWaterLevel.Mean;
            InsideWaterLevel.StandardDeviation = fromStructure.InsideWaterLevel.StandardDeviation;

            LevelCrestStructureNotClosing.Mean = fromStructure.LevelCrestStructureNotClosing.Mean;
            LevelCrestStructureNotClosing.StandardDeviation = fromStructure.LevelCrestStructureNotClosing.StandardDeviation;

            ProbabilityOpenStructureBeforeFlooding = fromStructure.ProbabilityOpenStructureBeforeFlooding;

            StorageStructureArea.Mean = fromStructure.StorageStructureArea.Mean;
            StorageStructureArea.CoefficientOfVariation = fromStructure.StorageStructureArea.CoefficientOfVariation;

            ThresholdHeightOpenWeir.Mean = fromStructure.ThresholdHeightOpenWeir.Mean;
            ThresholdHeightOpenWeir.StandardDeviation = fromStructure.ThresholdHeightOpenWeir.StandardDeviation;

            WidthFlowApertures.Mean = fromStructure.WidthFlowApertures.Mean;
            WidthFlowApertures.StandardDeviation = fromStructure.WidthFlowApertures.StandardDeviation;
        }
示例#7
0
        public IEnumerable <ValidationRule> GetValidationRules(ClosingStructuresInput input)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            ClosingStructureInflowModelType inflowModelType = input.InflowModelType;

            if (!Enum.IsDefined(typeof(ClosingStructureInflowModelType), inflowModelType))
            {
                throw new InvalidEnumArgumentException(nameof(input),
                                                       (int)inflowModelType,
                                                       typeof(ClosingStructureInflowModelType));
            }

            IEnumerable <ValidationRule> validationRules;

            switch (inflowModelType)
            {
            case ClosingStructureInflowModelType.VerticalWall:
                validationRules = GetVerticalWallValidationRules(input);
                break;

            case ClosingStructureInflowModelType.LowSill:
                validationRules = GetLowSillValidationRules(input);
                break;

            case ClosingStructureInflowModelType.FloodedCulvert:
                validationRules = GetFloodedCulvertValidationRules(input);
                break;

            default:
                throw new NotSupportedException();
            }

            return(validationRules);
        }
        protected override StructuresClosureCalculationInput CreateInput(ClosingStructuresInput structureInput,
                                                                         GeneralClosingStructuresInput generalInput,
                                                                         string hydraulicBoundaryDatabaseFilePath,
                                                                         bool usePreprocessor)
        {
            ClosingStructureInflowModelType closingStructureInflowModelType = structureInput.InflowModelType;

            if (!Enum.IsDefined(typeof(ClosingStructureInflowModelType), closingStructureInflowModelType))
            {
                throw new InvalidEnumArgumentException(nameof(structureInput),
                                                       (int)closingStructureInflowModelType,
                                                       typeof(ClosingStructureInflowModelType));
            }

            StructuresClosureCalculationInput input;

            switch (closingStructureInflowModelType)
            {
            case ClosingStructureInflowModelType.VerticalWall:
                input = CreateClosureVerticalWallCalculationInput(structureInput, generalInput);
                break;

            case ClosingStructureInflowModelType.LowSill:
                input = CreateLowSillCalculationInput(structureInput, generalInput);
                break;

            case ClosingStructureInflowModelType.FloodedCulvert:
                input = CreateFloodedCulvertCalculationInput(structureInput, generalInput);
                break;

            default:
                throw new NotSupportedException();
            }

            HydraRingSettingsDatabaseHelper.AssignSettingsFromDatabase(input, hydraulicBoundaryDatabaseFilePath, usePreprocessor);
            return(input);
        }
示例#9
0
        public void InflowModelType_AlwaysOnChange_NotifyObserverAndCalculationPropertyChanged(ClosingStructureInflowModelType inflowModelType, ClosingStructureInflowModelType newInflowModelType)
        {
            // Setup
            var calculation = new StructuresCalculationScenario <ClosingStructuresInput>
            {
                InputParameters =
                {
                    InflowModelType = inflowModelType
                }
            };

            // Call & Assert
            SetPropertyAndVerifyNotificationsAndOutputForCalculation(row => row.InflowModelType = newInflowModelType, calculation);
        }
示例#10
0
 /// <summary>
 /// Creates a new instance of <see cref="TestClosingStructure"/>.
 /// </summary>
 /// <param name="type">The inflow model type of the structure.</param>
 public TestClosingStructure(ClosingStructureInflowModelType type)
     : this("name", "id", new Point2D(12345.56789, 9876.54321), type)
 {
 }
        public void ConvertFrom_ClosingStructureInflowModelType_ReturnExpectedClosingStructureInflowModelType(ClosingStructureInflowModelType value,
                                                                                                              ConfigurationClosingStructureInflowModelType expectedResult)
        {
            // Setup
            var converter = new ConfigurationClosingStructureInflowModelTypeConverter();

            // Call
            object result = converter.ConvertFrom(value);

            // Assert
            Assert.AreEqual(expectedResult, result);
        }