Exemple #1
0
        private static IEnumerable <TestCaseData> IncorrectNonShiftedLogNormalDistributionsShift(Func <SoilLayerBase> soilLayer)
        {
            const long validDistributionType = SoilLayerConstants.LogNormalDistributionValue;

            SoilLayerBase invalidCohesionShift = soilLayer();

            invalidCohesionShift.CohesionDistributionType = validDistributionType;
            invalidCohesionShift.CohesionShift            = -1;
            yield return(new TestCaseData(invalidCohesionShift, "Cohesie"));

            SoilLayerBase invalidFrictionAngleShift = soilLayer();

            invalidFrictionAngleShift.FrictionAngleDistributionType = validDistributionType;
            invalidFrictionAngleShift.FrictionAngleShift            = -1;
            yield return(new TestCaseData(invalidFrictionAngleShift, "Wrijvingshoek"));

            SoilLayerBase invalidShearStrengthRatioShift = soilLayer();

            invalidShearStrengthRatioShift.ShearStrengthRatioDistributionType = validDistributionType;
            invalidShearStrengthRatioShift.ShearStrengthRatioShift            = -1;
            yield return(new TestCaseData(invalidShearStrengthRatioShift, "Schuifsterkte ratio (S)"));

            SoilLayerBase invalidStrengthIncreaseExponentShift = soilLayer();

            invalidStrengthIncreaseExponentShift.StrengthIncreaseExponentDistributionType = validDistributionType;
            invalidStrengthIncreaseExponentShift.StrengthIncreaseExponentShift            = -1;
            yield return(new TestCaseData(invalidStrengthIncreaseExponentShift, "Sterkte toename exp (m)"));

            SoilLayerBase invalidPopShift = soilLayer();

            invalidPopShift.PopDistributionType = validDistributionType;
            invalidPopShift.PopShift            = -1;
            yield return(new TestCaseData(invalidPopShift, "POP"));
        }
Exemple #2
0
        private static IEnumerable <TestCaseData> IncorrectNonShiftedLogNormalDistributionsType(Func <SoilLayerBase> soilLayer)
        {
            const double validShift = 0.0;

            SoilLayerBase invalidCohesionDistribution = soilLayer();

            invalidCohesionDistribution.CohesionDistributionType = -1;
            invalidCohesionDistribution.CohesionShift            = validShift;
            yield return(new TestCaseData(invalidCohesionDistribution, "Cohesie"));

            SoilLayerBase invalidFrictionAngleDistribution = soilLayer();

            invalidFrictionAngleDistribution.FrictionAngleDistributionType = -1;
            invalidFrictionAngleDistribution.FrictionAngleShift            = validShift;
            yield return(new TestCaseData(invalidFrictionAngleDistribution, "Wrijvingshoek"));

            SoilLayerBase invalidShearStrengthRatioDistribution = soilLayer();

            invalidShearStrengthRatioDistribution.ShearStrengthRatioDistributionType = -1;
            invalidShearStrengthRatioDistribution.ShearStrengthRatioShift            = validShift;
            yield return(new TestCaseData(invalidShearStrengthRatioDistribution, "Schuifsterkte ratio (S)"));

            SoilLayerBase invalidStrengthIncreaseExponentDistribution = soilLayer();

            invalidStrengthIncreaseExponentDistribution.StrengthIncreaseExponentDistributionType = -1;
            invalidStrengthIncreaseExponentDistribution.StrengthIncreaseExponentShift            = validShift;
            yield return(new TestCaseData(invalidStrengthIncreaseExponentDistribution, "Sterkte toename exp (m)"));

            SoilLayerBase invalidPopDistribution = soilLayer();

            invalidPopDistribution.PopDistributionType = -1;
            invalidPopDistribution.PopShift            = validShift;
            yield return(new TestCaseData(invalidPopDistribution, "POP"));
        }
