Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Service/MacroStabilityInwardsCalculationService.cs =================================================================== diff -u -r8d246ac6328e6e649ff6e78dfe3fac210d789ba0 -r0da7a76905c549ccda8339fc255e1efa156807f4 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Service/MacroStabilityInwardsCalculationService.cs (.../MacroStabilityInwardsCalculationService.cs) (revision 8d246ac6328e6e649ff6e78dfe3fac210d789ba0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Service/MacroStabilityInwardsCalculationService.cs (.../MacroStabilityInwardsCalculationService.cs) (revision 0da7a76905c549ccda8339fc255e1efa156807f4) @@ -21,6 +21,7 @@ using System; using System.Linq; +using Core.Common.Base.Data; using Ringtoets.Common.Service; using Ringtoets.MacroStabilityInwards.CalculatedInput.Converters; using Ringtoets.MacroStabilityInwards.Data; @@ -46,9 +47,10 @@ /// the execution of the operation. /// /// The for which to validate the values. + /// The normative assessment level to use in case no manual assessment level is provided. /// false if contains validation errors; true otherwise. /// Thrown when is null. - public static bool Validate(MacroStabilityInwardsCalculation calculation) + public static bool Validate(MacroStabilityInwardsCalculation calculation, RoundedDouble normativeAssessmentLevel) { if (calculation == null) { @@ -57,7 +59,7 @@ CalculationServiceHelper.LogValidationBegin(); - string[] inputValidationResults = MacroStabilityInwardsInputValidator.Validate(calculation.InputParameters).ToArray(); + string[] inputValidationResults = MacroStabilityInwardsInputValidator.Validate(calculation.InputParameters, normativeAssessmentLevel).ToArray(); if (inputValidationResults.Length > 0) { @@ -66,7 +68,7 @@ return false; } - UpliftVanCalculatorInput upliftVanCalculatorInput = CreateInputFromData(calculation.InputParameters); + UpliftVanCalculatorInput upliftVanCalculatorInput = CreateInputFromData(calculation.InputParameters, normativeAssessmentLevel); IUpliftVanCalculator calculator = MacroStabilityInwardsCalculatorFactory.Instance.CreateUpliftVanCalculator(upliftVanCalculatorInput, MacroStabilityInwardsKernelWrapperFactory.Instance); UpliftVanKernelMessage[] kernelMessages; @@ -96,10 +98,11 @@ /// the execution of the operation. /// /// The to base the input for the calculation upon. + /// The normative assessment level to use in case no manual assessment level is provided. /// Thrown when is null. /// Consider calling first to see if calculation is possible. /// Thrown when an error occurred during the calculation. - public static void Calculate(MacroStabilityInwardsCalculation calculation) + public static void Calculate(MacroStabilityInwardsCalculation calculation, RoundedDouble normativeAssessmentLevel) { if (calculation == null) { @@ -111,7 +114,7 @@ try { IUpliftVanCalculator calculator = MacroStabilityInwardsCalculatorFactory.Instance.CreateUpliftVanCalculator( - CreateInputFromData(calculation.InputParameters), + CreateInputFromData(calculation.InputParameters, normativeAssessmentLevel), MacroStabilityInwardsKernelWrapperFactory.Instance); UpliftVanCalculatorResult macroStabilityInwardsResult = calculator.Calculate(); @@ -157,14 +160,18 @@ } } - private static UpliftVanCalculatorInput CreateInputFromData(MacroStabilityInwardsInput inputParameters) + private static UpliftVanCalculatorInput CreateInputFromData(MacroStabilityInwardsInput inputParameters, RoundedDouble normativeAssessmentLevel) { + RoundedDouble effectiveAssessmentLevel = inputParameters.UseAssessmentLevelManualInput + ? inputParameters.AssessmentLevel + : normativeAssessmentLevel; + return new UpliftVanCalculatorInput( new UpliftVanCalculatorInput.ConstructionProperties { WaternetCreationMode = WaternetCreationMode.CreateWaternet, PlLineCreationMethod = PlLineCreationMethod.RingtoetsWti2017, - AssessmentLevel = inputParameters.AssessmentLevel, + AssessmentLevel = effectiveAssessmentLevel, LandwardDirection = LandwardDirection.PositiveX, SurfaceLine = inputParameters.SurfaceLine, SoilProfile = SoilProfileConverter.Convert(inputParameters.SoilProfileUnderSurfaceLine),