/// <summary> /// Initializes a new instance of the <see cref="HeightStructure"/> 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 HeightStructure(ConstructionProperties constructionProperties) : base(constructionProperties) { LevelCrestStructure = new NormalDistribution(2) { Mean = constructionProperties.LevelCrestStructure.Mean, StandardDeviation = constructionProperties.LevelCrestStructure.StandardDeviation }; FlowWidthAtBottomProtection = new LogNormalDistribution(2) { Mean = constructionProperties.FlowWidthAtBottomProtection.Mean, StandardDeviation = constructionProperties.FlowWidthAtBottomProtection.StandardDeviation }; CriticalOvertoppingDischarge = new VariationCoefficientLogNormalDistribution(2) { Mean = constructionProperties.CriticalOvertoppingDischarge.Mean, CoefficientOfVariation = constructionProperties.CriticalOvertoppingDischarge.CoefficientOfVariation }; WidthFlowApertures = new NormalDistribution(2) { Mean = constructionProperties.WidthFlowApertures.Mean, StandardDeviation = constructionProperties.WidthFlowApertures.StandardDeviation }; FailureProbabilityStructureWithErosion = constructionProperties.FailureProbabilityStructureWithErosion; StorageStructureArea = new VariationCoefficientLogNormalDistribution(2) { Mean = constructionProperties.StorageStructureArea.Mean, CoefficientOfVariation = constructionProperties.StorageStructureArea.CoefficientOfVariation }; AllowedLevelIncreaseStorage = new LogNormalDistribution(2) { Mean = constructionProperties.AllowedLevelIncreaseStorage.Mean, StandardDeviation = constructionProperties.AllowedLevelIncreaseStorage.StandardDeviation }; }
public void Constructor_ExpectedValues() { // Setup var criticalFlowRate = new LogNormalDistribution(4) { Mean = (RoundedDouble)0.004, StandardDeviation = (RoundedDouble)0.0006 }; // Call var input = new GrassCoverErosionInwardsInput(); // Assert Assert.IsInstanceOf <CloneableObservable>(input); Assert.IsInstanceOf <ICalculationInputWithHydraulicBoundaryLocation>(input); Assert.IsInstanceOf <IUseBreakWater>(input); Assert.IsInstanceOf <IUseForeshore>(input); Assert.AreEqual(2, input.Orientation.NumberOfDecimalPlaces); Assert.AreEqual(2, input.DikeHeight.NumberOfDecimalPlaces); AssertDefaultDikeProfileInput(input); Assert.IsNull(input.HydraulicBoundaryLocation); Assert.IsFalse(input.ShouldDikeHeightBeCalculated); Assert.IsFalse(input.ShouldOvertoppingRateBeCalculated); Assert.AreEqual(0, input.DikeHeightTargetProbability); Assert.AreEqual(0, input.OvertoppingRateTargetProbability); DistributionAssert.AreEqual(criticalFlowRate, input.CriticalFlowRate); }
public void TestSigma() { var sigma = 2.3; var distribution = new LogNormalDistribution(1, sigma); Assert.AreEqual(sigma, distribution.Sigma); }
/// <summary> /// Initializes a new instance of the <see cref="ConstructionProperties"/> class. /// </summary> public ConstructionProperties() { LevelCrestStructure = new NormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = (RoundedDouble)0.05 }; FlowWidthAtBottomProtection = new LogNormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = (RoundedDouble)0.05 }; CriticalOvertoppingDischarge = new VariationCoefficientLogNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = (RoundedDouble)0.15 }; WidthFlowApertures = new NormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = (RoundedDouble)0.2 }; StorageStructureArea = new VariationCoefficientLogNormalDistribution(2) { Mean = RoundedDouble.NaN, CoefficientOfVariation = (RoundedDouble)0.1 }; AllowedLevelIncreaseStorage = new LogNormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = (RoundedDouble)0.1 }; FailureProbabilityStructureWithErosion = 1.0; }
public void TestMu() { var mu = 2.3; var distribution = new LogNormalDistribution(mu, 1); Assert.AreEqual(mu, distribution.Mu); }
/// <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(); }
private void SetDefaultCommonStructureSchematizationProperties() { StructureNormalOrientation = RoundedDouble.NaN; AllowedLevelIncreaseStorage = new LogNormalDistribution { Mean = RoundedDouble.NaN, StandardDeviation = RoundedDouble.NaN }; StorageStructureArea = new VariationCoefficientLogNormalDistribution { Mean = RoundedDouble.NaN, CoefficientOfVariation = RoundedDouble.NaN }; FlowWidthAtBottomProtection = new LogNormalDistribution { Mean = RoundedDouble.NaN, StandardDeviation = RoundedDouble.NaN }; CriticalOvertoppingDischarge = new VariationCoefficientLogNormalDistribution { Mean = RoundedDouble.NaN, CoefficientOfVariation = RoundedDouble.NaN }; WidthFlowApertures = new NormalDistribution { Mean = RoundedDouble.NaN, StandardDeviation = RoundedDouble.NaN }; }
public void CriticalFlowRate_SetNewValue_GetNewValues() { // Setup var random = new Random(22); var input = new GrassCoverErosionInwardsInput(); RoundedDouble mean = random.NextRoundedDouble(0.01, double.MaxValue); RoundedDouble standardDeviation = random.NextRoundedDouble(0.01, double.MaxValue); var expectedDistribution = new LogNormalDistribution(4) { Mean = mean, StandardDeviation = standardDeviation }; var distributionToSet = new LogNormalDistribution(5) { Mean = mean, StandardDeviation = standardDeviation }; // Call input.CriticalFlowRate = distributionToSet; // Assert DistributionTestHelper.AssertDistributionCorrectlySet(input.CriticalFlowRate, distributionToSet, expectedDistribution); }
public void GetThicknessAquiferLayer_SurfaceLineHalfWayProfileLayer_ReturnsDistributionWithMeanSetToLayerHeightUnderSurfaceLine() { // Setup PipingInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer <TestPipingInput>(); input.StochasticSoilProfile = new PipingStochasticSoilProfile( 0.0, new PipingSoilProfile(string.Empty, 0, new[] { new PipingSoilLayer(2.5) { IsAquifer = true }, new PipingSoilLayer(1.5) { IsAquifer = true } }, SoilProfileType.SoilProfile1D) ); // Call LogNormalDistribution thicknessAquiferLayer = DerivedPipingInput.GetThicknessAquiferLayer(input); // Assert AssertThicknessAquiferLayer(thicknessAquiferLayer, 2.0); }
public void Constructor_ExpectedValues() { // Setup var modelFactorStorageVolume = new LogNormalDistribution(2) { Mean = (RoundedDouble)1.00, StandardDeviation = (RoundedDouble)0.20 }; var modelFactorOvertoppingFlow = new LogNormalDistribution(3) { Mean = (RoundedDouble)0.09, StandardDeviation = (RoundedDouble)0.06 }; // Call var generalHeightStructuresInput = new GeneralHeightStructuresInput(); // Assert Assert.AreEqual(2, generalHeightStructuresInput.N.NumberOfDecimalPlaces); Assert.AreEqual(2.0, generalHeightStructuresInput.N, generalHeightStructuresInput.N.GetAccuracy()); Assert.IsFalse(generalHeightStructuresInput.ApplyLengthEffectInSection); Assert.AreEqual(2, generalHeightStructuresInput.GravitationalAcceleration.NumberOfDecimalPlaces); Assert.AreEqual(9.81, generalHeightStructuresInput.GravitationalAcceleration, generalHeightStructuresInput.GravitationalAcceleration.GetAccuracy()); DistributionAssert.AreEqual(modelFactorOvertoppingFlow, generalHeightStructuresInput.ModelFactorOvertoppingFlow); DistributionAssert.AreEqual(modelFactorStorageVolume, generalHeightStructuresInput.ModelFactorStorageVolume); Assert.AreEqual(2, generalHeightStructuresInput.ModelFactorInflowVolume.NumberOfDecimalPlaces); Assert.AreEqual(1, generalHeightStructuresInput.ModelFactorInflowVolume, generalHeightStructuresInput.ModelFactorInflowVolume.GetAccuracy()); }
public void TestGetIntegrateDistribution(double x, double mean, double sigma, double error) { var sampler = new LogNormalSampler(new ReducedThreeFry4X64(1), mean, sigma); var referenceDistribution = new LogNormalDistribution(mean, sigma); SamplerTester.TestIntegrateDistribution(x, sampler, referenceDistribution, error); }
/// <summary> /// Initializes a new instance of the <see cref="GeneralPipingInput"/> class. /// </summary> public GeneralPipingInput() { UpliftModelFactor = new LogNormalDistribution(2) { Mean = (RoundedDouble)1.0, StandardDeviation = (RoundedDouble)0.1 }; SellmeijerModelFactor = new LogNormalDistribution(2) { Mean = (RoundedDouble)1.0, StandardDeviation = (RoundedDouble)0.12 }; waterVolumetricWeight = new RoundedDouble(waterVolumicWeightNumberOfDecimalPlaces, 9.81); CriticalHeaveGradient = new LogNormalDistribution(2) { Mean = (RoundedDouble)0.5, StandardDeviation = (RoundedDouble)0.1 }; WhitesDragCoefficient = 0.25; BeddingAngle = 37; WaterKinematicViscosity = 1.33e-6; Gravity = 9.81; MeanDiameter70 = 2.08e-4; SellmeijerReductionFactor = 0.3; }
public void ToString_Always_ReturnDistributionName() { // Setup var mockRepository = new MockRepository(); var handler = mockRepository.Stub <IObservablePropertyChangeHandler>(); mockRepository.ReplayAll(); var distribution = new LogNormalDistribution(2) { Mean = new RoundedDouble(2, 1), StandardDeviation = new RoundedDouble(2, 2), Shift = new RoundedDouble(2, 0.3) }; var designVariable = new LogNormalDistributionDesignVariable(distribution); // Call var properties = new ShiftedLogNormalDistributionDesignVariableProperties(DistributionReadOnlyProperties.None, designVariable, handler); // Call string propertyName = properties.ToString(); // Assert Assert.AreEqual("0,53 (Verwachtingswaarde = 1,00, Standaardafwijking = 2,00, Verschuiving = 0,30)", propertyName); }
public void Constructor_Always_PropertiesHaveExpectedAttributesValues() { // Setup var mockRepository = new MockRepository(); var handler = mockRepository.Stub <IObservablePropertyChangeHandler>(); mockRepository.ReplayAll(); var distribution = new LogNormalDistribution(); var designVariable = new LogNormalDistributionDesignVariable(distribution); // Call var properties = new ShiftedLogNormalDistributionDesignVariableProperties(DistributionReadOnlyProperties.None, designVariable, handler); // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); Assert.AreEqual(5, dynamicProperties.Count); PropertyDescriptor distributionTypeProperty = dynamicProperties[0]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(distributionTypeProperty, "Misc", "Type verdeling", "Het soort kansverdeling waarin deze parameter gedefinieerd wordt.", true); PropertyDescriptor meanProperty = dynamicProperties[1]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(meanProperty, "Misc", "Verwachtingswaarde", "De gemiddelde waarde van de lognormale verdeling."); PropertyDescriptor standardDeviationProperty = dynamicProperties[2]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(standardDeviationProperty, "Misc", "Standaardafwijking", "De standaardafwijking van de lognormale verdeling."); PropertyDescriptor shiftProperty = dynamicProperties[3]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(shiftProperty, "Misc", "Verschuiving", "De hoeveelheid waarmee de kansverdeling naar rechts (richting van positieve X-as) verschoven is.", true); PropertyDescriptor designValueProperty = dynamicProperties[4]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(designValueProperty, "Misc", "Rekenwaarde", "De representatieve waarde die gebruikt wordt door de berekening.", true); mockRepository.VerifyAll(); }
public void GetProperties_WithData_ReturnExpectedValues() { // Setup var mockRepository = new MockRepository(); var handler = mockRepository.Stub <IObservablePropertyChangeHandler>(); mockRepository.ReplayAll(); var distribution = new LogNormalDistribution(2) { Mean = new RoundedDouble(2, 1), StandardDeviation = new RoundedDouble(2, 2) }; var designVariable = new LogNormalDistributionDesignVariable(distribution); // Call var properties = new ShiftedLogNormalDistributionDesignVariableProperties(DistributionReadOnlyProperties.None, designVariable, handler); // Assert Assert.AreEqual("Lognormaal", properties.DistributionType); Assert.AreEqual(distribution.Mean, properties.Mean); Assert.AreEqual(distribution.StandardDeviation, properties.StandardDeviation); Assert.AreEqual(designVariable.GetDesignValue(), properties.DesignValue); }
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; }
private static void AssertCalculatorInput(GeneralPipingInput generalInput, ProbabilisticPipingInput input, double sectionLength, PipingCalculationInput actualInput) { LogNormalDistribution effectiveThicknessCoverageLayer = DerivedPipingInput.GetEffectiveThicknessCoverageLayer(input, generalInput); LogNormalDistribution saturatedVolumicWeightOfCoverageLayer = DerivedPipingInput.GetSaturatedVolumicWeightOfCoverageLayer(input); VariationCoefficientLogNormalDistribution seepageLength = DerivedPipingInput.GetSeepageLength(input); LogNormalDistribution thicknessAquiferLayer = DerivedPipingInput.GetThicknessAquiferLayer(input); VariationCoefficientLogNormalDistribution darcyPermeability = DerivedPipingInput.GetDarcyPermeability(input); VariationCoefficientLogNormalDistribution diameterD70 = DerivedPipingInput.GetDiameterD70(input); var expectedInput = new PipingCalculationInput( 1300001, sectionLength, input.PhreaticLevelExit.Mean, input.PhreaticLevelExit.StandardDeviation, generalInput.WaterVolumetricWeight, effectiveThicknessCoverageLayer.Mean, effectiveThicknessCoverageLayer.StandardDeviation, saturatedVolumicWeightOfCoverageLayer.Mean, saturatedVolumicWeightOfCoverageLayer.StandardDeviation, saturatedVolumicWeightOfCoverageLayer.Shift, generalInput.UpliftModelFactor.Mean, generalInput.UpliftModelFactor.StandardDeviation, input.DampingFactorExit.Mean, input.DampingFactorExit.StandardDeviation, seepageLength.Mean, seepageLength.CoefficientOfVariation, thicknessAquiferLayer.Mean, thicknessAquiferLayer.StandardDeviation, generalInput.SandParticlesVolumicWeight, generalInput.SellmeijerModelFactor.Mean, generalInput.SellmeijerModelFactor.StandardDeviation, generalInput.BeddingAngle, generalInput.WhitesDragCoefficient, generalInput.WaterKinematicViscosity, darcyPermeability.Mean, darcyPermeability.CoefficientOfVariation, diameterD70.Mean, diameterD70.CoefficientOfVariation, generalInput.Gravity, generalInput.CriticalHeaveGradient.Mean, generalInput.CriticalHeaveGradient.StandardDeviation); HydraRingDataEqualityHelper.AreEqual(expectedInput, actualInput); }
public void DrainCoefficient_Always_ExpectedValues() { // Setup var random = new Random(22); var input = new StabilityPointStructuresInput(); RoundedDouble mean = random.NextRoundedDouble(0.01, 1.0); RoundedDouble standardDeviation = random.NextRoundedDouble(0.01, 1.0); var distributionToSet = new LogNormalDistribution(5) { Mean = mean, StandardDeviation = standardDeviation }; // Call input.DrainCoefficient = distributionToSet; // Assert var expectedDistribution = new LogNormalDistribution(2) { Mean = mean, StandardDeviation = standardDeviation }; DistributionTestHelper.AssertDistributionCorrectlySet(input.DrainCoefficient, distributionToSet, expectedDistribution); }
/// <summary> /// Initializes a new instance of the <see cref="GeneralClosingStructuresInput"/> class. /// </summary> public GeneralClosingStructuresInput() { C = new RoundedDouble(2, 0.5); N2A = 1; GravitationalAcceleration = new RoundedDouble(2, 9.81); ModelFactorOvertoppingFlow = new LogNormalDistribution(3) { Mean = (RoundedDouble)0.09, StandardDeviation = (RoundedDouble)0.06 }; ModelFactorStorageVolume = new LogNormalDistribution(2) { Mean = (RoundedDouble)1, StandardDeviation = (RoundedDouble)0.2 }; ModelFactorLongThreshold = new NormalDistribution(2) { Mean = (RoundedDouble)0.9, StandardDeviation = (RoundedDouble)0.05 }; ModelFactorInflowVolume = new RoundedDouble(2, 1); }
public void FlowWidthAtBottomProtection_Always_ExpectedValues() { // Setup var random = new Random(22); var input = new SimpleStructuresInput(); var mean = (RoundedDouble)(0.01 + random.NextDouble()); var standardDeviation = (RoundedDouble)(0.01 + random.NextDouble()); var distributionToSet = new LogNormalDistribution(5) { Mean = mean, StandardDeviation = standardDeviation }; // Call input.FlowWidthAtBottomProtection = distributionToSet; // Assert var expectedDistribution = new LogNormalDistribution(2) { Mean = mean, StandardDeviation = standardDeviation }; DistributionTestHelper.AssertDistributionCorrectlySet(input.FlowWidthAtBottomProtection, distributionToSet, expectedDistribution); }
public void GetDesignValue_ValidLogNormalDistributionWithNonZeroShift_ReturnExpectedValue( double expectedValue, double variance, double shift, double percentile, double expectedResult) { // Setup const int numberOfDecimalPlaces = 4; var logNormalDistribution = new LogNormalDistribution(numberOfDecimalPlaces) { Mean = (RoundedDouble)expectedValue, StandardDeviation = (RoundedDouble)Math.Sqrt(variance), Shift = (RoundedDouble)shift }; var designVariable = new LogNormalDistributionDesignVariable(logNormalDistribution) { Percentile = percentile }; // Call RoundedDouble result = designVariable.GetDesignValue(); // Assert Assert.AreEqual(numberOfDecimalPlaces, result.NumberOfDecimalPlaces); Assert.AreEqual(expectedResult, result, result.GetAccuracy()); }
public void GetSaturatedVolumicWeightOfCoverageLayer_SingleLayer_ReturnsDistributionWithParametersFromLayer() { // Setup PipingInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer <TestPipingInput>(); var random = new Random(21); double belowPhreaticLevelMean = 0.1 + random.NextDouble(); double deviation = random.NextDouble(); double shift = random.NextDouble(); input.StochasticSoilProfile = new PipingStochasticSoilProfile( 0.0, new PipingSoilProfile("", 0.0, new[] { new PipingSoilLayer(2.5) { BelowPhreaticLevel = new LogNormalDistribution { Mean = (RoundedDouble)belowPhreaticLevelMean, StandardDeviation = (RoundedDouble)deviation, Shift = (RoundedDouble)shift } }, new PipingSoilLayer(0.5) { IsAquifer = true } }, SoilProfileType.SoilProfile1D)); // Call LogNormalDistribution result = DerivedPipingInput.GetSaturatedVolumicWeightOfCoverageLayer(input); // Assert AssertSaturatedVolumicWeightOfCoverageLayer(result, belowPhreaticLevelMean, deviation, shift); }
public void AreaFlowApertures_Always_ExpectedValues() { // Setup var random = new Random(22); var input = new ClosingStructuresInput(); RoundedDouble mean = random.NextRoundedDouble(0.01, 1.0); RoundedDouble standardDeviation = random.NextRoundedDouble(0.01, 1.0); var distributionToSet = new LogNormalDistribution(5) { Mean = mean, StandardDeviation = standardDeviation }; // Call input.AreaFlowApertures = distributionToSet; // Assert var expectedDistribution = new LogNormalDistribution(2) { Mean = mean, StandardDeviation = standardDeviation }; DistributionTestHelper.AssertDistributionCorrectlySet(input.AreaFlowApertures, distributionToSet, expectedDistribution); }
public void GetThicknessAquiferLayer_InputResultsInZeroAquiferThickness_ReturnsDistributionWithMeanNaN() { // Setup PipingInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer <TestPipingInput>(); input.StochasticSoilProfile = new PipingStochasticSoilProfile( 0.0, new PipingSoilProfile(string.Empty, 0, new[] { new PipingSoilLayer(2.0) { IsAquifer = false }, new PipingSoilLayer(0.0) { IsAquifer = true } }, SoilProfileType.SoilProfile1D) ); // Call LogNormalDistribution thicknessAquiferLayer = DerivedPipingInput.GetThicknessAquiferLayer(input); // Assert AssertThicknessAquiferLayer(thicknessAquiferLayer); }
public void BelowPhreaticLevel_Always_ExpectedValues() { // Setup var random = new Random(21); var layer = new PipingSoilLayer(random.NextDouble()); var distributionToSet = new LogNormalDistribution { Mean = random.NextRoundedDouble(), StandardDeviation = random.NextRoundedDouble(), Shift = random.NextRoundedDouble() }; // Call layer.BelowPhreaticLevel = distributionToSet; // Assert var expectedDistribution = new LogNormalDistribution(2) { Mean = distributionToSet.Mean, StandardDeviation = distributionToSet.StandardDeviation, Shift = distributionToSet.Shift }; DistributionTestHelper.AssertDistributionCorrectlySet(layer.BelowPhreaticLevel, distributionToSet, expectedDistribution); }
public void Constructor_ExpectedValues() { // Setup var phreaticLevelExit = new NormalDistribution(3) { Mean = (RoundedDouble)0, StandardDeviation = (RoundedDouble)0.1 }; var dampingFactorExit = new LogNormalDistribution(3) { Mean = (RoundedDouble)0.7, StandardDeviation = (RoundedDouble)0.1 }; // Call var pipingInput = new TestPipingInput(); // Assert Assert.IsInstanceOf <CloneableObservable>(pipingInput); Assert.IsInstanceOf <ICalculationInputWithHydraulicBoundaryLocation>(pipingInput); DistributionAssert.AreEqual(phreaticLevelExit, pipingInput.PhreaticLevelExit); DistributionAssert.AreEqual(dampingFactorExit, pipingInput.DampingFactorExit); Assert.IsNull(pipingInput.SurfaceLine); Assert.IsNull(pipingInput.StochasticSoilModel); Assert.IsNull(pipingInput.StochasticSoilProfile); Assert.IsNull(pipingInput.HydraulicBoundaryLocation); Assert.IsNaN(pipingInput.ExitPointL); Assert.AreEqual(2, pipingInput.ExitPointL.NumberOfDecimalPlaces); Assert.IsNaN(pipingInput.EntryPointL); Assert.AreEqual(2, pipingInput.EntryPointL.NumberOfDecimalPlaces); }
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 TestLogNormalRoundTrip() { // arrange var expected = new LogNormalDistribution(0d, 1d, 0.3, 0.7); // act var serialized = expected.ToString(); var deserialized = Distribution.DeserializeDistribution(serialized); var distribution = deserialized.IfNone(() => { Assert.Fail(); return(default !); });
private static void AssertEffectiveThicknessCoverageLayer(LogNormalDistribution effectiveThicknessCoverageLayer, double mean = double.NaN) { var expected = new LogNormalDistribution(2) { Mean = (RoundedDouble)mean, StandardDeviation = (RoundedDouble)0.5 }; DistributionAssert.AreEqual(expected, effectiveThicknessCoverageLayer); }
private static void AssertThicknessAquiferLayer(LogNormalDistribution thicknessAquiferLayer, double mean = double.NaN) { var expected = new LogNormalDistribution(2) { Mean = (RoundedDouble)mean, StandardDeviation = (RoundedDouble)0.5 }; DistributionAssert.AreEqual(expected, thicknessAquiferLayer); }
public static LogNormalDistribution ByParams(double expectation, double variance) { if (Double.IsInfinity(expectation) || Double.IsNaN(expectation)) throw new ArgumentException("The expectation must be a finite number"); if (variance <= 0 || Double.IsInfinity(expectation) || Double.IsNaN(expectation)) throw new ArgumentException("The variance must be a positive finite number"); LogNormalDistribution distribution = new LogNormalDistribution(); distribution.Expectation = expectation; distribution.Variance = variance; distribution.ComputeInternalParameters(); return distribution; }