Exemple #3
0
        private static IEnumerable <TestCaseData> IncorrectShiftedLogNormalDistributions(Func <SoilLayerBase> soilLayer)
        {
            SoilLayerBase invalidBelowPhreaticLevel = soilLayer();

            invalidBelowPhreaticLevel.BelowPhreaticLevelDistributionType = -1;
            yield return(new TestCaseData(invalidBelowPhreaticLevel, "Verzadigd gewicht"));

            SoilLayerBase invalidAbovePhreaticLevel = soilLayer();

            invalidAbovePhreaticLevel.AbovePhreaticLevelDistributionType = -1;
            yield return(new TestCaseData(invalidAbovePhreaticLevel, "Onverzadigd gewicht"));
        }
        /// <summary>
        /// Sets the values of the stochastic parameters for the given <see cref="PipingSoilLayer"/>.
        /// </summary>
        /// <param name="pipingSoilLayer">The <see cref="PipingSoilLayer"/> to set the property values for.</param>
        /// <param name="soilLayer">The <see cref="SoilLayerBase"/> to get the properties from.</param>
        /// <remarks>This method does not perform validation. Use <see cref="ValidateStochasticParameters"/> to
        /// verify whether the distributions for the stochastic parameters are correctly defined.</remarks>
        /// <exception cref="ImportedDataTransformException">Thrown when the stochastic values of <paramref name="pipingSoilLayer"/>
        /// are invalid.</exception>
        private static void SetStochasticParameters(PipingSoilLayer pipingSoilLayer, SoilLayerBase soilLayer)
        {
            pipingSoilLayer.BelowPhreaticLevel = TransformLogNormalDistribution(soilLayer.BelowPhreaticLevelMean,
                                                                                soilLayer.BelowPhreaticLevelDeviation,
                                                                                soilLayer.BelowPhreaticLevelShift,
                                                                                soilLayer.MaterialName,
                                                                                Resources.SoilLayer_BelowPhreaticLevelDistribution_DisplayName);

            pipingSoilLayer.DiameterD70 = TransformVariationCoefficientLogNormalDistribution(soilLayer.DiameterD70Mean,
                                                                                             soilLayer.DiameterD70CoefficientOfVariation,
                                                                                             soilLayer.MaterialName,
                                                                                             Resources.SoilLayer_DiameterD70Distribution_DisplayName);

            pipingSoilLayer.Permeability = TransformVariationCoefficientLogNormalDistribution(soilLayer.PermeabilityMean,
                                                                                              soilLayer.PermeabilityCoefficientOfVariation,
                                                                                              soilLayer.MaterialName,
                                                                                              Resources.SoilLayer_PermeabilityDistribution_DisplayName);
        }
        /// <summary>
        /// Validates whether the values of the distribution and shift for the stochastic parameters
        /// are correct for creating a <see cref="PipingSoilLayer"/>.
        /// </summary>
        /// <exception cref="ImportedDataTransformException">Thrown when any of the distributions of the
        /// stochastic parameters is not defined as lognormal or is shifted when it should not be.</exception>
        private static void ValidateStochasticParameters(SoilLayerBase soilLayer)
        {
            string soilLayerName = soilLayer.MaterialName;

            ValidateStochasticShiftedLogNormalDistributionParameter(soilLayerName,
                                                                    soilLayer.BelowPhreaticLevelDistributionType,
                                                                    Resources.SoilLayer_BelowPhreaticLevelDistribution_DisplayName);

            ValidateStochasticLogNormalDistributionParameter(soilLayerName,
                                                             soilLayer.DiameterD70DistributionType,
                                                             soilLayer.DiameterD70Shift,
                                                             Resources.SoilLayer_DiameterD70Distribution_DisplayName);

            ValidateStochasticLogNormalDistributionParameter(soilLayerName,
                                                             soilLayer.PermeabilityDistributionType,
                                                             soilLayer.PermeabilityShift,
                                                             Resources.SoilLayer_PermeabilityDistribution_DisplayName);
        }
