Index: Riskeer/Piping/src/Riskeer.Piping.Forms/PropertyClasses/SemiProbabilistic/SemiProbabilisticPipingInputContextProperties.cs =================================================================== diff -u -rda4400b6eb2326e3e04089607658b020f9be28f6 -ree690d9aaeeaf5c5cf1919fa02f04fc8667a2e9f --- Riskeer/Piping/src/Riskeer.Piping.Forms/PropertyClasses/SemiProbabilistic/SemiProbabilisticPipingInputContextProperties.cs (.../SemiProbabilisticPipingInputContextProperties.cs) (revision da4400b6eb2326e3e04089607658b020f9be28f6) +++ Riskeer/Piping/src/Riskeer.Piping.Forms/PropertyClasses/SemiProbabilistic/SemiProbabilisticPipingInputContextProperties.cs (.../SemiProbabilisticPipingInputContextProperties.cs) (revision ee690d9aaeeaf5c5cf1919fa02f04fc8667a2e9f) @@ -132,6 +132,20 @@ return !data.WrappedData.UseAssessmentLevelManualInput; } + if (propertyName == nameof(ThicknessCoverageLayerDeterminist) + || propertyName == nameof(EffectiveThicknessCoverageLayerDeterminist) + || propertyName == nameof(SaturatedVolumicWeightOfCoverageLayerDeterminist)) + { + return double.IsNaN(DerivedPipingInput.GetThicknessCoverageLayer(data.WrappedData).Mean); + } + + if (propertyName == nameof(ThicknessCoverageLayerDistribution) + || propertyName == nameof(EffectiveThicknessCoverageLayerDistribution) + || propertyName == nameof(SaturatedVolumicWeightOfCoverageLayerDistribution)) + { + return !double.IsNaN(DerivedPipingInput.GetThicknessCoverageLayer(data.WrappedData).Mean); + } + return false; } @@ -404,12 +418,13 @@ } } + [DynamicVisible] [PropertyOrder(thicknessCoverageLayerPropertyIndex)] [TypeConverter(typeof(ExpandableObjectConverter))] [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_Schematization))] [ResourcesDisplayName(typeof(Resources), nameof(Resources.PipingInput_ThicknessCoverageLayer_DisplayName))] [ResourcesDescription(typeof(Resources), nameof(Resources.PipingInput_ThicknessCoverageLayer_Description))] - public LogNormalDistributionDesignVariableProperties ThicknessCoverageLayer + public LogNormalDistributionDesignVariableProperties ThicknessCoverageLayerDistribution { get { @@ -418,12 +433,26 @@ } } + [DynamicVisible] + [PropertyOrder(thicknessCoverageLayerPropertyIndex)] + [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_Schematization))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.PipingInput_ThicknessCoverageLayer_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.PipingInput_ThicknessCoverageLayer_Description))] + public RoundedDouble ThicknessCoverageLayerDeterminist + { + get + { + return new RoundedDouble(2); + } + } + + [DynamicVisible] [PropertyOrder(effectiveThicknessCoverageLayerPropertyIndex)] [TypeConverter(typeof(ExpandableObjectConverter))] [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_Schematization))] [ResourcesDisplayName(typeof(Resources), nameof(Resources.PipingInput_EffectiveThicknessCoverageLayer_DisplayName))] [ResourcesDescription(typeof(Resources), nameof(Resources.PipingInput_EffectiveThicknessCoverageLayer_Description))] - public LogNormalDistributionDesignVariableProperties EffectiveThicknessCoverageLayer + public LogNormalDistributionDesignVariableProperties EffectiveThicknessCoverageLayerDistribution { get { @@ -433,6 +462,19 @@ } } + [DynamicVisible] + [PropertyOrder(effectiveThicknessCoverageLayerPropertyIndex)] + [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_Schematization))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.PipingInput_EffectiveThicknessCoverageLayer_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.PipingInput_EffectiveThicknessCoverageLayer_Description))] + public RoundedDouble EffectiveThicknessCoverageLayerDeterminist + { + get + { + return new RoundedDouble(2); + } + } + [PropertyOrder(thicknessAquiferLayerPropertyIndex)] [TypeConverter(typeof(ExpandableObjectConverter))] [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_Schematization))] @@ -475,12 +517,13 @@ } } + [DynamicVisible] [PropertyOrder(saturatedVolumicWeightOfCoverageLayerPropertyIndex)] [TypeConverter(typeof(ExpandableObjectConverter))] [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_Schematization))] [ResourcesDisplayName(typeof(Resources), nameof(Resources.PipingInput_SaturatedVolumicWeightOfCoverageLayer_DisplayName))] [ResourcesDescription(typeof(Resources), nameof(Resources.PipingInput_SaturatedVolumicWeightOfCoverageLayer_Description))] - public ShiftedLogNormalDistributionDesignVariableProperties SaturatedVolumicWeightOfCoverageLayer + public ShiftedLogNormalDistributionDesignVariableProperties SaturatedVolumicWeightOfCoverageLayerDistribution { get { @@ -489,6 +532,19 @@ } } + [DynamicVisible] + [PropertyOrder(saturatedVolumicWeightOfCoverageLayerPropertyIndex)] + [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_Schematization))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.PipingInput_SaturatedVolumicWeightOfCoverageLayer_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.PipingInput_SaturatedVolumicWeightOfCoverageLayer_Description))] + public RoundedDouble SaturatedVolumicWeightOfCoverageLayerDeterminist + { + get + { + return new RoundedDouble(2); + } + } + #endregion } } \ No newline at end of file Index: Riskeer/Piping/test/Riskeer.Piping.Forms.Test/PropertyClasses/SemiProbabilistic/SemiProbabilisticPipingInputContextPropertiesTest.cs =================================================================== diff -u -r7b606c8a78b5f95a2f303202cbc314a730ecb6d4 -ree690d9aaeeaf5c5cf1919fa02f04fc8667a2e9f --- Riskeer/Piping/test/Riskeer.Piping.Forms.Test/PropertyClasses/SemiProbabilistic/SemiProbabilisticPipingInputContextPropertiesTest.cs (.../SemiProbabilisticPipingInputContextPropertiesTest.cs) (revision 7b606c8a78b5f95a2f303202cbc314a730ecb6d4) +++ Riskeer/Piping/test/Riskeer.Piping.Forms.Test/PropertyClasses/SemiProbabilistic/SemiProbabilisticPipingInputContextPropertiesTest.cs (.../SemiProbabilisticPipingInputContextPropertiesTest.cs) (revision ee690d9aaeeaf5c5cf1919fa02f04fc8667a2e9f) @@ -193,13 +193,13 @@ TestHelper.AssertTypeConverter( nameof(SemiProbabilisticPipingInputContextProperties.SeepageLength)); - Assert.IsInstanceOf(properties.ThicknessCoverageLayer); + Assert.IsInstanceOf(properties.ThicknessCoverageLayerDistribution); TestHelper.AssertTypeConverter( - nameof(SemiProbabilisticPipingInputContextProperties.ThicknessCoverageLayer)); + nameof(SemiProbabilisticPipingInputContextProperties.ThicknessCoverageLayerDistribution)); - Assert.IsInstanceOf(properties.EffectiveThicknessCoverageLayer); + Assert.IsInstanceOf(properties.EffectiveThicknessCoverageLayerDistribution); TestHelper.AssertTypeConverter( - nameof(SemiProbabilisticPipingInputContextProperties.EffectiveThicknessCoverageLayer)); + nameof(SemiProbabilisticPipingInputContextProperties.EffectiveThicknessCoverageLayerDistribution)); Assert.IsInstanceOf(properties.ThicknessAquiferLayer); TestHelper.AssertTypeConverter( @@ -213,25 +213,29 @@ TestHelper.AssertTypeConverter( nameof(SemiProbabilisticPipingInputContextProperties.Diameter70)); - Assert.IsInstanceOf(properties.SaturatedVolumicWeightOfCoverageLayer); + Assert.IsInstanceOf(properties.SaturatedVolumicWeightOfCoverageLayerDistribution); TestHelper.AssertTypeConverter( - nameof(SemiProbabilisticPipingInputContextProperties.SaturatedVolumicWeightOfCoverageLayer)); + nameof(SemiProbabilisticPipingInputContextProperties.SaturatedVolumicWeightOfCoverageLayerDistribution)); mocks.VerifyAll(); } [Test] - public void Constructor_ValidData_PropertiesHaveExpectedAttributesValues() + [TestCase(true)] + [TestCase(false)] + public void Constructor_ValidDataWithOrWithoutCoverageLayer_PropertiesHaveExpectedAttributesValues(bool withCoverageLayer) { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub(); mocks.ReplayAll(); - var calculation = new SemiProbabilisticPipingCalculationScenario(); var failureMechanism = new PipingFailureMechanism(); + var calculation = new SemiProbabilisticPipingCalculationScenario(); - var context = new SemiProbabilisticPipingInputContext(calculation.InputParameters, + var context = new SemiProbabilisticPipingInputContext(withCoverageLayer + ? PipingInputFactory.CreateInputWithAquiferAndCoverageLayer() + : calculation.InputParameters, calculation, Enumerable.Empty(), Enumerable.Empty(), @@ -341,17 +345,33 @@ "Totale deklaagdikte bij uittredepunt [m]", "Totale deklaagdikte bij uittredepunt.", true); - Assert.IsInstanceOf(thicknessCoverageLayerProperty.Converter); + if (withCoverageLayer) + { + Assert.IsInstanceOf(thicknessCoverageLayerProperty.Converter); + } + else + { + Assert.IsNotInstanceOf(thicknessCoverageLayerProperty.Converter); + } + PropertyDescriptor effectiveThicknessCoverageLayerProperty = dynamicProperties[expectedEffectiveThicknessCoverageLayerPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( effectiveThicknessCoverageLayerProperty, schematizationCategory, "Effectieve deklaagdikte bij uittredepunt [m]", "Effectieve deklaagdikte bij uittredepunt.", true); - Assert.IsInstanceOf(effectiveThicknessCoverageLayerProperty.Converter); + if (withCoverageLayer) + { + Assert.IsInstanceOf(effectiveThicknessCoverageLayerProperty.Converter); + } + else + { + Assert.IsNotInstanceOf(effectiveThicknessCoverageLayerProperty.Converter); + } + PropertyDescriptor thicknessAquiferLayerProperty = dynamicProperties[expectedThicknessAquiferLayerPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( thicknessAquiferLayerProperty, @@ -386,8 +406,16 @@ "Verzadigd gewicht deklaag [kN/m³]", "Verzadigd gewicht deklaag.", true); - Assert.IsInstanceOf(saturatedVolumicWeightOfCoverageLayerProperty.Converter); + if (withCoverageLayer) + { + Assert.IsInstanceOf(saturatedVolumicWeightOfCoverageLayerProperty.Converter); + } + else + { + Assert.IsNotInstanceOf(saturatedVolumicWeightOfCoverageLayerProperty.Converter); + } + mocks.VerifyAll(); } @@ -585,14 +613,18 @@ Assert.AreEqual(inputParameters.DampingFactorExit.Mean, properties.DampingFactorExit.Mean); Assert.AreEqual(inputParameters.DampingFactorExit.StandardDeviation, properties.DampingFactorExit.StandardDeviation); - LogNormalDistribution thicknessCoverageLayer = DerivedPipingInput.GetThicknessCoverageLayer(inputParameters); - Assert.AreEqual(thicknessCoverageLayer.Mean, properties.ThicknessCoverageLayer.Mean); - Assert.AreEqual(thicknessCoverageLayer.StandardDeviation, properties.ThicknessCoverageLayer.StandardDeviation); + LogNormalDistribution thicknessCoverageLayerDistribution = DerivedPipingInput.GetThicknessCoverageLayer(inputParameters); + Assert.AreEqual(thicknessCoverageLayerDistribution.Mean, properties.ThicknessCoverageLayerDistribution.Mean); + Assert.AreEqual(thicknessCoverageLayerDistribution.StandardDeviation, properties.ThicknessCoverageLayerDistribution.StandardDeviation); - LogNormalDistribution effectiveThicknessCoverageLayer = DerivedPipingInput.GetEffectiveThicknessCoverageLayer(inputParameters, new GeneralPipingInput()); - Assert.AreEqual(effectiveThicknessCoverageLayer.Mean, properties.EffectiveThicknessCoverageLayer.Mean); - Assert.AreEqual(effectiveThicknessCoverageLayer.StandardDeviation, properties.EffectiveThicknessCoverageLayer.StandardDeviation); + Assert.AreEqual(0, properties.ThicknessCoverageLayerDeterminist, properties.ThicknessCoverageLayerDeterminist.GetAccuracy()); + LogNormalDistribution effectiveThicknessCoverageLayerDistribution = DerivedPipingInput.GetEffectiveThicknessCoverageLayer(inputParameters, new GeneralPipingInput()); + Assert.AreEqual(effectiveThicknessCoverageLayerDistribution.Mean, properties.EffectiveThicknessCoverageLayerDistribution.Mean); + Assert.AreEqual(effectiveThicknessCoverageLayerDistribution.StandardDeviation, properties.EffectiveThicknessCoverageLayerDistribution.StandardDeviation); + + Assert.AreEqual(0, properties.EffectiveThicknessCoverageLayerDeterminist, properties.EffectiveThicknessCoverageLayerDeterminist.GetAccuracy()); + VariationCoefficientLogNormalDistribution diameterD70 = DerivedPipingInput.GetDiameterD70(inputParameters); Assert.AreEqual(diameterD70.Mean, properties.Diameter70.Mean); Assert.AreEqual(diameterD70.CoefficientOfVariation, properties.Diameter70.CoefficientOfVariation); @@ -605,14 +637,16 @@ Assert.AreEqual(thicknessAquiferLayer.Mean, properties.ThicknessAquiferLayer.Mean); Assert.AreEqual(thicknessAquiferLayer.StandardDeviation, properties.ThicknessAquiferLayer.StandardDeviation); - LogNormalDistribution saturatedVolumicWeightOfCoverageLayer = DerivedPipingInput.GetSaturatedVolumicWeightOfCoverageLayer(inputParameters); - Assert.AreEqual(saturatedVolumicWeightOfCoverageLayer.Mean, - properties.SaturatedVolumicWeightOfCoverageLayer.Mean); - Assert.AreEqual(saturatedVolumicWeightOfCoverageLayer.StandardDeviation, - properties.SaturatedVolumicWeightOfCoverageLayer.StandardDeviation); - Assert.AreEqual(saturatedVolumicWeightOfCoverageLayer.Shift, - properties.SaturatedVolumicWeightOfCoverageLayer.Shift); + LogNormalDistribution saturatedVolumicWeightOfCoverageLayerDistribution = DerivedPipingInput.GetSaturatedVolumicWeightOfCoverageLayer(inputParameters); + Assert.AreEqual(saturatedVolumicWeightOfCoverageLayerDistribution.Mean, + properties.SaturatedVolumicWeightOfCoverageLayerDistribution.Mean); + Assert.AreEqual(saturatedVolumicWeightOfCoverageLayerDistribution.StandardDeviation, + properties.SaturatedVolumicWeightOfCoverageLayerDistribution.StandardDeviation); + Assert.AreEqual(saturatedVolumicWeightOfCoverageLayerDistribution.Shift, + properties.SaturatedVolumicWeightOfCoverageLayerDistribution.Shift); + Assert.AreEqual(0, properties.SaturatedVolumicWeightOfCoverageLayerDeterminist, properties.SaturatedVolumicWeightOfCoverageLayerDeterminist.GetAccuracy()); + RoundedDouble expectedAssessmentLevel = useManualAssessmentLevelInput ? inputParameters.AssessmentLevel : AssessmentSectionTestHelper.GetTestAssessmentLevel(); @@ -1834,6 +1868,43 @@ } [Test] + [TestCase(true)] + [TestCase(false)] + public void DynamicVisibleValidationMethod_CoverageLayerDependentProperties_DependsOnHavingCoverageLayerOrNot(bool withCoverageLayer) + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + var handler = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new PipingFailureMechanism(); + + var calculation = new SemiProbabilisticPipingCalculationScenario(); + + var context = new SemiProbabilisticPipingInputContext(withCoverageLayer + ? PipingInputFactory.CreateInputWithAquiferAndCoverageLayer() + : calculation.InputParameters, + calculation, + Enumerable.Empty(), + Enumerable.Empty(), + failureMechanism, + assessmentSection); + + var properties = new SemiProbabilisticPipingInputContextProperties(context, + AssessmentSectionTestHelper.GetTestAssessmentLevel, + handler); + + // Call & Assert + Assert.AreEqual(withCoverageLayer, properties.DynamicVisibleValidationMethod(nameof(properties.ThicknessCoverageLayerDistribution))); + Assert.AreEqual(!withCoverageLayer, properties.DynamicVisibleValidationMethod(nameof(properties.ThicknessCoverageLayerDeterminist))); + Assert.AreEqual(withCoverageLayer, properties.DynamicVisibleValidationMethod(nameof(properties.EffectiveThicknessCoverageLayerDistribution))); + Assert.AreEqual(!withCoverageLayer, properties.DynamicVisibleValidationMethod(nameof(properties.EffectiveThicknessCoverageLayerDeterminist))); + Assert.AreEqual(withCoverageLayer, properties.DynamicVisibleValidationMethod(nameof(properties.SaturatedVolumicWeightOfCoverageLayerDistribution))); + Assert.AreEqual(!withCoverageLayer, properties.DynamicVisibleValidationMethod(nameof(properties.SaturatedVolumicWeightOfCoverageLayerDeterminist))); + } + + [Test] public void DynamicVisibleValidationMethod_AnyOtherProperty_ReturnsFalse() { // Setup