Ejemplo n.º 1
0
        private static void AssertPercentile <T>(double percentile, DesignVariable <T> designVariable) where T : IDistribution
        {
            Assert.IsInstanceOf <PercentileBasedDesignVariable <T> >(designVariable);
            var percentileBasedDesignVariable = (PercentileBasedDesignVariable <T>)designVariable;

            Assert.AreEqual(percentile, percentileBasedDesignVariable.Percentile);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a new <see cref="DesignVariableProperties{TDistribution}"/>.
 /// </summary>
 /// <param name="readOnlyProperties">Indicates which properties, if any, should be marked as read-only.</param>
 /// <param name="designVariable">The data of the <see cref="TDistribution"/> to create the properties for.</param>
 /// <param name="handler">The handler responsible for handling effects of a property change.</param>
 /// <exception cref="ArgumentNullException">Thrown when <paramref name="designVariable"/> is <c>null</c>.</exception>
 /// <exception cref="ArgumentException">Thrown when any number of properties in this class is editable and the
 /// <paramref name="handler"/> is <c>null</c>.</exception>
 protected DesignVariableProperties(DistributionReadOnlyProperties readOnlyProperties,
                                    DesignVariable <TDistribution> designVariable,
                                    IObservablePropertyChangeHandler handler)
     : base(readOnlyProperties, GetDistribution(designVariable), handler)
 {
     DesignVariable = designVariable;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates a new <see cref="LogNormalDistributionDesignVariableProperties"/>.
 /// </summary>
 /// <param name="readOnlyProperties">Indicates which properties, if any, should be marked as read-only.</param>
 /// <param name="designVariable">The <see cref="DesignVariable{T}"/> to create the properties for.</param>
 /// <param name="handler">The handler responsible for handling effects of a property change.</param>
 /// <exception cref="ArgumentNullException">Thrown when <paramref name="designVariable"/> is <c>null</c>.</exception>
 /// <exception cref="ArgumentException">Thrown when any number of properties in this class is editable and the
 /// <paramref name="handler"/> is <c>null</c>.</exception>
 public LogNormalDistributionDesignVariableProperties(DistributionReadOnlyProperties readOnlyProperties,
                                                      DesignVariable <LogNormalDistribution> designVariable,
                                                      IObservablePropertyChangeHandler handler)
     : base(readOnlyProperties,
            designVariable,
            handler)
 {
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Gets the <see cref="TDistribution"/> of the <see cref="DesignVariable{T}"/>.
        /// </summary>
        /// <param name="designVariable">The design variable to get the distribution from.</param>
        /// <returns>The distribution of the design variable.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="designVariable"/>
        /// is <c>null</c>.</exception>
        private static TDistribution GetDistribution(DesignVariable <TDistribution> designVariable)
        {
            if (designVariable == null)
            {
                throw new ArgumentNullException(nameof(designVariable));
            }

            return(designVariable.Distribution);
        }
Ejemplo n.º 5
0
        public void GetPhreaticLevelExit_ValidPipingInput_CreateDesignVariableForPhreaticLevelExit()
        {
            // Setup
            var pipingInput = new TestPipingInput();

            // Call
            DesignVariable <NormalDistribution> phreaticLevelExit = PipingDesignVariableFactory.GetPhreaticLevelExit(pipingInput);

            // Assert
            Assert.AreSame(pipingInput.PhreaticLevelExit, phreaticLevelExit.Distribution);
            AssertPercentile(0.05, phreaticLevelExit);
        }
        public void GetThicknessAquiferLayer_ValidPipingInput_CreateDesignVariableForThicknessAquiferLayer()
        {
            // Setup
            var pipingInput = new TestPipingInput();

            // Call
            DesignVariable <LogNormalDistribution> thicknessAquiferLayer =
                SemiProbabilisticPipingDesignVariableFactory.GetThicknessAquiferLayer(pipingInput);

            // Assert
            DistributionAssert.AreEqual(DerivedPipingInput.GetThicknessAquiferLayer(pipingInput), thicknessAquiferLayer.Distribution);
            AssertPercentile(0.95, thicknessAquiferLayer);
        }
        public void GetDampingFactorExit_ValidPipingInput_CreateDesignVariableForDampingFactorExit()
        {
            // Setup
            var pipingInput = new TestPipingInput();

            // Call
            DesignVariable <LogNormalDistribution> dampingFactorExit =
                SemiProbabilisticPipingDesignVariableFactory.GetDampingFactorExit(pipingInput);

            // Assert
            Assert.AreSame(pipingInput.DampingFactorExit, dampingFactorExit.Distribution);
            AssertPercentile(0.95, dampingFactorExit);
        }
        public void GetThicknessCoverageLayer_PipingInputWithoutCoverLayer_CreateDeterministicDesignVariableForThicknessCoverageLayer()
        {
            // Setup
            var pipingInput = new TestPipingInput();

            // Call
            DesignVariable <LogNormalDistribution> thicknessCoverageLayer = SemiProbabilisticPipingDesignVariableFactory.GetThicknessCoverageLayer(pipingInput);

            // Assert
            Assert.IsInstanceOf <DeterministicDesignVariable <LogNormalDistribution> >(thicknessCoverageLayer);
            DistributionAssert.AreEqual(DerivedPipingInput.GetThicknessCoverageLayer(pipingInput), thicknessCoverageLayer.Distribution);
            Assert.AreEqual(new RoundedDouble(2), thicknessCoverageLayer.GetDesignValue());
        }
        public void GetThicknessCoverageLayer_PipingInputWithCoverLayer_CreatePercentileBasedDesignVariableForThicknessCoverageLayer()
        {
            // Setup
            PipingInput pipingInput = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer <TestPipingInput>();

            // Call
            DesignVariable <LogNormalDistribution> thicknessCoverageLayer = SemiProbabilisticPipingDesignVariableFactory.GetThicknessCoverageLayer(pipingInput);

            // Assert
            Assert.IsInstanceOf <PercentileBasedDesignVariable <LogNormalDistribution> >(thicknessCoverageLayer);
            DistributionAssert.AreEqual(DerivedPipingInput.GetThicknessCoverageLayer(pipingInput), thicknessCoverageLayer.Distribution);
            AssertPercentile(0.05, thicknessCoverageLayer);
        }
        public void GetSaturatedVolumicWeightOfCoverageLayer_PipingInputWithCoverLayerWithSaturatedDefinition_CreateDesignVariableForSaturatedVolumicWeightOfCoverageLayer()
        {
            // Setup
            PipingInput pipingInput = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer <TestPipingInput>();

            pipingInput.StochasticSoilProfile.SoilProfile.Layers.First().BelowPhreaticLevel = new LogNormalDistribution
            {
                Mean = (RoundedDouble)3.2
            };

            // Call
            DesignVariable <LogNormalDistribution> saturatedVolumicWeightOfCoverageLayer =
                SemiProbabilisticPipingDesignVariableFactory.GetSaturatedVolumicWeightOfCoverageLayer(pipingInput);

            // Assert
            DistributionAssert.AreEqual(DerivedPipingInput.GetSaturatedVolumicWeightOfCoverageLayer(pipingInput),
                                        saturatedVolumicWeightOfCoverageLayer.Distribution);
            AssertPercentile(0.05, saturatedVolumicWeightOfCoverageLayer);
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Creates a new read-only <see cref="LogNormalDistributionDesignVariableProperties"/>.
 /// </summary>
 /// <param name="designVariable">The <see cref="DesignVariable{T}"/> to create the properties for.</param>
 /// <exception cref="ArgumentNullException">Thrown when <paramref name="designVariable"/> is <c>null</c>.</exception>
 public LogNormalDistributionDesignVariableProperties(DesignVariable <LogNormalDistribution> designVariable)
     : this(DistributionReadOnlyProperties.All, designVariable, null)
 {
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Creates a new read-only <see cref="ShiftedLogNormalDistributionDesignVariableProperties"/>.
 /// </summary>
 /// <param name="designVariable">The <see cref="DesignVariable{T}"/> to create the properties for.</param>
 /// <exception cref="ArgumentNullException">Thrown when <paramref name="designVariable"/> is <c>null</c>.</exception>
 public ShiftedLogNormalDistributionDesignVariableProperties(DesignVariable <LogNormalDistribution> designVariable)
     : base(designVariable)
 {
 }