Exemple #6
0
        private static IEnumerable <TestCaseData> InvalidStochasticDistributionValues(Func <SoilLayerBase> soilLayer)
        {
            const double invalidMean = 0;

            SoilLayerBase invalidCohesion = soilLayer();

            invalidCohesion.CohesionMean = invalidMean;
            yield return(new TestCaseData(invalidCohesion, "Cohesie"));

            SoilLayerBase invalidFrictionAngle = soilLayer();

            invalidFrictionAngle.FrictionAngleMean = invalidMean;
            yield return(new TestCaseData(invalidFrictionAngle, "Wrijvingshoek"));

            SoilLayerBase invalidShearStrengthRatio = soilLayer();

            invalidShearStrengthRatio.ShearStrengthRatioMean = invalidMean;
            yield return(new TestCaseData(invalidShearStrengthRatio, "Schuifsterkte ratio (S)"));

            SoilLayerBase invalidStrengthIncreaseExponent = soilLayer();

            invalidStrengthIncreaseExponent.StrengthIncreaseExponentMean = invalidMean;
            yield return(new TestCaseData(invalidStrengthIncreaseExponent, "Sterkte toename exp (m)"));

            SoilLayerBase invalidPop = soilLayer();

            invalidPop.PopMean = invalidMean;
            yield return(new TestCaseData(invalidPop, "POP"));

            const double  validMean    = 1;
            const double  invalidShift = 2;
            SoilLayerBase invalidBelowPhreaticLevel = soilLayer();

            invalidBelowPhreaticLevel.BelowPhreaticLevelMean  = validMean;
            invalidBelowPhreaticLevel.BelowPhreaticLevelShift = invalidShift;
            yield return(new TestCaseData(invalidBelowPhreaticLevel, "Verzadigd gewicht"));

            SoilLayerBase invalidAbovePhreaticLevel = soilLayer();

            invalidAbovePhreaticLevel.AbovePhreaticLevelMean  = validMean;
            invalidAbovePhreaticLevel.AbovePhreaticLevelShift = invalidShift;
            yield return(new TestCaseData(invalidAbovePhreaticLevel, "Onverzadigd gewicht"));
        }
Exemple #7
0
        /// <summary>
        /// Converts <see cref="SoilLayerBase"/> into <see cref="MacroStabilityInwardsSoilLayerData"/>.
        /// </summary>
        /// <param name="soilLayer">The soil layer to get the data from.</param>
        /// <exception cref="ImportedDataTransformException">Thrown when transformation would not result
        /// in a valid transformed instance.</exception>
        private static MacroStabilityInwardsSoilLayerData ConvertSoilLayerData(SoilLayerBase soilLayer)
        {
            string soilLayerName = soilLayer.MaterialName;

            return(new MacroStabilityInwardsSoilLayerData
            {
                ShearStrengthModel = TransformShearStrengthModel(soilLayer.ShearStrengthModel, soilLayerName),
                UsePop = TransformUsePop(soilLayer.UsePop, soilLayerName),
                MaterialName = soilLayerName,
                IsAquifer = TransformIsAquifer(soilLayer.IsAquifer, soilLayerName),
                Color = SoilLayerColorConverter.Convert(soilLayer.Color),
                AbovePhreaticLevel = TransformLogNormalDistribution(soilLayer.AbovePhreaticLevelMean,
                                                                    soilLayer.AbovePhreaticLevelCoefficientOfVariation,
                                                                    soilLayer.AbovePhreaticLevelShift,
                                                                    soilLayerName,
                                                                    Resources.SoilLayerData_AbovePhreaticLevelDistribution_Description),
                BelowPhreaticLevel = TransformLogNormalDistribution(soilLayer.BelowPhreaticLevelMean,
                                                                    soilLayer.BelowPhreaticLevelCoefficientOfVariation,
                                                                    soilLayer.BelowPhreaticLevelShift,
                                                                    soilLayerName,
                                                                    Resources.SoilLayerData_BelowPhreaticLevelDistribution_DisplayName),
                Cohesion = TransformLogNormalDistribution(soilLayer.CohesionMean,
                                                          soilLayer.CohesionCoefficientOfVariation,
                                                          soilLayerName,
                                                          Resources.SoilLayerData_CohesionDistribution_DisplayName),
                FrictionAngle = TransformLogNormalDistribution(soilLayer.FrictionAngleMean,
                                                               soilLayer.FrictionAngleCoefficientOfVariation,
                                                               soilLayerName,
                                                               Resources.SoilLayerData_FrictionAngleDistribution_DisplayName),
                ShearStrengthRatio = TransformLogNormalDistribution(soilLayer.ShearStrengthRatioMean,
                                                                    soilLayer.ShearStrengthRatioCoefficientOfVariation,
                                                                    soilLayerName,
                                                                    Resources.SoilLayerData_ShearStrengthRatioDistribution_DisplayName),
                StrengthIncreaseExponent = TransformLogNormalDistribution(soilLayer.StrengthIncreaseExponentMean,
                                                                          soilLayer.StrengthIncreaseExponentCoefficientOfVariation,
                                                                          soilLayerName,
                                                                          Resources.SoilLayerData_StrengthIncreaseExponentDistribution_DisplayName),
                Pop = TransformLogNormalDistribution(soilLayer.PopMean,
                                                     soilLayer.PopCoefficientOfVariation,
                                                     soilLayerName,
                                                     Resources.SoilLayerData_PopDistribution_DisplayName)
            });
        }
