public void ShipVelocity_Always_ExpectedValues() { // Setup var random = new Random(22); var input = new StabilityPointStructuresInput(); var mean = (RoundedDouble)(0.01 + random.NextDouble()); var variation = (RoundedDouble)(0.01 + random.NextDouble()); var distributionToSet = new VariationCoefficientNormalDistribution(5) { Mean = mean, CoefficientOfVariation = variation }; // Call input.ShipVelocity = distributionToSet; // Assert var expectedDistribution = new VariationCoefficientNormalDistribution(2) { Mean = mean, CoefficientOfVariation = variation }; DistributionTestHelper.AssertDistributionCorrectlySet(input.ShipVelocity, distributionToSet, expectedDistribution); }
/// <summary> /// Creates a new instance of <see cref="StabilityPointStructuresInput"/>. /// </summary> public StabilityPointStructuresInput() { volumicWeightWater = new RoundedDouble(2, 9.81); factorStormDurationOpenStructure = new RoundedDouble(2, 1.0); failureProbabilityRepairClosure = 0; evaluationLevel = new RoundedDouble(2); verticalDistance = new RoundedDouble(verticalDistanceNumberOfDecimals); drainCoefficient = new LogNormalDistribution(2) { Mean = (RoundedDouble)1.0, StandardDeviation = (RoundedDouble)0.20 }; insideWaterLevelFailureConstruction = new NormalDistribution(2); insideWaterLevel = new NormalDistribution(2); flowVelocityStructureClosable = new VariationCoefficientNormalDistribution(2); levelCrestStructure = new NormalDistribution(2); thresholdHeightOpenWeir = new NormalDistribution(2); areaFlowApertures = new LogNormalDistribution(2); constructiveStrengthLinearLoadModel = new VariationCoefficientLogNormalDistribution(2); constructiveStrengthQuadraticLoadModel = new VariationCoefficientLogNormalDistribution(2); stabilityLinearLoadModel = new VariationCoefficientLogNormalDistribution(2); stabilityQuadraticLoadModel = new VariationCoefficientLogNormalDistribution(2); failureCollisionEnergy = new VariationCoefficientLogNormalDistribution(2); shipMass = new VariationCoefficientNormalDistribution(2); shipVelocity = new VariationCoefficientNormalDistribution(2); bankWidth = new NormalDistribution(2); SetDefaultSchematizationProperties(); }
public void Constructor_ExpectedValues() { // Setup var modelFactorStorageVolume = new LogNormalDistribution(2) { Mean = (RoundedDouble)1, StandardDeviation = (RoundedDouble)0.2 }; var modelFactorCollisionLoad = new VariationCoefficientNormalDistribution(1) { Mean = (RoundedDouble)1, CoefficientOfVariation = (RoundedDouble)0.2 }; var modelFactorLoadEffect = new NormalDistribution(2) { Mean = (RoundedDouble)1, StandardDeviation = (RoundedDouble)0.05 }; var modelFactorLongThreshold = new NormalDistribution(2) { Mean = (RoundedDouble)0.9, StandardDeviation = (RoundedDouble)0.05 }; // Call var inputParameters = new GeneralStabilityPointStructuresInput(); // Assert Assert.AreEqual(2, inputParameters.N.NumberOfDecimalPlaces); Assert.AreEqual(3.0, inputParameters.N, inputParameters.N.GetAccuracy()); Assert.IsFalse(inputParameters.ApplyLengthEffectInSection); Assert.AreEqual(2, inputParameters.GravitationalAcceleration.NumberOfDecimalPlaces); Assert.AreEqual(9.81, inputParameters.GravitationalAcceleration, inputParameters.GravitationalAcceleration.GetAccuracy()); DistributionAssert.AreEqual(modelFactorStorageVolume, inputParameters.ModelFactorStorageVolume); DistributionAssert.AreEqual(modelFactorCollisionLoad, inputParameters.ModelFactorCollisionLoad); DistributionAssert.AreEqual(modelFactorLoadEffect, inputParameters.ModelFactorLoadEffect); DistributionAssert.AreEqual(modelFactorLongThreshold, inputParameters.ModelFactorLongThreshold); Assert.AreEqual(2, inputParameters.ModelFactorInflowVolume.NumberOfDecimalPlaces); Assert.AreEqual(1, inputParameters.ModelFactorInflowVolume, inputParameters.ModelFactorInflowVolume.GetAccuracy()); Assert.AreEqual(0, inputParameters.ModificationFactorWavesSlowlyVaryingPressureComponent.NumberOfDecimalPlaces); Assert.AreEqual(1, inputParameters.ModificationFactorWavesSlowlyVaryingPressureComponent, inputParameters.ModificationFactorWavesSlowlyVaryingPressureComponent.GetAccuracy()); Assert.AreEqual(0, inputParameters.ModificationFactorDynamicOrImpulsivePressureComponent.NumberOfDecimalPlaces); Assert.AreEqual(1, inputParameters.ModificationFactorDynamicOrImpulsivePressureComponent, inputParameters.ModificationFactorDynamicOrImpulsivePressureComponent.GetAccuracy()); Assert.AreEqual(2, inputParameters.WaveRatioMaxHN.NumberOfDecimalPlaces); Assert.AreEqual(5000, inputParameters.WaveRatioMaxHN, inputParameters.WaveRatioMaxHN.GetAccuracy()); Assert.AreEqual(2, inputParameters.WaveRatioMaxHStandardDeviation.NumberOfDecimalPlaces); Assert.AreEqual(0.5, inputParameters.WaveRatioMaxHStandardDeviation, inputParameters.WaveRatioMaxHStandardDeviation.GetAccuracy()); }
public void Mean_SetNewValue_ReturnNewlySetValue() { // Setup var distribution = new VariationCoefficientNormalDistribution(2); // Call distribution.Mean = (RoundedDouble)12.34567; // Assert Assert.AreEqual(12.35, distribution.Mean.Value); }
public void CoefficientOfVariation_SetNewValue_ReturnNewlySetValue( double actualSetValue, double expectedRoundedValue) { // Setup var distribution = new VariationCoefficientNormalDistribution(2); // Call distribution.CoefficientOfVariation = (RoundedDouble)actualSetValue; // Assert Assert.AreEqual(expectedRoundedValue, distribution.CoefficientOfVariation.Value); }
public void Constructor_WithParameter_ExpectedValues(int numberOfDecimalPlaces) { // Call var distribution = new VariationCoefficientNormalDistribution(numberOfDecimalPlaces); // Assert Assert.IsInstanceOf <IVariationCoefficientDistribution>(distribution); Assert.AreEqual(numberOfDecimalPlaces, distribution.Mean.NumberOfDecimalPlaces); Assert.AreEqual(1.0, distribution.Mean.Value); Assert.AreEqual(numberOfDecimalPlaces, distribution.CoefficientOfVariation.NumberOfDecimalPlaces); Assert.AreEqual(1.0, distribution.CoefficientOfVariation.Value); }
public void CoefficientOfVariation_NegativeValue_ThrowArgumentOutOfRangeException(double invalidCoefficient) { // Setup var distribution = new VariationCoefficientNormalDistribution(2); // Call void Call() => distribution.CoefficientOfVariation = (RoundedDouble)invalidCoefficient; // Assert const string expectedMessage = "Variatiecoëfficiënt (CV) moet groter zijn dan of gelijk zijn aan 0."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage <ArgumentOutOfRangeException>(Call, expectedMessage); }
public void Constructor_WithData_ReadOnlyProperties() { // Setup var distribution = new VariationCoefficientNormalDistribution(); // Call var properties = new VariationCoefficientNormalDistributionProperties(distribution); // Assert Assert.IsInstanceOf <VariationCoefficientDistributionPropertiesBase <VariationCoefficientNormalDistribution> >(properties); Assert.AreSame(distribution, properties.Data); AssertPropertiesInState(properties, true, true); }
public void Constructor_ExpectedValues() { // Call var distribution = new VariationCoefficientNormalDistribution(); // Assert Assert.IsInstanceOf <IVariationCoefficientDistribution>(distribution); const int numberOfDecimalPlaces = RoundedDouble.MaximumNumberOfDecimalPlaces; Assert.AreEqual(numberOfDecimalPlaces, distribution.Mean.NumberOfDecimalPlaces); Assert.AreEqual(1.0, distribution.Mean.Value); Assert.AreEqual(numberOfDecimalPlaces, distribution.CoefficientOfVariation.NumberOfDecimalPlaces); Assert.AreEqual(1.0, distribution.CoefficientOfVariation.Value); }
public void Clone_Always_ReturnNewInstanceWithCopiedValues() { // Setup var random = new Random(21); var original = new VariationCoefficientNormalDistribution(random.Next(1, 16)) { Mean = random.NextRoundedDouble(), CoefficientOfVariation = random.NextRoundedDouble() }; // Call object clone = original.Clone(); // Assert CoreCloneAssert.AreObjectClones(original, clone, DistributionAssert.AreEqual); }
/// <summary> /// Asserts whether the <see cref="PersistableSoil"/> contains the data /// that is representative for the <paramref name="originalLayers"/>. /// </summary> /// <param name="originalLayers">The layers that contain the original data.</param> /// <param name="actualSoils">The collection of <see cref="PersistableSoil"/> /// that needs to be asserted.</param> /// <exception cref="AssertionException">Thrown when the data in <paramref name="actualSoils"/> /// is not correct.</exception> public static void AssertPersistableSoils(IEnumerable <IMacroStabilityInwardsSoilLayer> originalLayers, IEnumerable <PersistableSoil> actualSoils) { Assert.AreEqual(originalLayers.Count(), actualSoils.Count()); for (var i = 0; i < originalLayers.Count(); i++) { PersistableSoil soil = actualSoils.ElementAt(i); MacroStabilityInwardsSoilLayerData layerData = originalLayers.ElementAt(i).Data; Assert.IsNotNull(soil.Id); Assert.AreEqual(layerData.MaterialName, soil.Name); Assert.AreEqual($"{layerData.MaterialName}-{soil.Id}", soil.Code); Assert.IsTrue(soil.IsProbabilistic); Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetCohesion(layerData).GetDesignValue(), soil.Cohesion); AssertStochasticParameter(layerData.Cohesion, soil.CohesionStochasticParameter); Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetFrictionAngle(layerData).GetDesignValue(), soil.FrictionAngle); AssertStochasticParameter(layerData.FrictionAngle, soil.FrictionAngleStochasticParameter); Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetShearStrengthRatio(layerData).GetDesignValue(), soil.ShearStrengthRatio); AssertStochasticParameter(layerData.ShearStrengthRatio, soil.ShearStrengthRatioStochasticParameter); Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetStrengthIncreaseExponent(layerData).GetDesignValue(), soil.StrengthIncreaseExponent); AssertStochasticParameter(layerData.StrengthIncreaseExponent, soil.StrengthIncreaseExponentStochasticParameter); Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetAbovePhreaticLevel(layerData).GetDesignValue(), soil.VolumetricWeightAbovePhreaticLevel); Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetBelowPhreaticLevel(layerData).GetDesignValue(), soil.VolumetricWeightBelowPhreaticLevel); Assert.IsFalse(soil.CohesionAndFrictionAngleCorrelated); Assert.IsFalse(soil.ShearStrengthRatioAndShearStrengthExponentCorrelated); Assert.AreEqual(GetExpectedShearStrengthModelTypeForAbovePhreaticLevel(layerData.ShearStrengthModel), soil.ShearStrengthModelTypeAbovePhreaticLevel); Assert.AreEqual(GetExpectedShearStrengthModelTypeForBelowPhreaticLevel(layerData.ShearStrengthModel), soil.ShearStrengthModelTypeBelowPhreaticLevel); var dilatancyDistribution = new VariationCoefficientNormalDistribution(2) { Mean = (RoundedDouble)1, CoefficientOfVariation = (RoundedDouble)0 }; Assert.AreEqual(0, soil.Dilatancy); AssertStochasticParameter(dilatancyDistribution, soil.DilatancyStochasticParameter, false); } }
public void ValidateDistribution_InvalidVariationCoefficient_ErrorMessage(double value) { // Setup var distribution = new VariationCoefficientNormalDistribution(2) { CoefficientOfVariation = (RoundedDouble)value }; var rule = new VariationCoefficientNormalDistributionRule(distribution, paramName); // Call IEnumerable <string> messages = rule.Validate(); string[] validationMessages = messages.ToArray(); // Assert Assert.AreEqual(1, validationMessages.Length); string expectedMessage = $"De variatiecoëfficiënt voor '{paramName}' moet groter zijn dan of gelijk zijn aan 0."; StringAssert.StartsWith(expectedMessage, validationMessages[0]); }
public void Validate_InvalidMean_ErrorMessage(double value) { // Setup var distribution = new VariationCoefficientNormalDistribution(2) { Mean = (RoundedDouble)value }; var rule = new VariationCoefficientNormalDistributionRule(distribution, paramName); // Call IEnumerable <string> messages = rule.Validate(); string[] validationMessages = messages.ToArray(); // Assert Assert.AreEqual(1, validationMessages.Length); string expectedMessage = $"De verwachtingswaarde voor '{paramName}' moet een concreet getal zijn."; StringAssert.StartsWith(expectedMessage, validationMessages[0]); }
public void Constructor_WithParameters_ExpectedValues() { // Setup var mocks = new MockRepository(); var handler = mocks.Stub <IObservablePropertyChangeHandler>(); mocks.ReplayAll(); var distribution = new VariationCoefficientNormalDistribution(); // Call var properties = new VariationCoefficientNormalDistributionProperties( VariationCoefficientDistributionReadOnlyProperties.None, distribution, handler); // Assert Assert.IsInstanceOf <VariationCoefficientDistributionPropertiesBase <VariationCoefficientNormalDistribution> >(properties); Assert.AreSame(distribution, properties.Data); Assert.AreEqual("Normaal", properties.DistributionType); AssertPropertiesInState(properties, false, false); mocks.VerifyAll(); }
/// <summary> /// Initializes a new instance of the <see cref="GeneralStabilityPointStructuresInput"/> class. /// </summary> public GeneralStabilityPointStructuresInput() { n = new RoundedDouble(numberOfDecimalPlacesN, 3.0); GravitationalAcceleration = new RoundedDouble(2, 9.81); ModelFactorStorageVolume = new LogNormalDistribution(2) { Mean = (RoundedDouble)1, StandardDeviation = (RoundedDouble)0.2 }; ModelFactorCollisionLoad = new VariationCoefficientNormalDistribution(1) { Mean = (RoundedDouble)1, CoefficientOfVariation = (RoundedDouble)0.2 }; ModelFactorLoadEffect = new NormalDistribution(2) { Mean = (RoundedDouble)1, StandardDeviation = (RoundedDouble)0.05 }; ModelFactorLongThreshold = new NormalDistribution(2) { Mean = (RoundedDouble)0.9, StandardDeviation = (RoundedDouble)0.05 }; ModelFactorInflowVolume = new RoundedDouble(2, 1); ModificationFactorWavesSlowlyVaryingPressureComponent = new RoundedDouble(0, 1); ModificationFactorDynamicOrImpulsivePressureComponent = new RoundedDouble(0, 1); WaveRatioMaxHN = new RoundedDouble(2, 5000); WaveRatioMaxHStandardDeviation = new RoundedDouble(2, 0.5); }
private void SetDefaultSchematizationProperties() { EvaluationLevel = RoundedDouble.NaN; FailureProbabilityRepairClosure = 0.0; InflowModelType = 0; LoadSchematizationType = LoadSchematizationType.Linear; StructureNormalOrientation = RoundedDouble.NaN; VerticalDistance = RoundedDouble.NaN; LevellingCount = 0; ProbabilityCollisionSecondaryStructure = 0.0; LevelCrestStructure = new NormalDistribution { Mean = RoundedDouble.NaN, StandardDeviation = RoundedDouble.NaN }; ThresholdHeightOpenWeir = new NormalDistribution { Mean = RoundedDouble.NaN, StandardDeviation = RoundedDouble.NaN }; AreaFlowApertures = new LogNormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = RoundedDouble.NaN }; ConstructiveStrengthLinearLoadModel = new VariationCoefficientLogNormalDistribution { Mean = RoundedDouble.NaN, CoefficientOfVariation = RoundedDouble.NaN }; ConstructiveStrengthQuadraticLoadModel = new VariationCoefficientLogNormalDistribution { Mean = RoundedDouble.NaN, CoefficientOfVariation = RoundedDouble.NaN }; StabilityLinearLoadModel = new VariationCoefficientLogNormalDistribution { Mean = RoundedDouble.NaN, CoefficientOfVariation = RoundedDouble.NaN }; StabilityQuadraticLoadModel = new VariationCoefficientLogNormalDistribution { Mean = RoundedDouble.NaN, CoefficientOfVariation = RoundedDouble.NaN }; FailureCollisionEnergy = new VariationCoefficientLogNormalDistribution { Mean = RoundedDouble.NaN, CoefficientOfVariation = RoundedDouble.NaN }; ShipMass = new VariationCoefficientNormalDistribution { Mean = RoundedDouble.NaN, CoefficientOfVariation = RoundedDouble.NaN }; ShipVelocity = new VariationCoefficientNormalDistribution { Mean = RoundedDouble.NaN, CoefficientOfVariation = RoundedDouble.NaN }; BankWidth = new NormalDistribution { Mean = RoundedDouble.NaN, StandardDeviation = RoundedDouble.NaN }; InsideWaterLevel = new NormalDistribution { Mean = RoundedDouble.NaN, StandardDeviation = RoundedDouble.NaN }; InsideWaterLevelFailureConstruction = new NormalDistribution { Mean = RoundedDouble.NaN, StandardDeviation = RoundedDouble.NaN }; FlowVelocityStructureClosable = new VariationCoefficientNormalDistribution { Mean = RoundedDouble.NaN }; flowVelocityStructureClosable.CoefficientOfVariation = (RoundedDouble)0.2; }
public void GivenInputWithStructure_WhenStructureNull_ThenSchematizationPropertiesSynedToDefaults() { // Given var structure = new TestStabilityPointStructure(); var input = new StabilityPointStructuresInput { Structure = structure }; RoundedDouble expectedVolumicWeightWater = input.VolumicWeightWater; LogNormalDistribution expectedDrainCoefficient = input.DrainCoefficient; RoundedDouble expectedFactorStormDurationOpenStructure = input.FactorStormDurationOpenStructure; double expectedFailureProbabilityStructureWithErosion = input.FailureProbabilityStructureWithErosion; // Precondition AssertStabilityPointStructureInput(structure, input); // When input.Structure = null; // Then AssertAreEqual(expectedVolumicWeightWater, input.VolumicWeightWater); Assert.AreEqual(2, input.FactorStormDurationOpenStructure.NumberOfDecimalPlaces); Assert.AreEqual(expectedFactorStormDurationOpenStructure, input.FactorStormDurationOpenStructure, input.FactorStormDurationOpenStructure.GetAccuracy()); DistributionAssert.AreEqual(expectedDrainCoefficient, input.DrainCoefficient); Assert.AreEqual(expectedFailureProbabilityStructureWithErosion, input.FailureProbabilityStructureWithErosion); var expectedLevelCrestStructure = new NormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = RoundedDouble.NaN }; var expectedThresholdHeightOpenWeir = new NormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = RoundedDouble.NaN }; var expectedAreaFlowApertures = new LogNormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = RoundedDouble.NaN }; var expectedConstructiveStrengthLinearLoadModel = new VariationCoefficientLogNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = RoundedDouble.NaN }; var expectedConstructiveStrengthQuadraticLoadModel = new VariationCoefficientLogNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = RoundedDouble.NaN }; var expectedStabilityLinearLoadModel = new VariationCoefficientLogNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = RoundedDouble.NaN }; var expectedStabilityQuadraticLoadModel = new VariationCoefficientLogNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = RoundedDouble.NaN }; var expectedFailureCollisionEnergy = new VariationCoefficientLogNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = RoundedDouble.NaN }; var expectedShipMass = new VariationCoefficientNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = RoundedDouble.NaN }; var expectedShipVelocity = new VariationCoefficientNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = RoundedDouble.NaN }; var expectedBankWidth = new NormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = RoundedDouble.NaN }; var expectedInsideWaterLevelFailureConstruction = new NormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = RoundedDouble.NaN }; var expectedInsideWaterLevel = new NormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = RoundedDouble.NaN }; var expectedFlowVelocityStructureClosable = new VariationCoefficientNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = (RoundedDouble)0.2 }; DistributionAssert.AreEqual(expectedLevelCrestStructure, input.LevelCrestStructure); DistributionAssert.AreEqual(expectedThresholdHeightOpenWeir, input.ThresholdHeightOpenWeir); DistributionAssert.AreEqual(expectedAreaFlowApertures, input.AreaFlowApertures); DistributionAssert.AreEqual(expectedConstructiveStrengthLinearLoadModel, input.ConstructiveStrengthLinearLoadModel); DistributionAssert.AreEqual(expectedConstructiveStrengthQuadraticLoadModel, input.ConstructiveStrengthQuadraticLoadModel); DistributionAssert.AreEqual(expectedStabilityLinearLoadModel, input.StabilityLinearLoadModel); DistributionAssert.AreEqual(expectedStabilityQuadraticLoadModel, input.StabilityQuadraticLoadModel); Assert.AreEqual(0, input.FailureProbabilityRepairClosure); DistributionAssert.AreEqual(expectedFailureCollisionEnergy, input.FailureCollisionEnergy); DistributionAssert.AreEqual(expectedShipMass, input.ShipMass); DistributionAssert.AreEqual(expectedShipVelocity, input.ShipVelocity); Assert.AreEqual(0, input.LevellingCount); Assert.AreEqual(0, input.ProbabilityCollisionSecondaryStructure); DistributionAssert.AreEqual(expectedBankWidth, input.BankWidth); DistributionAssert.AreEqual(expectedInsideWaterLevelFailureConstruction, input.InsideWaterLevelFailureConstruction); DistributionAssert.AreEqual(expectedInsideWaterLevel, input.InsideWaterLevel); DistributionAssert.AreEqual(expectedFlowVelocityStructureClosable, input.FlowVelocityStructureClosable); Assert.AreEqual(2, input.EvaluationLevel.NumberOfDecimalPlaces); AssertAreEqual(double.NaN, input.EvaluationLevel); Assert.AreEqual(2, input.VerticalDistance.NumberOfDecimalPlaces); AssertAreEqual(double.NaN, input.VerticalDistance); Assert.AreEqual(0, (int)input.InflowModelType); Assert.AreEqual(LoadSchematizationType.Linear, input.LoadSchematizationType); }
public void Constructor_ExpectedValues() { // Call var input = new StabilityPointStructuresInput(); // Assert Assert.IsInstanceOf <StructuresInputBase <StabilityPointStructure> >(input); AssertAreEqual(9.81, input.VolumicWeightWater); Assert.AreEqual(2, input.VolumicWeightWater.NumberOfDecimalPlaces); var expectedInsideWaterLevelFailureConstruction = new NormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = RoundedDouble.NaN }; var expectedInsideWaterLevel = new NormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = RoundedDouble.NaN }; var expectedDrainCoefficient = new LogNormalDistribution(2) { Mean = (RoundedDouble)1, StandardDeviation = (RoundedDouble)0.2 }; var expectedFlowVelocityStructureClosable = new VariationCoefficientNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = (RoundedDouble)0.2 }; var expectedLevelCrestStructure = new NormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = RoundedDouble.NaN }; var expectedThresholdHeightOpenWeir = new NormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = RoundedDouble.NaN }; var expectedAreaFlowApertures = new LogNormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = RoundedDouble.NaN }; var expectedConstructiveStrengthLinearLoadModel = new VariationCoefficientLogNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = RoundedDouble.NaN }; var expectedConstructiveStrengthQuadraticLoadModel = new VariationCoefficientLogNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = RoundedDouble.NaN }; var expectedStabilityLinearLoadModel = new VariationCoefficientLogNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = RoundedDouble.NaN }; var expectedStabilityQuadraticLoadModel = new VariationCoefficientLogNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = RoundedDouble.NaN }; var expectedFailureCollisionEnergy = new VariationCoefficientLogNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = RoundedDouble.NaN }; var expectedShipMass = new VariationCoefficientNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = RoundedDouble.NaN }; var expectedShipVelocity = new VariationCoefficientNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = RoundedDouble.NaN }; var expectedBankWidth = new NormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = RoundedDouble.NaN }; DistributionAssert.AreEqual(expectedInsideWaterLevelFailureConstruction, input.InsideWaterLevelFailureConstruction); DistributionAssert.AreEqual(expectedInsideWaterLevel, input.InsideWaterLevel); Assert.AreEqual(2, input.FactorStormDurationOpenStructure.NumberOfDecimalPlaces); Assert.AreEqual(1.0, input.FactorStormDurationOpenStructure, input.FactorStormDurationOpenStructure.GetAccuracy()); DistributionAssert.AreEqual(expectedDrainCoefficient, input.DrainCoefficient); DistributionAssert.AreEqual(expectedFlowVelocityStructureClosable, input.FlowVelocityStructureClosable); DistributionAssert.AreEqual(expectedLevelCrestStructure, input.LevelCrestStructure); DistributionAssert.AreEqual(expectedThresholdHeightOpenWeir, input.ThresholdHeightOpenWeir); DistributionAssert.AreEqual(expectedAreaFlowApertures, input.AreaFlowApertures); DistributionAssert.AreEqual(expectedConstructiveStrengthLinearLoadModel, input.ConstructiveStrengthLinearLoadModel); DistributionAssert.AreEqual(expectedConstructiveStrengthQuadraticLoadModel, input.ConstructiveStrengthQuadraticLoadModel); DistributionAssert.AreEqual(expectedStabilityLinearLoadModel, input.StabilityLinearLoadModel); DistributionAssert.AreEqual(expectedStabilityQuadraticLoadModel, input.StabilityQuadraticLoadModel); Assert.AreEqual(0, input.FailureProbabilityRepairClosure); DistributionAssert.AreEqual(expectedFailureCollisionEnergy, input.FailureCollisionEnergy); DistributionAssert.AreEqual(expectedShipMass, input.ShipMass); DistributionAssert.AreEqual(expectedShipVelocity, input.ShipVelocity); Assert.AreEqual(0, input.LevellingCount); Assert.AreEqual(0, input.ProbabilityCollisionSecondaryStructure); DistributionAssert.AreEqual(expectedBankWidth, input.BankWidth); Assert.AreEqual(2, input.EvaluationLevel.NumberOfDecimalPlaces); AssertAreEqual(double.NaN, input.EvaluationLevel); Assert.AreEqual(2, input.VerticalDistance.NumberOfDecimalPlaces); AssertAreEqual(double.NaN, input.VerticalDistance); Assert.AreEqual(0, (int)input.InflowModelType); Assert.AreEqual(LoadSchematizationType.Linear, input.LoadSchematizationType); }
/// <summary> /// Initializes a new instance of the <see cref="ConstructionProperties"/> class. /// </summary> public ConstructionProperties() { StorageStructureArea = new VariationCoefficientLogNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = (RoundedDouble)0.1 }; AllowedLevelIncreaseStorage = new LogNormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = (RoundedDouble)0.1 }; WidthFlowApertures = new NormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = (RoundedDouble)0.2 }; InsideWaterLevel = new NormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = (RoundedDouble)0.1 }; ThresholdHeightOpenWeir = new NormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = (RoundedDouble)0.1 }; CriticalOvertoppingDischarge = new VariationCoefficientLogNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = (RoundedDouble)0.15 }; FlowWidthAtBottomProtection = new LogNormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = (RoundedDouble)0.05 }; ConstructiveStrengthLinearLoadModel = new VariationCoefficientLogNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = (RoundedDouble)0.1 }; ConstructiveStrengthQuadraticLoadModel = new VariationCoefficientLogNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = (RoundedDouble)0.1 }; BankWidth = new NormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = RoundedDouble.NaN }; InsideWaterLevelFailureConstruction = new NormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = (RoundedDouble)0.1 }; LevelCrestStructure = new NormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = (RoundedDouble)0.05 }; VerticalDistance = double.NaN; FailureProbabilityRepairClosure = 1; FailureCollisionEnergy = new VariationCoefficientLogNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = (RoundedDouble)0.3 }; ShipMass = new VariationCoefficientNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = (RoundedDouble)0.2 }; ShipVelocity = new VariationCoefficientNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = (RoundedDouble)0.2 }; LevellingCount = 1; ProbabilityCollisionSecondaryStructure = 1; FlowVelocityStructureClosable = new VariationCoefficientNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = (RoundedDouble)0.2 }; StabilityLinearLoadModel = new VariationCoefficientLogNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = (RoundedDouble)0.1 }; StabilityQuadraticLoadModel = new VariationCoefficientLogNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = (RoundedDouble)0.1 }; AreaFlowApertures = new LogNormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = (RoundedDouble)0.01 }; InflowModelType = StabilityPointStructureInflowModelType.LowSill; }
/// <summary> /// Creates a new instance of <see cref="VariationCoefficientNormalDistributionRule"/> to validate /// a <see cref="VariationCoefficientNormalDistribution"/>. /// </summary> /// <param name="distribution">The distribution to validate.</param> /// <param name="parameterName">The name of the parameter.</param> /// <returns>The validation errors found. Collection is empty if <paramref name="distribution"/> is valid.</returns> public VariationCoefficientNormalDistributionRule(VariationCoefficientNormalDistribution distribution, string parameterName) { this.distribution = distribution; this.parameterName = parameterName; }
/// <summary> /// Initializes a new instance of the <see cref="StabilityPointStructure"/> class. /// </summary> /// <param name="constructionProperties">The construction properties.</param> /// <exception cref="ArgumentException">Thrown when <see cref="ConstructionProperties.Name"/> /// or <see cref="ConstructionProperties.Id"/> is <c>null</c>, empty or consists of whitespace.</exception> /// <exception cref="ArgumentNullException">Thrown when <see cref="ConstructionProperties.Location"/> is <c>null</c>.</exception> public StabilityPointStructure(ConstructionProperties constructionProperties) : base(constructionProperties) { StorageStructureArea = new VariationCoefficientLogNormalDistribution(2) { Mean = constructionProperties.StorageStructureArea.Mean, CoefficientOfVariation = constructionProperties.StorageStructureArea.CoefficientOfVariation }; AllowedLevelIncreaseStorage = new LogNormalDistribution(2) { Mean = constructionProperties.AllowedLevelIncreaseStorage.Mean, StandardDeviation = constructionProperties.AllowedLevelIncreaseStorage.StandardDeviation }; WidthFlowApertures = new NormalDistribution(2) { Mean = constructionProperties.WidthFlowApertures.Mean, StandardDeviation = constructionProperties.WidthFlowApertures.StandardDeviation }; InsideWaterLevel = new NormalDistribution(2) { Mean = constructionProperties.InsideWaterLevel.Mean, StandardDeviation = constructionProperties.InsideWaterLevel.StandardDeviation }; ThresholdHeightOpenWeir = new NormalDistribution(2) { Mean = constructionProperties.ThresholdHeightOpenWeir.Mean, StandardDeviation = constructionProperties.ThresholdHeightOpenWeir.StandardDeviation }; CriticalOvertoppingDischarge = new VariationCoefficientLogNormalDistribution(2) { Mean = constructionProperties.CriticalOvertoppingDischarge.Mean, CoefficientOfVariation = constructionProperties.CriticalOvertoppingDischarge.CoefficientOfVariation }; FlowWidthAtBottomProtection = new LogNormalDistribution(2) { Mean = constructionProperties.FlowWidthAtBottomProtection.Mean, StandardDeviation = constructionProperties.FlowWidthAtBottomProtection.StandardDeviation }; ConstructiveStrengthLinearLoadModel = new VariationCoefficientLogNormalDistribution(2) { Mean = constructionProperties.ConstructiveStrengthLinearLoadModel.Mean, CoefficientOfVariation = constructionProperties.ConstructiveStrengthLinearLoadModel.CoefficientOfVariation }; ConstructiveStrengthQuadraticLoadModel = new VariationCoefficientLogNormalDistribution(2) { Mean = constructionProperties.ConstructiveStrengthQuadraticLoadModel.Mean, CoefficientOfVariation = constructionProperties.ConstructiveStrengthQuadraticLoadModel.CoefficientOfVariation }; BankWidth = new NormalDistribution(2) { Mean = constructionProperties.BankWidth.Mean, StandardDeviation = constructionProperties.BankWidth.StandardDeviation }; InsideWaterLevelFailureConstruction = new NormalDistribution(2) { Mean = constructionProperties.InsideWaterLevelFailureConstruction.Mean, StandardDeviation = constructionProperties.InsideWaterLevelFailureConstruction.StandardDeviation }; EvaluationLevel = new RoundedDouble(2, constructionProperties.EvaluationLevel); LevelCrestStructure = new NormalDistribution(2) { Mean = constructionProperties.LevelCrestStructure.Mean, StandardDeviation = constructionProperties.LevelCrestStructure.StandardDeviation }; VerticalDistance = new RoundedDouble(2, constructionProperties.VerticalDistance); FailureProbabilityRepairClosure = constructionProperties.FailureProbabilityRepairClosure; FailureCollisionEnergy = new VariationCoefficientLogNormalDistribution(2) { Mean = constructionProperties.FailureCollisionEnergy.Mean, CoefficientOfVariation = constructionProperties.FailureCollisionEnergy.CoefficientOfVariation }; ShipMass = new VariationCoefficientNormalDistribution(2) { Mean = constructionProperties.ShipMass.Mean, CoefficientOfVariation = constructionProperties.ShipMass.CoefficientOfVariation }; ShipVelocity = new VariationCoefficientNormalDistribution(2) { Mean = constructionProperties.ShipVelocity.Mean, CoefficientOfVariation = constructionProperties.ShipVelocity.CoefficientOfVariation }; LevellingCount = constructionProperties.LevellingCount; ProbabilityCollisionSecondaryStructure = constructionProperties.ProbabilityCollisionSecondaryStructure; FlowVelocityStructureClosable = new VariationCoefficientNormalDistribution(2) { Mean = constructionProperties.FlowVelocityStructureClosable.Mean, CoefficientOfVariation = (RoundedDouble)0.2 }; StabilityLinearLoadModel = new VariationCoefficientLogNormalDistribution(2) { Mean = constructionProperties.StabilityLinearLoadModel.Mean, CoefficientOfVariation = constructionProperties.StabilityLinearLoadModel.CoefficientOfVariation }; StabilityQuadraticLoadModel = new VariationCoefficientLogNormalDistribution(2) { Mean = constructionProperties.StabilityQuadraticLoadModel.Mean, CoefficientOfVariation = constructionProperties.StabilityQuadraticLoadModel.CoefficientOfVariation }; AreaFlowApertures = new LogNormalDistribution(2) { Mean = constructionProperties.AreaFlowApertures.Mean, StandardDeviation = constructionProperties.AreaFlowApertures.StandardDeviation }; InflowModelType = constructionProperties.InflowModelType; }