Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsInputContextProperties.cs
===================================================================
diff -u -r1ff2522d2926fb866808be62c4bb25540bd30f33 -ra34dbc4a2d6b3689cde30ea81370912cdaa858ce
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsInputContextProperties.cs (.../GrassCoverErosionInwardsInputContextProperties.cs) (revision 1ff2522d2926fb866808be62c4bb25540bd30f33)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsInputContextProperties.cs (.../GrassCoverErosionInwardsInputContextProperties.cs) (revision a34dbc4a2d6b3689cde30ea81370912cdaa858ce)
@@ -152,6 +152,24 @@
}
}
+ [PropertyOrder(calculateDikeHeightPropertyIndex)]
+ [ResourcesCategory(typeof(Resources), "Categories_Schematisation")]
+ [ResourcesDisplayName(typeof(Resources), "CalculateDikeHeight_DisplayName")]
+ [ResourcesDescription(typeof(Resources), "CalculateDikeHeight_Description")]
+ public bool CalculateDikeHeight
+ {
+ get
+ {
+ return data.WrappedData.CalculateDikeHeight;
+ }
+ set
+ {
+ data.WrappedData.CalculateDikeHeight = value;
+ data.WrappedData.NotifyObservers();
+ }
+ }
+
+
[PropertyOrder(criticalFlowRatePropertyIndex)]
[TypeConverter(typeof(ExpandableObjectConverter))]
[ResourcesCategory(typeof(Resources), "Categories_CriticalValues")]
@@ -186,23 +204,6 @@
}
}
- [PropertyOrder(calculateDikeHeightPropertyIndex)]
- [ResourcesCategory(typeof(Resources), "Categories_Schematisation")]
- [ResourcesDisplayName(typeof(Resources), "CalculateDikeHeight_DisplayName")]
- [ResourcesDescription(typeof(Resources), "CalculateDikeHeight_Description")]
- public bool CalculateDikeHeight
- {
- get
- {
- return data.WrappedData.CalculateDikeHeight;
- }
- set
- {
- data.WrappedData.CalculateDikeHeight = value;
- data.WrappedData.NotifyObservers();
- }
- }
-
[DynamicReadOnlyValidationMethod]
public bool DynamicReadOnlyValidationMethod(string propertyName)
{
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsCalculationActivity.cs
===================================================================
diff -u -r686a257dd8e21e34a52b265f85ef4ac4e11e44a3 -ra34dbc4a2d6b3689cde30ea81370912cdaa858ce
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsCalculationActivity.cs (.../GrassCoverErosionInwardsCalculationActivity.cs) (revision 686a257dd8e21e34a52b265f85ef4ac4e11e44a3)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsCalculationActivity.cs (.../GrassCoverErosionInwardsCalculationActivity.cs) (revision a34dbc4a2d6b3689cde30ea81370912cdaa858ce)
@@ -73,6 +73,7 @@
PerformRun(() => GrassCoverErosionInwardsCalculationService.Validate(calculation, assessmentSection),
() => calculation.ClearOutput(),
() => GrassCoverErosionInwardsCalculationService.Calculate(calculation,
+ assessmentSection,
hlcdDirectory,
failureMechanismSection,
failureMechanismSection.Name, // TODO: Provide name of reference line instead
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsCalculationService.cs
===================================================================
diff -u -rdf02e9274a94d8763da204833a4d93f984e242c6 -ra34dbc4a2d6b3689cde30ea81370912cdaa858ce
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsCalculationService.cs (.../GrassCoverErosionInwardsCalculationService.cs) (revision df02e9274a94d8763da204833a4d93f984e242c6)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsCalculationService.cs (.../GrassCoverErosionInwardsCalculationService.cs) (revision a34dbc4a2d6b3689cde30ea81370912cdaa858ce)
@@ -28,6 +28,7 @@
using Ringtoets.GrassCoverErosionInwards.Data;
using Ringtoets.GrassCoverErosionInwards.Service.Properties;
using Ringtoets.HydraRing.Calculation.Data;
+using Ringtoets.HydraRing.Calculation.Data.Input.Hydraulics;
using Ringtoets.HydraRing.Calculation.Data.Input.Overtopping;
using Ringtoets.HydraRing.Calculation.Data.Output;
using Ringtoets.HydraRing.Calculation.Parsers;
@@ -61,18 +62,22 @@
/// if the calculation was successful. Error and status information is logged during the execution of the operation.
///
/// The that holds all the information required to perform the calculation.
+ /// The that holds information about the norm used in the calculation.
/// The directory of the HLCD file that should be used for performing the calculation.
/// The to create input with.
/// The id of the ring to perform the calculation for.
/// Calculation input parameters that apply to all instances.
/// A on a successful calculation, null otherwise.
internal static GrassCoverErosionInwardsCalculationServiceOutput Calculate(GrassCoverErosionInwardsCalculation calculation,
- string hlcdDirectory, FailureMechanismSection failureMechanismSection,
- string ringId, GeneralGrassCoverErosionInwardsInput generalInput)
+ IAssessmentSection assessmentSection,
+ string hlcdDirectory, FailureMechanismSection failureMechanismSection,
+ string ringId, GeneralGrassCoverErosionInwardsInput generalInput)
{
- OvertoppingCalculationInput input = CreateInput(calculation, failureMechanismSection, generalInput);
+ OvertoppingCalculationInput overtoppingCalculationInput = CreateOvertoppingInput(calculation, failureMechanismSection, generalInput);
var exceedanceProbabilityCalculationParser = new ExceedanceProbabilityCalculationParser();
var waveHeightCalculationParser = new WaveHeightCalculationParser();
+ var targetProbabiltyCalculationParser = new TargetProbabilityCalculationParser();
+ var calculateDikeHeight = calculation.InputParameters.CalculateDikeHeight;
CalculationServiceHelper.PerformCalculation(
calculation.Name,
@@ -83,53 +88,101 @@
ringId,
HydraRingTimeIntegrationSchemeType.FerryBorgesCastanheta,
HydraRingUncertaintiesType.All,
- input,
+ overtoppingCalculationInput,
new IHydraRingFileParser[]
{
exceedanceProbabilityCalculationParser,
waveHeightCalculationParser
});
- VerifyOutput(exceedanceProbabilityCalculationParser.Output, waveHeightCalculationParser.Output, calculation.Name);
+ VerifyOvertoppingCalculationOutput(exceedanceProbabilityCalculationParser.Output, waveHeightCalculationParser.Output, calculation.Name);
+
+ if (calculateDikeHeight)
+ {
+ DikeHeightCalculationInput dikeHeightCalculationInput = CreateDikeHeightInput(calculation, assessmentSection, failureMechanismSection, generalInput);
+
+ HydraRingCalculationService.PerformCalculation(
+ hlcdDirectory,
+ ringId,
+ HydraRingTimeIntegrationSchemeType.FerryBorgesCastanheta,
+ HydraRingUncertaintiesType.All,
+ dikeHeightCalculationInput,
+ new IHydraRingFileParser[]
+ {
+ targetProbabiltyCalculationParser
+ });
+
+ VerifyDikeHeightCalculationOutput(targetProbabiltyCalculationParser.Output, calculation.Name);
+ }
});
- if (exceedanceProbabilityCalculationParser.Output == null || waveHeightCalculationParser.Output == null)
+ if (exceedanceProbabilityCalculationParser.Output != null && waveHeightCalculationParser.Output != null)
{
- return null;
+ if (!calculateDikeHeight || (calculateDikeHeight && targetProbabiltyCalculationParser.Output == null))
+ {
+ return new GrassCoverErosionInwardsCalculationServiceOutput(
+ exceedanceProbabilityCalculationParser.Output.Beta,
+ waveHeightCalculationParser.Output.WaveHeight,
+ waveHeightCalculationParser.Output.IsOvertoppingDominant);
+ }
+
+ if (calculateDikeHeight && targetProbabiltyCalculationParser.Output != null)
+ {
+ return new GrassCoverErosionInwardsCalculationServiceOutput(
+ exceedanceProbabilityCalculationParser.Output.Beta,
+ waveHeightCalculationParser.Output.WaveHeight,
+ waveHeightCalculationParser.Output.IsOvertoppingDominant,
+ targetProbabiltyCalculationParser.Output.Result);
+ }
}
- return new GrassCoverErosionInwardsCalculationServiceOutput(
- exceedanceProbabilityCalculationParser.Output.Beta,
- waveHeightCalculationParser.Output.WaveHeight,
- waveHeightCalculationParser.Output.IsOvertoppingDominant);
+ return null;
}
- private static void VerifyOutput(ExceedanceProbabilityCalculationOutput exceedanceOutput, WaveHeightCalculationOutput waveHeightOutput, string name)
+ private static void VerifyOvertoppingCalculationOutput(ExceedanceProbabilityCalculationOutput exceedanceOutput, WaveHeightCalculationOutput waveHeightOutput, string name)
{
if (exceedanceOutput == null || waveHeightOutput == null)
{
log.ErrorFormat(Resources.GrassCoverErosionInwardsCalculationService_Calculate_Error_in_grass_cover_erosion_inwards_0_calculation, name);
}
}
+ private static void VerifyDikeHeightCalculationOutput(TargetProbabilityCalculationOutput output, string name)
+ {
+ if (output == null)
+ {
+ log.ErrorFormat(Resources.GrassCoverErosionInwardsCalculationService_Calculate_Error_in_hbn_grass_cover_erosion_inwards_0_calculation, name);
+ }
+ }
- private static OvertoppingCalculationInput CreateInput(GrassCoverErosionInwardsCalculation calculation, FailureMechanismSection failureMechanismSection, GeneralGrassCoverErosionInwardsInput generalInput)
+ private static OvertoppingCalculationInput CreateOvertoppingInput(GrassCoverErosionInwardsCalculation calculation, FailureMechanismSection failureMechanismSection, GeneralGrassCoverErosionInwardsInput generalInput)
{
return new OvertoppingCalculationInput(calculation.InputParameters.HydraulicBoundaryLocation.Id,
new HydraRingSection(1, failureMechanismSection.GetSectionLength(), calculation.InputParameters.Orientation),
- calculation.InputParameters.DikeHeight,
- generalInput.CriticalOvertoppingModelFactor,
+ calculation.InputParameters.DikeHeight, generalInput.CriticalOvertoppingModelFactor,
generalInput.FbFactor.Mean, generalInput.FbFactor.StandardDeviation,
generalInput.FnFactor.Mean, generalInput.FnFactor.StandardDeviation,
- generalInput.OvertoppingModelFactor,
- calculation.InputParameters.CriticalFlowRate.Mean, calculation.InputParameters.CriticalFlowRate.StandardDeviation,
- generalInput.FrunupModelFactor.Mean, generalInput.FrunupModelFactor.StandardDeviation,
- generalInput.FshallowModelFactor.Mean, generalInput.FshallowModelFactor.StandardDeviation,
- ParseProfilePoints(calculation.InputParameters.DikeGeometry),
- ParseForeshore(calculation.InputParameters),
- ParseBreakWater(calculation.InputParameters));
+ generalInput.OvertoppingModelFactor, calculation.InputParameters.CriticalFlowRate.Mean,
+ calculation.InputParameters.CriticalFlowRate.StandardDeviation, generalInput.FrunupModelFactor.Mean,
+ generalInput.FrunupModelFactor.StandardDeviation, generalInput.FshallowModelFactor.Mean,
+ generalInput.FshallowModelFactor.StandardDeviation, ParseProfilePoints(calculation.InputParameters.DikeGeometry),
+ ParseForeshore(calculation.InputParameters), ParseBreakWater(calculation.InputParameters));
}
+ private static DikeHeightCalculationInput CreateDikeHeightInput(GrassCoverErosionInwardsCalculation calculation, IAssessmentSection assessmentSection,
+ FailureMechanismSection failureMechanismSection, GeneralGrassCoverErosionInwardsInput generalInput)
+ {
+ return new DikeHeightCalculationInput(calculation.InputParameters.HydraulicBoundaryLocation.Id, assessmentSection.FailureMechanismContribution.Norm,
+ new HydraRingSection(1, failureMechanismSection.GetSectionLength(), calculation.InputParameters.Orientation),
+ generalInput.CriticalOvertoppingModelFactor, generalInput.FbFactor.Mean, generalInput.FbFactor.StandardDeviation,
+ generalInput.FnFactor.Mean, generalInput.FnFactor.StandardDeviation, generalInput.OvertoppingModelFactor,
+ calculation.InputParameters.CriticalFlowRate.Mean, calculation.InputParameters.CriticalFlowRate.StandardDeviation,
+ generalInput.FrunupModelFactor.Mean, generalInput.FrunupModelFactor.StandardDeviation,
+ generalInput.FshallowModelFactor.Mean, generalInput.FshallowModelFactor.StandardDeviation,
+ ParseProfilePoints(calculation.InputParameters.DikeGeometry), ParseForeshore(calculation.InputParameters),
+ ParseBreakWater(calculation.InputParameters));
+ }
+
private static HydraRingBreakWater ParseBreakWater(GrassCoverErosionInwardsInput input)
{
return input.UseBreakWater ? new HydraRingBreakWater((int) input.BreakWater.Type, input.BreakWater.Height) : null;
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsCalculationServiceOutput.cs
===================================================================
diff -u -r2c02ce70cceb9e22c740df034c94782e44eded33 -ra34dbc4a2d6b3689cde30ea81370912cdaa858ce
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsCalculationServiceOutput.cs (.../GrassCoverErosionInwardsCalculationServiceOutput.cs) (revision 2c02ce70cceb9e22c740df034c94782e44eded33)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsCalculationServiceOutput.cs (.../GrassCoverErosionInwardsCalculationServiceOutput.cs) (revision a34dbc4a2d6b3689cde30ea81370912cdaa858ce)
@@ -32,11 +32,13 @@
/// The beta result of the calculation.
/// The wave height result of the calculation.
/// The value indicating whether overtopping was dominant in the calculation.
- public GrassCoverErosionInwardsCalculationServiceOutput(double beta, double waveHeight, bool isOvertoppingDominant)
+ /// The dike height result of the calculation.
+ public GrassCoverErosionInwardsCalculationServiceOutput(double beta, double waveHeight, bool isOvertoppingDominant, double dikeHeight = double.NaN)
{
Beta = beta;
WaveHeight = waveHeight;
IsOvertoppingDominant = isOvertoppingDominant;
+ DikeHeight = dikeHeight;
}
///
@@ -54,5 +56,10 @@
/// the overflow sub failure mechanism.
///
public bool IsOvertoppingDominant { get; private set; }
+
+ ///
+ /// Gets the dike height that was a result of the dike height calculation.
+ ///
+ public double DikeHeight { get; private set; }
}
}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/Properties/Resources.Designer.cs
===================================================================
diff -u -r5e6eacaf76f765ba77febee673e9e94895e46feb -ra34dbc4a2d6b3689cde30ea81370912cdaa858ce
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 5e6eacaf76f765ba77febee673e9e94895e46feb)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision a34dbc4a2d6b3689cde30ea81370912cdaa858ce)
@@ -69,5 +69,15 @@
"_inwards_0_calculation", resourceCulture);
}
}
+
+ ///
+ /// Looks up a localized string similar to De HBN berekening voor grasbekleding erosie kruin en binnentalud '{0}' is niet gelukt..
+ ///
+ internal static string GrassCoverErosionInwardsCalculationService_Calculate_Error_in_hbn_grass_cover_erosion_inwards_0_calculation {
+ get {
+ return ResourceManager.GetString("GrassCoverErosionInwardsCalculationService_Calculate_Error_in_hbn_grass_cover_ero" +
+ "sion_inwards_0_calculation", resourceCulture);
+ }
+ }
}
}
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/Properties/Resources.resx
===================================================================
diff -u -r5e6eacaf76f765ba77febee673e9e94895e46feb -ra34dbc4a2d6b3689cde30ea81370912cdaa858ce
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/Properties/Resources.resx (.../Resources.resx) (revision 5e6eacaf76f765ba77febee673e9e94895e46feb)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/Properties/Resources.resx (.../Resources.resx) (revision a34dbc4a2d6b3689cde30ea81370912cdaa858ce)
@@ -120,4 +120,7 @@
De berekening voor grasbekleding erosie kruin en binnentalud '{0}' is niet gelukt.
+
+ De HBN berekening voor grasbekleding erosie kruin en binnentalud '{0}' is niet gelukt.
+
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/Ringtoets.GrassCoverErosionInwards.Service.csproj
===================================================================
diff -u -r164556e75ddc489940c96a84fd41589a4acbac80 -ra34dbc4a2d6b3689cde30ea81370912cdaa858ce
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/Ringtoets.GrassCoverErosionInwards.Service.csproj (.../Ringtoets.GrassCoverErosionInwards.Service.csproj) (revision 164556e75ddc489940c96a84fd41589a4acbac80)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/Ringtoets.GrassCoverErosionInwards.Service.csproj (.../Ringtoets.GrassCoverErosionInwards.Service.csproj) (revision a34dbc4a2d6b3689cde30ea81370912cdaa858ce)
@@ -109,6 +109,7 @@
ResXFileCodeGenerator
Resources.Designer.cs
+ Designer
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Integration.Test/GrassCoverErosionInwardsCalculationServiceIntegrationTest.cs
===================================================================
diff -u -rdf02e9274a94d8763da204833a4d93f984e242c6 -ra34dbc4a2d6b3689cde30ea81370912cdaa858ce
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Integration.Test/GrassCoverErosionInwardsCalculationServiceIntegrationTest.cs (.../GrassCoverErosionInwardsCalculationServiceIntegrationTest.cs) (revision df02e9274a94d8763da204833a4d93f984e242c6)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Integration.Test/GrassCoverErosionInwardsCalculationServiceIntegrationTest.cs (.../GrassCoverErosionInwardsCalculationServiceIntegrationTest.cs) (revision a34dbc4a2d6b3689cde30ea81370912cdaa858ce)
@@ -30,7 +30,6 @@
using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.GrassCoverErosionInwards.Data;
using Ringtoets.GrassCoverErosionInwards.Service;
-using Ringtoets.HydraRing.Calculation.Data.Output;
using Ringtoets.HydraRing.Data;
using Ringtoets.Integration.Data;
using Ringtoets.Integration.Plugin.FileImporters;
@@ -197,22 +196,7 @@
new Point2D(1, 1)
}));
- DikeProfile dikeProfile = new DikeProfile(
- new Point2D(0, 0),
- new[]
- {
- new RoughnessPoint(new Point2D(1.1, 2.2), 0.6),
- new RoughnessPoint(new Point2D(3.3, 4.4), 0.7)
- },
- new[]
- {
- new Point2D(-2.0, -2.0),
- new Point2D(-1.0, -1.0)
- })
- {
- Orientation = (RoundedDouble) 5.5,
- DikeHeight = (RoundedDouble) 10
- };
+ var dikeProfile = GetDikeProfile();
var calculation = new GrassCoverErosionInwardsCalculation
{
@@ -228,6 +212,7 @@
// Call
Action call = () => output = GrassCoverErosionInwardsCalculationService.Calculate(calculation,
+ assessmentSection,
testDataPath,
failureMechanismSection,
failureMechanismSection.Name,
@@ -270,6 +255,7 @@
// Call
Action call = () => output = GrassCoverErosionInwardsCalculationService.Calculate(calculation,
+ assessmentSection,
testDataPath,
failureMechanismSection,
failureMechanismSection.Name,
@@ -287,6 +273,149 @@
Assert.IsNull(output);
}
+ [Test]
+ public void Calculate_CalculateDikeHeightFalse_DikeHeightNotCalculated()
+ {
+ // Setup
+ var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike);
+ ImportHydraulicBoundaryDatabase(assessmentSection);
+
+ assessmentSection.GrassCoverErosionInwards.AddSection(new FailureMechanismSection("test section", new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(1, 1)
+ }));
+
+ var dikeProfile = GetDikeProfile();
+
+ var calculation = new GrassCoverErosionInwardsCalculation
+ {
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001),
+ DikeProfile = dikeProfile,
+ CalculateDikeHeight = false
+ }
+ };
+
+ var failureMechanismSection = assessmentSection.GrassCoverErosionInwards.Sections.First();
+ GrassCoverErosionInwardsCalculationServiceOutput output = null;
+
+ // Call
+ Action call = () => output = GrassCoverErosionInwardsCalculationService.Calculate(calculation,
+ assessmentSection,
+ testDataPath,
+ failureMechanismSection,
+ failureMechanismSection.Name,
+ assessmentSection.GrassCoverErosionInwards.GeneralInput);
+
+ // Assert
+ TestHelper.AssertLogMessages(call, messages =>
+ {
+ var msgs = messages.ToArray();
+ Assert.AreEqual(2, msgs.Length);
+ StringAssert.StartsWith(String.Format("Berekening van '{0}' gestart om: ", calculation.Name), msgs[0]);
+ StringAssert.StartsWith(String.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[1]);
+ });
+ Assert.IsNotNull(output);
+ Assert.IsNaN(output.DikeHeight);
+ }
+
+ [Test]
+ public void Calculate_CalculateDikeHeightTrue_DikeHeightCalculated()
+ {
+ // Setup
+ var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike);
+ ImportHydraulicBoundaryDatabase(assessmentSection);
+
+ assessmentSection.GrassCoverErosionInwards.AddSection(new FailureMechanismSection("test section", new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(1, 1)
+ }));
+
+ var dikeProfile = GetDikeProfile();
+
+ var calculation = new GrassCoverErosionInwardsCalculation
+ {
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001),
+ DikeProfile = dikeProfile,
+ CalculateDikeHeight = true
+ }
+ };
+
+ var failureMechanismSection = assessmentSection.GrassCoverErosionInwards.Sections.First();
+ GrassCoverErosionInwardsCalculationServiceOutput output = null;
+
+ // Call
+ Action call = () => output = GrassCoverErosionInwardsCalculationService.Calculate(calculation,
+ assessmentSection,
+ testDataPath,
+ failureMechanismSection,
+ failureMechanismSection.Name,
+ assessmentSection.GrassCoverErosionInwards.GeneralInput);
+
+ // Assert
+ TestHelper.AssertLogMessages(call, messages =>
+ {
+ var msgs = messages.ToArray();
+ Assert.AreEqual(2, msgs.Length);
+ StringAssert.StartsWith(String.Format("Berekening van '{0}' gestart om: ", calculation.Name), msgs[0]);
+ StringAssert.StartsWith(String.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[1]);
+ });
+ Assert.IsNotNull(output);
+ Assert.AreEqual(15.5937, output.DikeHeight);
+ }
+
+ [Test]
+ public void Calculate_CalculateDikeHeightTrueAndCalculationInvalid_LogStartAndEndAndErrorMessageAndReturnNull()
+ {
+ // Setup
+ var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike);
+ ImportHydraulicBoundaryDatabase(assessmentSection);
+
+ assessmentSection.GrassCoverErosionInwards.AddSection(new FailureMechanismSection("test section", new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(1, 1)
+ }));
+
+ var calculation = new GrassCoverErosionInwardsCalculation
+ {
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001),
+ DikeProfile = new DikeProfile(new Point2D(0,0), new RoughnessPoint[0], new Point2D[0]),
+ CalculateDikeHeight = true
+ }
+ };
+
+ var failureMechanismSection = assessmentSection.GrassCoverErosionInwards.Sections.First();
+ GrassCoverErosionInwardsCalculationServiceOutput output = null;
+
+ // Call
+ Action call = () => output = GrassCoverErosionInwardsCalculationService.Calculate(calculation,
+ assessmentSection,
+ testDataPath,
+ failureMechanismSection,
+ failureMechanismSection.Name,
+ assessmentSection.GrassCoverErosionInwards.GeneralInput);
+
+ // Assert
+ TestHelper.AssertLogMessages(call, messages =>
+ {
+ var msgs = messages.ToArray();
+ Assert.AreEqual(4, msgs.Length);
+ StringAssert.StartsWith(String.Format("Berekening van '{0}' gestart om: ", calculation.Name), msgs[0]);
+ StringAssert.StartsWith(String.Format("De berekening voor grasbekleding erosie kruin en binnentalud '{0}' is niet gelukt.", calculation.Name), msgs[1]);
+ StringAssert.StartsWith(String.Format("De HBN berekening voor grasbekleding erosie kruin en binnentalud '{0}' is niet gelukt.", calculation.Name), msgs[2]);
+ StringAssert.StartsWith(String.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[3]);
+ });
+ Assert.IsNull(output);
+ }
+
private void ImportHydraulicBoundaryDatabase(AssessmentSection assessmentSection)
{
string validFilePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite");
@@ -295,5 +424,26 @@
importer.Import(assessmentSection, validFilePath);
}
}
+
+ private static DikeProfile GetDikeProfile()
+ {
+ DikeProfile dikeProfile = new DikeProfile(
+ new Point2D(0, 0),
+ new[]
+ {
+ new RoughnessPoint(new Point2D(1.1, 2.2), 0.6),
+ new RoughnessPoint(new Point2D(3.3, 4.4), 0.7)
+ },
+ new[]
+ {
+ new Point2D(-2.0, -2.0),
+ new Point2D(-1.0, -1.0)
+ })
+ {
+ Orientation = (RoundedDouble)5.5,
+ DikeHeight = (RoundedDouble)10
+ };
+ return dikeProfile;
+ }
}
}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Service.Test/GrassCoverErosionInwardsCalculationServiceOutputTest.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Service.Test/GrassCoverErosionInwardsCalculationServiceOutputTest.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Service.Test/GrassCoverErosionInwardsCalculationServiceOutputTest.cs (revision a34dbc4a2d6b3689cde30ea81370912cdaa858ce)
@@ -0,0 +1,66 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using NUnit.Framework;
+
+namespace Ringtoets.GrassCoverErosionInwards.Service.Test
+{
+ [TestFixture]
+ public class GrassCoverErosionInwardsCalculationServiceOutputTest
+ {
+ [Test]
+ public void ParameteredConstructor_WithDikeHeight_ExpectedValues()
+ {
+ // Setup
+ double beta = 3.452;
+ double waveHeight = 8.261;
+ bool isOvertoppingDominant = true;
+ double dikeHeight = 9.3876;
+
+ // Call
+ GrassCoverErosionInwardsCalculationServiceOutput output = new GrassCoverErosionInwardsCalculationServiceOutput(beta, waveHeight, isOvertoppingDominant, dikeHeight);
+
+ // Assert
+ Assert.AreEqual(beta, output.Beta);
+ Assert.AreEqual(waveHeight, output.WaveHeight);
+ Assert.AreEqual(isOvertoppingDominant, output.IsOvertoppingDominant);
+ Assert.AreEqual(dikeHeight, output.DikeHeight);
+ }
+
+ [Test]
+ public void ParameteredConstructor_WithoutDikeHeight_ExpectedValues()
+ {
+ // Setup
+ double beta = 3.452;
+ double waveHeight = 8.261;
+ bool isOvertoppingDominant = false;
+
+ // Call
+ GrassCoverErosionInwardsCalculationServiceOutput output = new GrassCoverErosionInwardsCalculationServiceOutput(beta, waveHeight, isOvertoppingDominant);
+
+ // Assert
+ Assert.AreEqual(beta, output.Beta);
+ Assert.AreEqual(waveHeight, output.WaveHeight);
+ Assert.AreEqual(isOvertoppingDominant, output.IsOvertoppingDominant);
+ Assert.IsNaN(output.DikeHeight);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Service.Test/Ringtoets.GrassCoverErosionInwards.Service.Test.csproj
===================================================================
diff -u -r6ccc539ce58e63f0e0fbff0da189c87b65146129 -ra34dbc4a2d6b3689cde30ea81370912cdaa858ce
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Service.Test/Ringtoets.GrassCoverErosionInwards.Service.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Service.Test.csproj) (revision 6ccc539ce58e63f0e0fbff0da189c87b65146129)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Service.Test/Ringtoets.GrassCoverErosionInwards.Service.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Service.Test.csproj) (revision a34dbc4a2d6b3689cde30ea81370912cdaa858ce)
@@ -50,6 +50,7 @@
+