// Copyright (C) Stichting Deltares 2018. All rights reserved. // // This file is part of the Dam Engine. // // The Dam Engine is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero 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 Affero General Public License for more details. // // You should have received a copy of the GNU Affero 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 System; using System.Collections.Generic; using Deltares.DamEngine.Calculators.PlLinesCreator; using Deltares.DamEngine.Calculators.Uplift; using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.General.PlLines; using Deltares.DamEngine.Data.RWScenarios; namespace Deltares.DamEngine.Calculators.Dikes_Assessment_Regional { public class UpliftRWEvaluator : RWEvaluator { private DikeDrySensitivity dikeDrySensitivity = DikeDrySensitivity.None; private LoadSituation loadSituation = LoadSituation.Wet; private HydraulicShortcutType hydraulicShortcutType = HydraulicShortcutType.NoHydraulicShortcut; public UpliftRWEvaluator() { } public override Enum Evaluate(Location location, SoilGeometry soilGeometry, params Enum[] previousChoices) { base.Evaluate(location, soilGeometry, previousChoices); Dictionary choices = new Dictionary(); foreach (Enum enumValue in previousChoices) { if (enumValue != null) { choices[enumValue.GetType()] = enumValue; } } dikeDrySensitivity = (DikeDrySensitivity)choices[typeof(DikeDrySensitivity)]; loadSituation = (LoadSituation)choices[typeof(LoadSituation)]; hydraulicShortcutType = (HydraulicShortcutType) choices[typeof (HydraulicShortcutType)]; // determine uplift here double? upliftFactor = GetLowestUpliftFactor(); UpliftType upliftType = UpliftType.NoUplift; if (upliftFactor != null) { if (upliftFactor.Value < location.ModelFactors.UpliftCriterionStability) { return UpliftType.Uplift; } } return upliftType; } /// /// Create PL-lines /// /// private PLLines CreatePLLines() { PLLinesCreator plLinesCreator = new PLLinesCreator(); double waterLevel = GetBoezemLevel(); plLinesCreator.WaterLevelRiverHigh = waterLevel; plLinesCreator.HeadInPLLine2 = location.HeadPl2; plLinesCreator.HeadInPLLine3 = location.HeadPl3; plLinesCreator.HeadInPLLine4 = location.HeadPl4; plLinesCreator.SurfaceLine = location.SurfaceLine; plLinesCreator.WaterLevelPolder = location.PolderLevel; plLinesCreator.ModelParametersForPLLines = location.ModelParametersForPLLines; plLinesCreator.SoilProfile = soilGeometry.SoilProfile; plLinesCreator.SoilGeometry2DName = null; plLinesCreator.SoilProfileType = SoilProfileType.ProfileType1D; plLinesCreator.GaugePLLines = null; plLinesCreator.Gauges = null; plLinesCreator.GaugeMissVal = 0.0; plLinesCreator.IsAdjustPL3AndPL4SoNoUpliftWillOccurEnabled = true; // for stability this must set to true plLinesCreator.PlLineOffsetBelowDikeTopAtRiver = location.PlLineOffsetBelowDikeTopAtRiver; plLinesCreator.PlLineOffsetBelowDikeTopAtPolder = location.PlLineOffsetBelowDikeTopAtPolder; plLinesCreator.DikeEmbankmentMaterial = location.GetDikeEmbankmentSoil(); plLinesCreator.IsUseOvenDryUnitWeight = (dikeDrySensitivity == DikeDrySensitivity.Dry); plLinesCreator.IsHydraulicShortcut = (hydraulicShortcutType == HydraulicShortcutType.HydraulicShortcut); plLinesCreator.XSoilGeometry2DOrigin = location.XSoilGeometry2DOrigin; // PLLines plLines = plLinesCreator.CreateAllPLLines(location); // return plLines; ##Bka return null; } /// /// Determine boezemlevel according to loadsituation /// /// private double GetBoezemLevel() { double boezemLevel = 0.0; switch (loadSituation) { case LoadSituation.Wet: boezemLevel = location.BoezemLevelTp; break; case LoadSituation.Dry: boezemLevel = location.BoezemLevelHbp; break; } return boezemLevel; } /// /// Determine where lowest uplift factor occurs and the value of that factor /// /// private double? GetLowestUpliftFactor() { UpliftLocationDeterminator upliftLocationDeterminator = new UpliftLocationDeterminator() { SurfaceLine = location.SurfaceLine, SoilProfile = soilGeometry.SoilProfile, SoilGeometry2DName = null, DikeEmbankmentMaterial = location.GetDikeEmbankmentSoil(), PLLines = CreatePLLines(), IsUseOvenDryUnitWeight = (dikeDrySensitivity == DikeDrySensitivity.Dry), XSoilGeometry2DOrigin = location.XSoilGeometry2DOrigin }; UpliftLocationAndResult upliftLocationAndResult = upliftLocationDeterminator.GetLocationAtWithLowestUpliftFactor(); if (upliftLocationAndResult != null) return upliftLocationAndResult.UpliftFactor; else return null; } } }