// Copyright (C) Stichting Deltares 2024. 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 System.Linq; using Deltares.DamEngine.Data.Design; using Deltares.DamEngine.Data.General.Gauges; using Deltares.DamEngine.Data.General.PlLines; using Deltares.DamEngine.Data.General.Sensors; using Deltares.DamEngine.Data.Geometry; using Deltares.DamEngine.Data.Geotechnics; using Deltares.DamEngine.Data.Standard.Validation; namespace Deltares.DamEngine.Data.General; public class Location { // Added initial value as these properties must be tested for real values on import // Start of parameters that are also defined in ModelParameters private string name = ""; private SensorLocation sensorLocation; /// /// Initializes a new instance of the class. /// public Location() { SoilList = null; } /// /// Initializes a new instance of the class. /// /// The name. public Location(string name) : this() { this.name = name; } /// /// Gets a value indicating whether this instance has a sensor location. /// /// /// true if this instance has a sensor location; otherwise, false. /// public bool HasSensorLocation { get { return sensorLocation != null; } } /// /// Gets or sets the distance to entry point (can be used for Piping Sellmeijer). /// /// /// The distance to entry point. /// public double DistanceToEntryPoint { get; set; } /// /// Gets or sets the sensor location. /// /// /// The sensor location. /// public virtual SensorLocation SensorLocation { get { return sensorLocation; } set { sensorLocation = value; sensorLocation.Location = this; } } /// /// Gets or sets the name. /// /// /// The name. /// public virtual string Name { get { return name; } set { name = value; } } /// /// Gets or sets the x rd dike line (for sensors). /// /// /// The x rd dike line. /// public virtual double XRdDikeLine { get; set; } /// /// Gets or sets the local XZPL1 line. /// /// /// The local XZPL1 line. /// public virtual Pl1Line LocalXzpl1Line { get; set; } /// /// The surfaceline in local coordinates /// /// Composite relationship. [Validate] public virtual SurfaceLine2 SurfaceLine { get; set; } /// /// Gets or sets the Segment /// public virtual Segment Segment { get; set; } /// /// Gets or sets the slope damping piezometric height polder side. /// /// /// The slope damping piezometric height polder side. /// public virtual double SlopeDampingPiezometricHeightPolderSide { get; set; } /// /// Gets or sets the height of the dike table. /// /// /// The height of the dike table. /// public virtual double DikeTableHeight { get; set; } /// /// Gets or sets the soil list. /// /// /// The soil list. /// public SoilList SoilList { get; set; } /// /// Gets or sets the degree of consolidation of the soils (consolidated) due to the traffic load (consolidator). /// public IList TrafficLoadDegreeOfConsolidations { get; set; } /// /// Gets or sets the gauges. /// /// /// The gauges. /// public virtual IList Gauges { get; set; } = new List(); /// /// Gets or sets the gauge pl lines. /// /// /// The gauge pl lines. /// public virtual IList GaugePlLines { get; set; } = new List(); /// /// Gets or sets a value indicating whether [redesign dike height]. /// /// /// true if [redesign dike height]; otherwise, false. /// public bool RedesignDikeHeight { get; set; } = true; /// /// Gets or sets a value indicating whether [redesign dike shoulder]. /// /// /// true if [redesign dike shoulder]; otherwise, false. /// public bool RedesignDikeShoulder { get; set; } = true; /// /// Gets or sets the stability design method. /// /// /// The stability design method. /// public StabilityDesignMethod StabilityDesignMethod { get; set; } = StabilityDesignMethod.OptimizedSlopeAndShoulderAdaption; /// /// Gets or sets the slope adaption start cotangent. /// /// /// The slope adaption start cotangent. /// public double SlopeAdaptionStartCotangent { get; set; } = 3.0; /// /// Gets or sets the slope adaption end cotangent. /// /// /// The slope adaption end cotangent. /// public double SlopeAdaptionEndCotangent { get; set; } = 6.0; /// /// Gets or sets the slope adaption step cotangent. /// /// /// The slope adaption step cotangent. /// public double SlopeAdaptionStepCotangent { get; set; } = 0.5; /// /// Gets or sets a value indicating whether [use new dike top width]. /// /// /// true if [use new dike top width]; otherwise, false. /// public bool UseNewDikeTopWidth { get; set; } /// /// Gets or sets the new width of the dike top. /// /// /// The new width of the dike top. /// public double NewDikeTopWidth { get; set; } = 5.0; /// /// Gets or sets a value indicating whether [use new dike slope inside]. /// /// /// true if [use new dike slope inside]; otherwise, false. /// public bool UseNewDikeSlopeInside { get; set; } /// /// Gets or sets the new dike slope inside. /// /// /// The new dike slope inside. /// public double NewDikeSlopeInside { get; set; } = 1.0 / 3.0; /// /// Gets or sets a value indicating whether [use new dike slope outside]. /// /// /// true if [use new dike slope outside]; otherwise, false. /// public bool UseNewDikeSlopeOutside { get; set; } /// /// Gets or sets the new dike slope outside. /// /// /// The new dike slope outside. /// public double NewDikeSlopeOutside { get; set; } = 1.0 / 3.0; /// /// Gets or sets a value indicating whether [use new shoulder top slope]. /// /// /// true if [use new shoulder top slope]; otherwise, false. /// public bool UseNewShoulderTopSlope { get; set; } /// /// Gets or sets the new shoulder top slope. /// /// /// The new shoulder top slope. /// public double NewShoulderTopSlope { get; set; } = 1.0 / 20.0; /// /// Gets or sets a value indicating whether [use new shoulder base slope]. /// /// /// true if [use new shoulder base slope]; otherwise, false. /// public bool UseNewShoulderBaseSlope { get; set; } /// /// Gets or sets the new shoulder base slope. /// /// /// The new shoulder base slope. /// public double NewShoulderBaseSlope { get; set; } = 1.0 / 3.0; /// /// Gets or sets a value indicating whether [use new maximum height shoulder as fraction]. /// /// /// true if [use new maximum height shoulder as fraction]; otherwise, false. /// public bool UseNewMaxHeightShoulderAsFraction { get; set; } /// /// Gets or sets the new maximum height shoulder as fraction. /// /// /// The new maximum height shoulder as fraction. /// public double NewMaxHeightShoulderAsFraction { get; set; } = 2.0 / 3.0; /// /// Gets or sets a value indicating whether [use new minimum distance dike toe start ditch]. /// /// /// true if [use new minimum distance dike toe start ditch]; otherwise, false. /// public bool UseNewMinDistanceDikeToeStartDitch { get; set; } /// /// Gets or sets the new minimum distance dike toe start ditch. /// /// /// The new minimum distance dike toe start ditch. /// public double NewMinDistanceDikeToeStartDitch { get; set; } = 5.0; /// /// Gets or sets a value indicating whether [use new ditch definition]. /// /// /// true if [use new ditch definition]; otherwise, false. /// public bool UseNewDitchDefinition { get; set; } /// /// Gets or sets the new width ditch bottom. /// /// /// The new width ditch bottom. /// public double NewWidthDitchBottom { get; set; } = 1.0; /// /// Gets or sets the new slope angle ditch. /// /// /// The new slope angle ditch. /// public double NewSlopeAngleDitch { get; set; } = 1.0 / 0.5; /// /// Gets or sets the new depth ditch. /// /// /// The new depth ditch. /// public double NewDepthDitch { get; set; } = 1.0; /// /// Gets the scenarios. /// /// /// The scenarios. /// [Validate] public List Scenarios { get; } = new List(); /// /// Gets or sets the current scenario. /// /// /// The current scenario. /// public DesignScenario CurrentScenario { get; set; } /// /// Gets or sets the type of the dam project. /// /// /// The type of the dam project. /// public static DamProjectType DamProjectType { get; set; } = DamProjectType.Operational; /// /// Gets or sets the stability options. /// /// /// The stability options. /// public StabilityOptions StabilityOptions { get; set; } /// /// Gets or sets the model parameters for pl lines. /// /// /// The model parameters for pl lines. /// public ModelParametersForPlLines ModelParametersForPlLines { get; set; } = new ModelParametersForPlLines(); /// /// Gets the dike embankment soil. /// /// public Soil GetDikeEmbankmentSoil() { if (SoilList != null && SoilList.Soils.Count > 0 && !String.IsNullOrEmpty(DikeEmbankmentMaterial)) { return SoilList.GetSoilByName(DikeEmbankmentMaterial); } return null; } /// /// Gets the shoulder embankment soil. /// /// public Soil GetShoulderEmbankmentSoil() { Soil soil = null; if (SoilList != null && SoilList.Soils.Count > 0 && !String.IsNullOrEmpty(ShoulderEmbankmentMaterial)) { soil = SoilList.GetSoilByName(ShoulderEmbankmentMaterial); } if (soil == null) { soil = GetDikeEmbankmentSoil(); } return soil; } /// /// Aligns the boundary points of PL1 line with adapted surface line. /// /// The adapted surface line. public void AlignBoundaryPointsOfPl1LineWithAdaptedSurfaceLine(SurfaceLine2 adaptedSurfaceLine) { if ((LocalXzpl1Line != null) && (LocalXzpl1Line.CalcPoints.Count > 1)) { Point2D lastPointPl1Line = LocalXzpl1Line.CalcPoints.Last(); Point2D lastPointSurfaceLine = adaptedSurfaceLine.Geometry.CalcPoints.Last(); lastPointPl1Line.X = lastPointSurfaceLine.X; Point2D firstPointPl1Line = LocalXzpl1Line.CalcPoints.First(); Point2D firstPointSurfaceLine = adaptedSurfaceLine.Geometry.CalcPoints.First(); firstPointPl1Line.X = firstPointSurfaceLine.X; } } /// /// Adds a new sensor location. /// public void AddSensorLocation() { var factory = new SensorFactory(); SensorLocation = factory.CreateSensorLocation(this); } /// /// Returns a that represents this instance. /// /// /// A that represents this instance. /// public override string ToString() { return Name; } #region Design parameters /// /// Gets or sets the dike embankment material. /// /// /// The dike embankment material. /// public virtual string DikeEmbankmentMaterial { get; set; } = ""; /// /// Gets or sets the shoulder embankment material. /// /// /// The shoulder embankment material. /// public virtual string ShoulderEmbankmentMaterial { get; set; } = ""; /// /// Gets or sets the stability shoulder grow slope. /// /// /// The stability shoulder grow slope. /// public virtual double StabilityShoulderGrowSlope { get; set; } = 1.0 / 3; /// /// Gets or sets the stability shoulder grow delta x. /// /// /// The stability shoulder grow delta x. /// public virtual double StabilityShoulderGrowDeltaX { get; set; } = 2.0; /// /// Gets or sets the stability slope adaption delta x. /// /// /// The stability slope adaption delta x. /// public virtual double StabilitySlopeAdaptionDeltaX { get; set; } = 2.0; #endregion #region PlLine creation parameters /// /// Gets or sets the intrusion vertical water pressure. /// /// /// The intrusion vertical water pressure. /// public IntrusionVerticalWaterPressureType? IntrusionVerticalWaterPressure { get; set; } = IntrusionVerticalWaterPressureType.Standard; #endregion }