Exemple #8
0
        /// <summary>
        /// Validates whether the values of the distribution and shift for the stochastic parameters
        /// are correct for creating a soil layer.
        /// </summary>
        /// <param name="soilLayer">The soil layer to validate.</param>
        /// <exception cref="ImportedDataTransformException">Thrown when any of the distributions of the
        /// stochastic parameters is not defined as log normal or is shifted when it should not be.</exception>
        private static void ValidateStochasticParameters(SoilLayerBase soilLayer)
        {
            string soilLayerName = soilLayer.MaterialName;

            ValidateStochasticShiftedLogNormalDistributionParameter(soilLayerName,
                                                                    soilLayer.AbovePhreaticLevelDistributionType,
                                                                    Resources.SoilLayerData_AbovePhreaticLevelDistribution_Description);

            ValidateStochasticShiftedLogNormalDistributionParameter(soilLayerName,
                                                                    soilLayer.BelowPhreaticLevelDistributionType,
                                                                    Resources.SoilLayerData_BelowPhreaticLevelDistribution_DisplayName);

            ValidateStochasticLogNormalDistributionParameter(soilLayerName,
                                                             soilLayer.CohesionDistributionType,
                                                             soilLayer.CohesionShift,
                                                             Resources.SoilLayerData_CohesionDistribution_DisplayName);

            ValidateStochasticLogNormalDistributionParameter(soilLayerName,
                                                             soilLayer.FrictionAngleDistributionType,
                                                             soilLayer.FrictionAngleShift,
                                                             Resources.SoilLayerData_FrictionAngleDistribution_DisplayName);

            ValidateStochasticLogNormalDistributionParameter(soilLayerName,
                                                             soilLayer.ShearStrengthRatioDistributionType,
                                                             soilLayer.ShearStrengthRatioShift,
                                                             Resources.SoilLayerData_ShearStrengthRatioDistribution_DisplayName);

            ValidateStochasticLogNormalDistributionParameter(soilLayerName,
                                                             soilLayer.StrengthIncreaseExponentDistributionType,
                                                             soilLayer.StrengthIncreaseExponentShift,
                                                             Resources.SoilLayerData_StrengthIncreaseExponentDistribution_DisplayName);

            ValidateStochasticLogNormalDistributionParameter(soilLayerName,
                                                             soilLayer.PopDistributionType,
                                                             soilLayer.PopShift,
                                                             Resources.SoilLayerData_PopDistribution_DisplayName);
        }