Fisheye: Tag 56beff6e761d1d6f07fcd566791a03baad5c7358 refers to a dead (removed) revision in file `Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/ConfigurationStabilityPointStructuresInflowModelType.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 56beff6e761d1d6f07fcd566791a03baad5c7358 refers to a dead (removed) revision in file `Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/ConfigurationStabilityPointStructuresInflowModelTypeConverter.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 56beff6e761d1d6f07fcd566791a03baad5c7358 refers to a dead (removed) revision in file `Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/ConfigurationStabilityPointStructuresLoadSchematizationType.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 56beff6e761d1d6f07fcd566791a03baad5c7358 refers to a dead (removed) revision in file `Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/ConfigurationStabilityPointStructuresInflowModelType.cs =================================================================== diff -u --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/ConfigurationStabilityPointStructuresInflowModelType.cs (revision 0) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/ConfigurationStabilityPointStructuresInflowModelType.cs (revision 56beff6e761d1d6f07fcd566791a03baad5c7358) @@ -0,0 +1,39 @@ +// 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. + +namespace Ringtoets.StabilityPointStructures.IO.Configurations +{ + /// + /// Defines the various inflow models for the stability point structures failure mechanism. + /// + public enum ConfigurationStabilityPointStructuresInflowModelType + { + /// + /// A low sill structure. + /// + LowSill = 1, + + /// + /// A flooded culvert structure. + /// + FloodedCulvert = 2 + } +} \ No newline at end of file Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/ConfigurationStabilityPointStructuresLoadSchematizationType.cs =================================================================== diff -u --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/ConfigurationStabilityPointStructuresLoadSchematizationType.cs (revision 0) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/ConfigurationStabilityPointStructuresLoadSchematizationType.cs (revision 56beff6e761d1d6f07fcd566791a03baad5c7358) @@ -0,0 +1,42 @@ +// 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 Ringtoets.StabilityPointStructures.Data; + +namespace Ringtoets.StabilityPointStructures.IO.Configurations +{ + /// + /// Defines the types of load representations that can be used + /// for the schematization of . + /// + public enum ConfigurationStabilityPointStructuresLoadSchematizationType + { + /// + /// A linear schematization. + /// + Linear = 1, + + /// + /// A quadratic schematization. + /// + Quadratic = 2 + } +} \ No newline at end of file Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/Helpers/ConfigurationStabilityPointStructuresInflowModelTypeConverter.cs =================================================================== diff -u --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/Helpers/ConfigurationStabilityPointStructuresInflowModelTypeConverter.cs (revision 0) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/Helpers/ConfigurationStabilityPointStructuresInflowModelTypeConverter.cs (revision 56beff6e761d1d6f07fcd566791a03baad5c7358) @@ -0,0 +1,162 @@ +// 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 System; +using System.ComponentModel; +using System.Globalization; +using Ringtoets.StabilityPointStructures.Data; + +namespace Ringtoets.StabilityPointStructures.IO.Configurations.Helpers +{ + /// + /// Converts to + /// or and back. + /// + public class ConfigurationStabilityPointStructuresInflowModelTypeConverter : TypeConverter + { + public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) + { + if (destinationType == typeof(StabilityPointStructureInflowModelType)) + { + return true; + } + return base.CanConvertTo(context, destinationType); + } + + public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + { + var type = (ConfigurationStabilityPointStructuresInflowModelType) value; + if (destinationType == typeof(string)) + { + return ConvertToString(type); + } + if (destinationType == typeof(StabilityPointStructureInflowModelType)) + { + return ConvertToStabilityPointStructureInflowModelType(type); + } + return base.ConvertTo(context, culture, value, destinationType); + } + + public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + { + if (sourceType == typeof(string)) + { + return true; + } + if (sourceType == typeof(StabilityPointStructureInflowModelType)) + { + return true; + } + return base.CanConvertFrom(context, sourceType); + } + + public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) + { + var text = value as string; + if (text != null) + { + return ConvertToConfigurationInflowModelType(text); + } + var inflowModelType = value as StabilityPointStructureInflowModelType?; + if (inflowModelType != null) + { + return ConvertToConfigurationInflowModelType(inflowModelType.Value); + } + return base.ConvertFrom(context, culture, value); + } + + /// + /// Converts the given to a . + /// + /// The to convert. + /// The converted . + /// Thrown when is not supported. + private static StabilityPointStructureInflowModelType ConvertToStabilityPointStructureInflowModelType(ConfigurationStabilityPointStructuresInflowModelType type) + { + switch (type) + { + case ConfigurationStabilityPointStructuresInflowModelType.LowSill: + return StabilityPointStructureInflowModelType.LowSill; + case ConfigurationStabilityPointStructuresInflowModelType.FloodedCulvert: + return StabilityPointStructureInflowModelType.FloodedCulvert; + default: + throw new NotSupportedException($"Value '{type}' is not supported."); + } + } + + /// + /// Converts the given to a . + /// + /// The to convert. + /// The converted . + /// Thrown when is not supported. + private static string ConvertToString(ConfigurationStabilityPointStructuresInflowModelType type) + { + switch (type) + { + case ConfigurationStabilityPointStructuresInflowModelType.LowSill: + return StabilityPointStructuresConfigurationSchemaIdentifiers.InflowModelLowSillStructure; + case ConfigurationStabilityPointStructuresInflowModelType.FloodedCulvert: + return StabilityPointStructuresConfigurationSchemaIdentifiers.InflowModelFloodedCulvertStructure; + default: + throw new NotSupportedException($"Value '{type}' is not supported."); + } + } + + /// + /// Converts to . + /// + /// The to convert. + /// The converted . + /// Thrown when is not supported. + private static ConfigurationStabilityPointStructuresInflowModelType ConvertToConfigurationInflowModelType(string text) + { + switch (text) + { + case StabilityPointStructuresConfigurationSchemaIdentifiers.InflowModelLowSillStructure: + return ConfigurationStabilityPointStructuresInflowModelType.LowSill; + case StabilityPointStructuresConfigurationSchemaIdentifiers.InflowModelFloodedCulvertStructure: + return ConfigurationStabilityPointStructuresInflowModelType.FloodedCulvert; + default: + throw new NotSupportedException($"Value '{text}' is not supported."); + } + } + + /// + /// Converts to . + /// + /// The to convert. + /// The converted . + /// Thrown when is not supported. + private static ConfigurationStabilityPointStructuresInflowModelType ConvertToConfigurationInflowModelType(StabilityPointStructureInflowModelType inflowModelType) + { + switch (inflowModelType) + { + case StabilityPointStructureInflowModelType.LowSill: + return ConfigurationStabilityPointStructuresInflowModelType.LowSill; + case StabilityPointStructureInflowModelType.FloodedCulvert: + return ConfigurationStabilityPointStructuresInflowModelType.FloodedCulvert; + default: + throw new NotSupportedException($"Value '{inflowModelType}' is not supported."); + } + } + } +} \ No newline at end of file Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/Helpers/ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter.cs =================================================================== diff -u --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/Helpers/ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter.cs (revision 0) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/Helpers/ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter.cs (revision 56beff6e761d1d6f07fcd566791a03baad5c7358) @@ -0,0 +1,164 @@ +// 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 System; +using System.ComponentModel; +using System.Globalization; +using Ringtoets.StabilityPointStructures.Data; + +namespace Ringtoets.StabilityPointStructures.IO.Configurations.Helpers +{ + /// + /// Converts to + /// or and back. + /// + public class ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter : TypeConverter + { + public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) + { + if (destinationType == typeof(LoadSchematizationType)) + { + return true; + } + return base.CanConvertTo(context, destinationType); + } + + public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + { + var type = (ConfigurationStabilityPointStructuresLoadSchematizationType) value; + if (destinationType == typeof(string)) + { + return ConvertToString(type); + } + if (destinationType == typeof(LoadSchematizationType)) + { + return ConvertToLoadSchematizationType(type); + } + return base.ConvertTo(context, culture, value, destinationType); + } + + public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + { + if (sourceType == typeof(string)) + { + return true; + } + if (sourceType == typeof(LoadSchematizationType)) + { + return true; + } + return base.CanConvertFrom(context, sourceType); + } + + public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) + { + var text = value as string; + if (text != null) + { + return ConvertToConfigurationStabilityPointStructuresLoadSchematizationType(text); + } + var loadSchematizationType = value as LoadSchematizationType?; + if (loadSchematizationType != null) + { + return ConvertToConfigurationStabilityPointStructuresLoadSchematizationType(loadSchematizationType.Value); + } + return base.ConvertFrom(context, culture, value); + } + + /// + /// Converts to . + /// + /// The to convert. + /// The converted . + /// Thrown when is not supported. + private static ConfigurationStabilityPointStructuresLoadSchematizationType ConvertToConfigurationStabilityPointStructuresLoadSchematizationType( + LoadSchematizationType loadSchematizationType) + { + switch (loadSchematizationType) + { + case LoadSchematizationType.Linear: + return ConfigurationStabilityPointStructuresLoadSchematizationType.Linear; + case LoadSchematizationType.Quadratic: + return ConfigurationStabilityPointStructuresLoadSchematizationType.Quadratic; + default: + throw new NotSupportedException($"Value '{loadSchematizationType}' is not supported."); + } + } + + /// + /// Converts to . + /// + /// The to convert. + /// The converted . + /// Thrown when is not supported. + private static ConfigurationStabilityPointStructuresLoadSchematizationType ConvertToConfigurationStabilityPointStructuresLoadSchematizationType( + string text) + { + switch (text) + { + case StabilityPointStructuresConfigurationSchemaIdentifiers.LoadSchematizationLinearStructure: + return ConfigurationStabilityPointStructuresLoadSchematizationType.Linear; + case StabilityPointStructuresConfigurationSchemaIdentifiers.LoadSchematizationQuadraticStructure: + return ConfigurationStabilityPointStructuresLoadSchematizationType.Quadratic; + default: + throw new NotSupportedException($"Value '{text}' is not supported."); + } + } + + /// + /// Converts the given to a . + /// + /// The to convert. + /// The converted . + /// Thrown when is not supported. + private static LoadSchematizationType ConvertToLoadSchematizationType(ConfigurationStabilityPointStructuresLoadSchematizationType type) + { + switch (type) + { + case ConfigurationStabilityPointStructuresLoadSchematizationType.Linear: + return LoadSchematizationType.Linear; + case ConfigurationStabilityPointStructuresLoadSchematizationType.Quadratic: + return LoadSchematizationType.Quadratic; + default: + throw new NotSupportedException($"Value '{type}' is not supported."); + } + } + + /// + /// Converts the given to a . + /// + /// The to convert. + /// The converted . + /// Thrown when is not supported. + private static string ConvertToString(ConfigurationStabilityPointStructuresLoadSchematizationType type) + { + switch (type) + { + case ConfigurationStabilityPointStructuresLoadSchematizationType.Linear: + return StabilityPointStructuresConfigurationSchemaIdentifiers.LoadSchematizationLinearStructure; + case ConfigurationStabilityPointStructuresLoadSchematizationType.Quadratic: + return StabilityPointStructuresConfigurationSchemaIdentifiers.LoadSchematizationQuadraticStructure; + default: + throw new NotSupportedException($"Value '{type}' is not supported."); + } + } + } +} \ No newline at end of file Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/StabilityPointStructuresCalculationConfiguration.cs =================================================================== diff -u --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/StabilityPointStructuresCalculationConfiguration.cs (revision 0) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/StabilityPointStructuresCalculationConfiguration.cs (revision 56beff6e761d1d6f07fcd566791a03baad5c7358) @@ -0,0 +1,159 @@ +// 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 System; +using Ringtoets.Common.IO.Configurations; + +namespace Ringtoets.StabilityPointStructures.IO.Configurations +{ + /// + /// Configuration of a stability point structures calculation. + /// + public class StabilityPointStructuresCalculationConfiguration : StructuresCalculationConfiguration + { + /// + /// Creates a new instance of . + /// + /// The name of the . + /// Thrown when is null. + public StabilityPointStructuresCalculationConfiguration(string name) : base(name) {} + + /// + /// Gets or sets the stochast configuration for the area flow apertures of the structure. + /// + public MeanStandardDeviationStochastConfiguration AreaFlowApertures { get; set; } + + /// + /// Gets or sets the stochast configuration for the bank width of the structure. + /// + public MeanStandardDeviationStochastConfiguration BankWidth { get; set; } + + /// + /// Gets or sets the stochast configuration for the constructive strength of the linear load model of the structure. + /// + public MeanVariationCoefficientStochastConfiguration ConstructiveStrengthLinearLoadModel { get; set; } + + /// + /// Gets or sets the stochast configuration for the constructive strength of the quadratic load model of the structure. + /// + public MeanVariationCoefficientStochastConfiguration ConstructiveStrengthQuadraticLoadModel { get; set; } + + /// + /// Gets or sets the stochast configuration for the drain coefficient of the structure. + /// + public MeanStandardDeviationStochastConfiguration DrainCoefficient { get; set; } + + /// + /// Gets or sets the evaluation level of the structure. + /// + public double? EvaluationLevel { get; set; } + + /// + /// Gets or sets the stochast configuration for the failure collision energy of the structure. + /// + public MeanVariationCoefficientStochastConfiguration FailureCollisionEnergy { get; set; } + + /// + /// Gets or sets the failure probability of repairing a closure of the structure. + /// + public double? FailureProbabilityRepairClosure { get; set; } + + /// + /// Gets or sets the stochast configuration for the flow velocity structure closable of the structure. + /// + public MeanVariationCoefficientStochastConfiguration FlowVelocityStructureClosable { get; set; } + + /// + /// Gets or sets the inflow model type of the structure. + /// + public ConfigurationStabilityPointStructuresInflowModelType? InflowModelType { get; set; } + + /// + /// Gets or sets the stochast configuration for the inside water level of the structure. + /// + public MeanStandardDeviationStochastConfiguration InsideWaterLevel { get; set; } + + /// + /// Gets or sets the stochast configuration for the inside water level failure construction of the structure. + /// + public MeanStandardDeviationStochastConfiguration InsideWaterLevelFailureConstruction { get; set; } + + /// + /// Gets or sets the stochast configuration for the crest level of the structure. + /// + public MeanStandardDeviationStochastConfiguration LevelCrestStructure { get; set; } + + /// + /// Gets or sets the leveling count of the structure. + /// + public int? LevellingCount { get; set; } + + /// + /// Gets or sets the load schematization type of the structure. + /// + public ConfigurationStabilityPointStructuresLoadSchematizationType? LoadSchematizationType { get; set; } + + /// + /// Gets or sets the probability of a secondary collision on the structure per leveling. + /// + public double? ProbabilityCollisionSecondaryStructure { get; set; } + + /// + /// Gets or sets the stochast configuration for the mass of the ship. + /// + public MeanVariationCoefficientStochastConfiguration ShipMass { get; set; } + + /// + /// Gets or sets the stochast configuration for the velocity of the ship. + /// + public MeanVariationCoefficientStochastConfiguration ShipVelocity { get; set; } + + /// + /// Gets or sets the stochast configuration for the stability properties of the linear load model of the structure. + /// + public MeanVariationCoefficientStochastConfiguration StabilityLinearLoadModel { get; set; } + + /// + /// Gets or sets the stochast configuration for the stability properties of the quadratic load model of the structure. + /// + public MeanVariationCoefficientStochastConfiguration StabilityQuadraticLoadModel { get; set; } + + /// + /// Gets or sets the stochast configuration for the threshold height of the open weir of the structure. + /// + public MeanStandardDeviationStochastConfiguration ThresholdHeightOpenWeir { get; set; } + + /// + /// Gets or sets the vertical distance of the structure. + /// + public double? VerticalDistance { get; set; } + + /// + /// Gets or sets the factor for the storm duration for an open structure. + /// + public double? FactorStormDurationOpenStructure { get; set; } + + /// + /// Gets or sets the volumic weight of water. + /// + public double? VolumicWeightWater { get; set; } + } +} \ No newline at end of file Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/StabilityPointStructuresCalculationConfigurationExporter.cs =================================================================== diff -u --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/StabilityPointStructuresCalculationConfigurationExporter.cs (revision 0) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/StabilityPointStructuresCalculationConfigurationExporter.cs (revision 56beff6e761d1d6f07fcd566791a03baad5c7358) @@ -0,0 +1,160 @@ +// 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 System; +using System.Collections.Generic; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.DikeProfiles; +using Ringtoets.Common.Data.Structures; +using Ringtoets.Common.IO.Configurations; +using Ringtoets.Common.IO.Configurations.Helpers; +using Ringtoets.Common.IO.Exporters; +using Ringtoets.StabilityPointStructures.Data; +using Ringtoets.StabilityPointStructures.IO.Configurations.Helpers; + +namespace Ringtoets.StabilityPointStructures.IO.Configurations +{ + /// + /// Exports a stability point structures calculation configuration and stores it as an XML file. + /// + public class StabilityPointStructuresCalculationConfigurationExporter : SchemaCalculationConfigurationExporter< + StabilityPointStructuresCalculationConfigurationWriter, + StructuresCalculation, + StabilityPointStructuresCalculationConfiguration> + { + /// + /// Creates a new instance of . + /// + /// The calculation configuration to export. + /// The path of the XML file to export to. + /// Thrown when is null. + /// Thrown when is invalid. + public StabilityPointStructuresCalculationConfigurationExporter(IEnumerable calculations, string filePath) + : base(calculations, filePath) { } + + protected override StabilityPointStructuresCalculationConfigurationWriter CreateWriter(string filePath) + { + return new StabilityPointStructuresCalculationConfigurationWriter(filePath); + } + + protected override StabilityPointStructuresCalculationConfiguration ToConfiguration(StructuresCalculation calculation) + { + var calculationConfiguration = new StabilityPointStructuresCalculationConfiguration(calculation.Name); + StabilityPointStructuresInput input = calculation.InputParameters; + + calculationConfiguration.DrainCoefficient = input.DrainCoefficient.ToStochastConfigurationWithMean(); + calculationConfiguration.FactorStormDurationOpenStructure = input.FactorStormDurationOpenStructure; + calculationConfiguration.FailureProbabilityStructureWithErosion = input.FailureProbabilityStructureWithErosion; + calculationConfiguration.HydraulicBoundaryLocationName = input.HydraulicBoundaryLocation?.Name; + + calculationConfiguration.ModelFactorSuperCriticalFlow = input.ModelFactorSuperCriticalFlow.ToStochastConfigurationWithMean(); + calculationConfiguration.VolumicWeightWater = input.VolumicWeightWater; + calculationConfiguration.StormDuration = input.StormDuration.ToStochastConfigurationWithMean(); + + SetConfigurationStructureDependendParameters(calculationConfiguration, input); + + SetConfigurationForeshoreProfileDependendParameters(calculationConfiguration, input); + + return calculationConfiguration; + } + + private static void SetConfigurationStructureDependendParameters(StabilityPointStructuresCalculationConfiguration calculationConfiguration, + StabilityPointStructuresInput input) + { + if (input.Structure == null) + { + return; + } + var inflowModelTypeConverter = new ConfigurationStabilityPointStructuresInflowModelTypeConverter(); + + calculationConfiguration.AllowedLevelIncreaseStorage = input.AllowedLevelIncreaseStorage.ToStochastConfiguration(); + calculationConfiguration.AreaFlowApertures = input.AreaFlowApertures.ToStochastConfiguration(); + calculationConfiguration.BankWidth = input.BankWidth.ToStochastConfiguration(); + calculationConfiguration.ConstructiveStrengthLinearLoadModel = input.ConstructiveStrengthLinearLoadModel.ToStochastConfiguration(); + + calculationConfiguration.ConstructiveStrengthQuadraticLoadModel = input.ConstructiveStrengthQuadraticLoadModel.ToStochastConfiguration(); + calculationConfiguration.CriticalOvertoppingDischarge = input.CriticalOvertoppingDischarge.ToStochastConfiguration(); + calculationConfiguration.EvaluationLevel = input.EvaluationLevel; + calculationConfiguration.FailureCollisionEnergy = input.FailureCollisionEnergy.ToStochastConfiguration(); + + calculationConfiguration.FailureProbabilityRepairClosure = input.FailureProbabilityRepairClosure; + calculationConfiguration.FlowVelocityStructureClosable = input.FlowVelocityStructureClosable.ToStochastConfigurationWithMean(); + calculationConfiguration.FlowWidthAtBottomProtection = input.FlowWidthAtBottomProtection.ToStochastConfiguration(); + if (Enum.IsDefined(typeof(StabilityPointStructureInflowModelType), input.InflowModelType)) + { + calculationConfiguration.InflowModelType = (ConfigurationStabilityPointStructuresInflowModelType?) inflowModelTypeConverter.ConvertFrom(input.InflowModelType); + } + + calculationConfiguration.InsideWaterLevel = input.InsideWaterLevel.ToStochastConfiguration(); + calculationConfiguration.InsideWaterLevelFailureConstruction = input.InsideWaterLevelFailureConstruction.ToStochastConfiguration(); + calculationConfiguration.LevelCrestStructure = input.LevelCrestStructure.ToStochastConfiguration(); + calculationConfiguration.LevellingCount = input.LevellingCount; + + SetConfigurationLoadSchematizationType(calculationConfiguration, input); + calculationConfiguration.ProbabilityCollisionSecondaryStructure = input.ProbabilityCollisionSecondaryStructure; + calculationConfiguration.ShipMass = input.ShipMass.ToStochastConfiguration(); + calculationConfiguration.ShipVelocity = input.ShipVelocity.ToStochastConfiguration(); + + calculationConfiguration.StabilityLinearLoadModel = input.StabilityLinearLoadModel.ToStochastConfiguration(); + calculationConfiguration.StabilityQuadraticLoadModel = input.StabilityQuadraticLoadModel.ToStochastConfiguration(); + calculationConfiguration.StorageStructureArea = input.StorageStructureArea.ToStochastConfiguration(); + calculationConfiguration.StructureName = input.Structure.Name; + + calculationConfiguration.StructureNormalOrientation = input.StructureNormalOrientation; + calculationConfiguration.ThresholdHeightOpenWeir = input.ThresholdHeightOpenWeir.ToStochastConfiguration(); + calculationConfiguration.VerticalDistance = input.VerticalDistance; + calculationConfiguration.WidthFlowApertures = input.WidthFlowApertures.ToStochastConfiguration(); + } + + private static void SetConfigurationLoadSchematizationType(StabilityPointStructuresCalculationConfiguration calculationConfiguration, StabilityPointStructuresInput input) + { + if (!Enum.IsDefined(typeof(LoadSchematizationType), input.LoadSchematizationType)) + { + return; + } + var loadSchematizationTypeConverter = new ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter(); + calculationConfiguration.LoadSchematizationType = (ConfigurationStabilityPointStructuresLoadSchematizationType?) loadSchematizationTypeConverter.ConvertFrom(input.LoadSchematizationType); + } + + private static void SetConfigurationForeshoreProfileDependendParameters(StructuresCalculationConfiguration calculationConfiguration, + StabilityPointStructuresInput input) + { + if (input.ForeshoreProfile == null) + { + return; + } + + var breakWaterTypeConverter = new ConfigurationBreakWaterTypeConverter(); + calculationConfiguration.ForeshoreProfileName = input.ForeshoreProfile?.Name; + calculationConfiguration.WaveReduction = new WaveReductionConfiguration + { + UseForeshoreProfile = input.UseForeshore, + UseBreakWater = input.UseBreakWater, + BreakWaterHeight = input.BreakWater.Height + }; + + if (Enum.IsDefined(typeof(BreakWaterType), input.BreakWater.Type)) + { + calculationConfiguration.WaveReduction.BreakWaterType = (ConfigurationBreakWaterType?) breakWaterTypeConverter.ConvertFrom(input.BreakWater.Type); + } + } + } +} \ No newline at end of file Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/StabilityPointStructuresCalculationConfigurationReader.cs =================================================================== diff -u --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/StabilityPointStructuresCalculationConfigurationReader.cs (revision 0) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/StabilityPointStructuresCalculationConfigurationReader.cs (revision 56beff6e761d1d6f07fcd566791a03baad5c7358) @@ -0,0 +1,188 @@ +// 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 System; +using System.Collections.Generic; +using System.Xml.Linq; +using Core.Common.Base.IO; +using Ringtoets.Common.IO.Configurations; +using Ringtoets.Common.IO.Configurations.Helpers; +using Ringtoets.Common.IO.Readers; +using Ringtoets.Common.IO.Schema; +using Ringtoets.StabilityPointStructures.IO.Configurations.Helpers; +using Ringtoets.StabilityPointStructures.IO.Properties; +using RingtoetsCommonIOResources = Ringtoets.Common.IO.Properties.Resources; + +namespace Ringtoets.StabilityPointStructures.IO.Configurations +{ + /// + /// Reader for reading a stability point structures calculation configuration from XML and creating a collection + /// of corresponding . + /// + public class StabilityPointStructuresCalculationConfigurationReader : CalculationConfigurationReader + { + private const string hrLocatieSchemaName = "HrLocatieSchema.xsd"; + private const string orientatieSchemaName = "OrientatieSchema.xsd"; + private const string golfReductieSchemaName = "GolfReductieSchema.xsd"; + private const string voorlandProfielSchemaName = "VoorlandProfielSchema.xsd"; + private const string stochastSchemaName = "StochastSchema.xsd"; + private const string stochastStandaardafwijkingSchemaName = "StochastStandaardafwijkingSchema.xsd"; + private const string stochastVariatiecoefficientSchemaName = "StochastVariatiecoefficientSchema.xsd"; + private const string structureBaseSchemaName = "KunstwerkenBasisSchema.xsd"; + + /// + /// Creates a new instance of . + /// + /// The file path to the XML file. + /// Thrown when is invalid. + /// Thrown when: + /// + /// points to a file that does not exist. + /// points to a file that does not contain valid XML. + /// points to a file that does not pass the schema validation. + /// points to a file that does not contain configuration elements. + /// + /// + public StabilityPointStructuresCalculationConfigurationReader(string filePath) + : base(filePath, + Resources.StabilityPointStructuresConfigurationSchema, + new Dictionary + { + { + hrLocatieSchemaName, RingtoetsCommonIOResources.HrLocatieSchema + }, + { + orientatieSchemaName, RingtoetsCommonIOResources.OrientatieSchema + }, + { + voorlandProfielSchemaName, RingtoetsCommonIOResources.VoorlandProfielSchema + }, + { + golfReductieSchemaName, RingtoetsCommonIOResources.GolfReductieSchema + }, + { + stochastSchemaName, RingtoetsCommonIOResources.StochastSchema + }, + { + stochastStandaardafwijkingSchemaName, RingtoetsCommonIOResources.StochastStandaardafwijkingSchema + }, + { + stochastVariatiecoefficientSchemaName, RingtoetsCommonIOResources.StochastVariatiecoefficientSchema + }, + { + structureBaseSchemaName, RingtoetsCommonIOResources.KunstwerkenBasisSchema + } + } + ) { } + + protected override StabilityPointStructuresCalculationConfiguration ParseCalculationElement(XElement calculationElement) + { + return new StabilityPointStructuresCalculationConfiguration(calculationElement.Attribute(ConfigurationSchemaIdentifiers.NameAttribute).Value) + { + AllowedLevelIncreaseStorage = GetStandardDeviationStochastParameters(calculationElement, ConfigurationSchemaIdentifiers.AllowedLevelIncreaseStorageStochastName), + AreaFlowApertures = GetStandardDeviationStochastParameters(calculationElement, StabilityPointStructuresConfigurationSchemaIdentifiers.AreaFlowAperturesStochastName), + BankWidth = GetStandardDeviationStochastParameters(calculationElement, StabilityPointStructuresConfigurationSchemaIdentifiers.BankWidthStochastName), + CriticalOvertoppingDischarge = GetVariationCoefficientStochastParameters(calculationElement, ConfigurationSchemaIdentifiers.CriticalOvertoppingDischargeStochastName), + ConstructiveStrengthLinearLoadModel = GetVariationCoefficientStochastParameters(calculationElement, StabilityPointStructuresConfigurationSchemaIdentifiers.ConstructiveStrengthLinearLoadModelStochastName), + ConstructiveStrengthQuadraticLoadModel = GetVariationCoefficientStochastParameters(calculationElement, StabilityPointStructuresConfigurationSchemaIdentifiers.ConstructiveStrengthQuadraticLoadModelStochastName), + DrainCoefficient = GetStandardDeviationStochastParameters(calculationElement, StabilityPointStructuresConfigurationSchemaIdentifiers.DrainCoefficientStochastName), + EvaluationLevel = calculationElement.GetDoubleValueFromDescendantElement(StabilityPointStructuresConfigurationSchemaIdentifiers.EvaluationLevelElement), + FactorStormDurationOpenStructure = calculationElement.GetDoubleValueFromDescendantElement(StabilityPointStructuresConfigurationSchemaIdentifiers.FactorStormDurationOpenStructureElement), + FailureCollisionEnergy = GetVariationCoefficientStochastParameters(calculationElement, StabilityPointStructuresConfigurationSchemaIdentifiers.FailureCollisionEnergyStochastName), + FailureProbabilityRepairClosure = calculationElement.GetDoubleValueFromDescendantElement(StabilityPointStructuresConfigurationSchemaIdentifiers.FailureProbabilityRepairClosureElement), + FailureProbabilityStructureWithErosion = calculationElement.GetDoubleValueFromDescendantElement(ConfigurationSchemaIdentifiers.FailureProbabilityStructureWithErosionElement), + FlowVelocityStructureClosable = GetVariationCoefficientStochastParameters(calculationElement, StabilityPointStructuresConfigurationSchemaIdentifiers.FlowVelocityStructureClosableStochastName), + FlowWidthAtBottomProtection = GetStandardDeviationStochastParameters(calculationElement, ConfigurationSchemaIdentifiers.FlowWidthAtBottomProtectionStochastName), + ForeshoreProfileName = calculationElement.GetStringValueFromDescendantElement(ConfigurationSchemaIdentifiers.ForeshoreProfileNameElement), + HydraulicBoundaryLocationName = calculationElement.GetStringValueFromDescendantElement(ConfigurationSchemaIdentifiers.HydraulicBoundaryLocationElement), + InflowModelType = (ConfigurationStabilityPointStructuresInflowModelType?) + calculationElement.GetConvertedValueFromDescendantStringElement( + StabilityPointStructuresConfigurationSchemaIdentifiers.InflowModelTypeElement), + InsideWaterLevel = GetStandardDeviationStochastParameters(calculationElement, StabilityPointStructuresConfigurationSchemaIdentifiers.InsideWaterLevelStochastName), + InsideWaterLevelFailureConstruction = GetStandardDeviationStochastParameters(calculationElement, StabilityPointStructuresConfigurationSchemaIdentifiers.InsideWaterLevelFailureConstructionStochastName), + LevelCrestStructure = GetStandardDeviationStochastParameters(calculationElement, StabilityPointStructuresConfigurationSchemaIdentifiers.LevelCrestStructureStochastName), + LevellingCount = calculationElement.GetIntegerValueFromDescendantElement(StabilityPointStructuresConfigurationSchemaIdentifiers.LevellingCountElement), + LoadSchematizationType = (ConfigurationStabilityPointStructuresLoadSchematizationType?) + calculationElement.GetConvertedValueFromDescendantStringElement( + StabilityPointStructuresConfigurationSchemaIdentifiers.LoadSchematizationTypeElement), + ProbabilityCollisionSecondaryStructure = calculationElement.GetDoubleValueFromDescendantElement(StabilityPointStructuresConfigurationSchemaIdentifiers.ProbabilityCollisionSecondaryStructureElement), + ModelFactorSuperCriticalFlow = GetStandardDeviationStochastParameters(calculationElement, ConfigurationSchemaIdentifiers.ModelFactorSuperCriticalFlowStochastName), + ShipMass = GetVariationCoefficientStochastParameters(calculationElement, StabilityPointStructuresConfigurationSchemaIdentifiers.ShipMassStochastName), + ShipVelocity = GetVariationCoefficientStochastParameters(calculationElement, StabilityPointStructuresConfigurationSchemaIdentifiers.ShipVelocityStochastName), + StabilityLinearLoadModel = GetVariationCoefficientStochastParameters(calculationElement, StabilityPointStructuresConfigurationSchemaIdentifiers.StabilityLinearLoadModelStochastName), + StabilityQuadraticLoadModel = GetVariationCoefficientStochastParameters(calculationElement, StabilityPointStructuresConfigurationSchemaIdentifiers.StabilityQuadraticLoadModelStochastName), + StructureName = calculationElement.GetStringValueFromDescendantElement(ConfigurationSchemaIdentifiers.StructureElement), + StorageStructureArea = GetVariationCoefficientStochastParameters(calculationElement, ConfigurationSchemaIdentifiers.StorageStructureAreaStochastName), + StormDuration = GetVariationCoefficientStochastParameters(calculationElement, ConfigurationSchemaIdentifiers.StormDurationStochastName), + StructureNormalOrientation = calculationElement.GetDoubleValueFromDescendantElement(ConfigurationSchemaIdentifiers.Orientation), + ThresholdHeightOpenWeir = GetStandardDeviationStochastParameters(calculationElement, StabilityPointStructuresConfigurationSchemaIdentifiers.ThresholdHeightOpenWeirStochastName), + VerticalDistance = calculationElement.GetDoubleValueFromDescendantElement(StabilityPointStructuresConfigurationSchemaIdentifiers.VerticalDistanceElement), + VolumicWeightWater = calculationElement.GetDoubleValueFromDescendantElement(StabilityPointStructuresConfigurationSchemaIdentifiers.VolumicWeightWaterElement), + WaveReduction = GetWaveReductionParameters(calculationElement), + WidthFlowApertures = GetStandardDeviationStochastParameters(calculationElement, ConfigurationSchemaIdentifiers.WidthFlowAperturesStochastName) + }; + } + + private static WaveReductionConfiguration GetWaveReductionParameters(XElement calculationElement) + { + XElement waveReduction = calculationElement.GetDescendantElement(ConfigurationSchemaIdentifiers.WaveReduction); + if (waveReduction != null) + { + return new WaveReductionConfiguration + { + BreakWaterType = (ConfigurationBreakWaterType?) calculationElement.GetConvertedValueFromDescendantStringElement(ConfigurationSchemaIdentifiers.BreakWaterType), + BreakWaterHeight = calculationElement.GetDoubleValueFromDescendantElement(ConfigurationSchemaIdentifiers.BreakWaterHeight), + UseBreakWater = calculationElement.GetBoolValueFromDescendantElement(ConfigurationSchemaIdentifiers.UseBreakWater), + UseForeshoreProfile = calculationElement.GetBoolValueFromDescendantElement(ConfigurationSchemaIdentifiers.UseForeshore) + }; + } + return null; + } + + private static MeanVariationCoefficientStochastConfiguration GetVariationCoefficientStochastParameters(XElement calculationElement, string stochastName) + { + XElement element = calculationElement.GetStochastElement(stochastName); + if (element != null) + { + return new MeanVariationCoefficientStochastConfiguration + { + Mean = element.GetDoubleValueFromDescendantElement(ConfigurationSchemaIdentifiers.MeanElement), + VariationCoefficient = element.GetDoubleValueFromDescendantElement(ConfigurationSchemaIdentifiers.VariationCoefficientElement) + }; + } + return null; + } + + private static MeanStandardDeviationStochastConfiguration GetStandardDeviationStochastParameters(XElement calculationElement, string stochastName) + { + XElement element = calculationElement.GetStochastElement(stochastName); + if (element != null) + { + return new MeanStandardDeviationStochastConfiguration + { + Mean = element.GetDoubleValueFromDescendantElement(ConfigurationSchemaIdentifiers.MeanElement), + StandardDeviation = element.GetDoubleValueFromDescendantElement(ConfigurationSchemaIdentifiers.StandardDeviationElement) + }; + } + return null; + } + } +} \ No newline at end of file Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/StabilityPointStructuresCalculationConfigurationWriter.cs =================================================================== diff -u --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/StabilityPointStructuresCalculationConfigurationWriter.cs (revision 0) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/StabilityPointStructuresCalculationConfigurationWriter.cs (revision 56beff6e761d1d6f07fcd566791a03baad5c7358) @@ -0,0 +1,151 @@ +// 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 System; +using System.Xml; +using Ringtoets.Common.IO.Writers; +using Ringtoets.StabilityPointStructures.IO.Configurations.Helpers; + +namespace Ringtoets.StabilityPointStructures.IO.Configurations +{ + /// + /// Writer for writing in XML format to file. + /// + public class StabilityPointStructuresCalculationConfigurationWriter : StructureCalculationConfigurationWriter + { + /// + /// Creates a new instance of . + /// + /// The path of the file to write to. + /// Thrown when is invalid. + /// A valid path: + /// + /// is not empty or null, + /// does not consist out of only whitespace characters, + /// does not contain an invalid character, + /// does not end with a directory or path separator (empty file name). + /// + public StabilityPointStructuresCalculationConfigurationWriter(string filePath) : base(filePath) {} + + protected override void WriteSpecificStructureParameters(StabilityPointStructuresCalculationConfiguration configuration, XmlWriter writer) + { + WriteElementWhenContentAvailable(writer, + StabilityPointStructuresConfigurationSchemaIdentifiers.EvaluationLevelElement, + configuration.EvaluationLevel); + WriteElementWhenContentAvailable(writer, + StabilityPointStructuresConfigurationSchemaIdentifiers.FactorStormDurationOpenStructureElement, + configuration.FactorStormDurationOpenStructure); + WriteElementWhenContentAvailable(writer, + StabilityPointStructuresConfigurationSchemaIdentifiers.FailureProbabilityRepairClosureElement, + configuration.FailureProbabilityRepairClosure); + + WriteConfigurationInflowModelTypeWhenAvailable(writer, configuration.InflowModelType); + + WriteConfigurationLoadSchematizationTypeWhenAvailable(writer, configuration.LoadSchematizationType); + + WriteElementWhenContentAvailable(writer, + StabilityPointStructuresConfigurationSchemaIdentifiers.LevellingCountElement, + configuration.LevellingCount); + WriteElementWhenContentAvailable(writer, + StabilityPointStructuresConfigurationSchemaIdentifiers.ProbabilityCollisionSecondaryStructureElement, + configuration.ProbabilityCollisionSecondaryStructure); + WriteElementWhenContentAvailable(writer, + StabilityPointStructuresConfigurationSchemaIdentifiers.VerticalDistanceElement, + configuration.VerticalDistance); + WriteElementWhenContentAvailable(writer, + StabilityPointStructuresConfigurationSchemaIdentifiers.VolumicWeightWaterElement, + configuration.VolumicWeightWater); + } + + protected override void WriteSpecificStochasts(StabilityPointStructuresCalculationConfiguration configuration, XmlWriter writer) + { + WriteDistributionWhenAvailable(writer, + StabilityPointStructuresConfigurationSchemaIdentifiers.AreaFlowAperturesStochastName, + configuration.AreaFlowApertures); + WriteDistributionWhenAvailable(writer, + StabilityPointStructuresConfigurationSchemaIdentifiers.BankWidthStochastName, + configuration.BankWidth); + WriteDistributionWhenAvailable(writer, + StabilityPointStructuresConfigurationSchemaIdentifiers.ConstructiveStrengthLinearLoadModelStochastName, + configuration.ConstructiveStrengthLinearLoadModel); + WriteDistributionWhenAvailable(writer, + StabilityPointStructuresConfigurationSchemaIdentifiers.ConstructiveStrengthQuadraticLoadModelStochastName, + configuration.ConstructiveStrengthQuadraticLoadModel); + WriteDistributionWhenAvailable(writer, + StabilityPointStructuresConfigurationSchemaIdentifiers.DrainCoefficientStochastName, + configuration.DrainCoefficient); + WriteDistributionWhenAvailable(writer, + StabilityPointStructuresConfigurationSchemaIdentifiers.FailureCollisionEnergyStochastName, + configuration.FailureCollisionEnergy); + WriteDistributionWhenAvailable(writer, + StabilityPointStructuresConfigurationSchemaIdentifiers.FlowVelocityStructureClosableStochastName, + configuration.FlowVelocityStructureClosable); + WriteDistributionWhenAvailable(writer, + StabilityPointStructuresConfigurationSchemaIdentifiers.InsideWaterLevelStochastName, + configuration.InsideWaterLevel); + WriteDistributionWhenAvailable(writer, + StabilityPointStructuresConfigurationSchemaIdentifiers.InsideWaterLevelFailureConstructionStochastName, + configuration.InsideWaterLevelFailureConstruction); + WriteDistributionWhenAvailable(writer, + StabilityPointStructuresConfigurationSchemaIdentifiers.LevelCrestStructureStochastName, + configuration.LevelCrestStructure); + WriteDistributionWhenAvailable(writer, + StabilityPointStructuresConfigurationSchemaIdentifiers.ShipMassStochastName, + configuration.ShipMass); + WriteDistributionWhenAvailable(writer, + StabilityPointStructuresConfigurationSchemaIdentifiers.ShipVelocityStochastName, + configuration.ShipVelocity); + WriteDistributionWhenAvailable(writer, + StabilityPointStructuresConfigurationSchemaIdentifiers.StabilityLinearLoadModelStochastName, + configuration.StabilityLinearLoadModel); + WriteDistributionWhenAvailable(writer, + StabilityPointStructuresConfigurationSchemaIdentifiers.StabilityQuadraticLoadModelStochastName, + configuration.StabilityQuadraticLoadModel); + WriteDistributionWhenAvailable(writer, + StabilityPointStructuresConfigurationSchemaIdentifiers.ThresholdHeightOpenWeirStochastName, + configuration.ThresholdHeightOpenWeir); + } + + private static void WriteConfigurationLoadSchematizationTypeWhenAvailable(XmlWriter writer, ConfigurationStabilityPointStructuresLoadSchematizationType? configuration) + { + if (!configuration.HasValue) + { + return; + } + + var converter = new ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter(); + writer.WriteElementString(StabilityPointStructuresConfigurationSchemaIdentifiers.LoadSchematizationTypeElement, + converter.ConvertToInvariantString(configuration.Value)); + } + + private static void WriteConfigurationInflowModelTypeWhenAvailable(XmlWriter writer, ConfigurationStabilityPointStructuresInflowModelType? configuration) + { + if (!configuration.HasValue) + { + return; + } + + var converter = new ConfigurationStabilityPointStructuresInflowModelTypeConverter(); + writer.WriteElementString(StabilityPointStructuresConfigurationSchemaIdentifiers.InflowModelTypeElement, + converter.ConvertToInvariantString(configuration.Value)); + } + } +} \ No newline at end of file Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/StabilityPointStructuresConfigurationSchemaIdentifiers.cs =================================================================== diff -u --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/StabilityPointStructuresConfigurationSchemaIdentifiers.cs (revision 0) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/StabilityPointStructuresConfigurationSchemaIdentifiers.cs (revision 56beff6e761d1d6f07fcd566791a03baad5c7358) @@ -0,0 +1,173 @@ +// 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. + +namespace Ringtoets.StabilityPointStructures.IO.Configurations +{ + /// + /// Container of identifiers related to stability point structures calculation configuration schema definitions. + /// + public static class StabilityPointStructuresConfigurationSchemaIdentifiers + { + /// + /// The identifier for the area flow apertures stochast name. + /// + public const string AreaFlowAperturesStochastName = "doorstroomoppervlak"; + + /// + /// The identifier for the bank width stochast name. + /// + public const string BankWidthStochastName = "bermbreedte"; + + /// + /// The identifier for the constructive strength linear load model stochast name. + /// + public const string ConstructiveStrengthLinearLoadModelStochastName = "lineairebelastingschematiseringsterkte"; + + /// + /// The identifier for the constructive strength quadratic load model stochast name. + /// + public const string ConstructiveStrengthQuadraticLoadModelStochastName = "kwadratischebelastingschematiseringsterkte"; + + /// + /// The identifier for the drain coefficient stochast name. + /// + public const string DrainCoefficientStochastName = "afvoercoefficient"; + + /// + /// The identifier for evaluation level elements. + /// + public const string EvaluationLevelElement = "analysehoogte"; + + /// + /// The identifier for the failure collision energy stochast name. + /// + public const string FailureCollisionEnergyStochastName = "aanvaarenergie"; + + /// + /// The identifier for the failure probability of repairing a closure elements. + /// + public const string FailureProbabilityRepairClosureElement = "faalkansherstel"; + + /// + /// The identifier for the flow velocity structure closable stochast name. + /// + public const string FlowVelocityStructureClosableStochastName = "kritiekestroomsnelheid"; + + /// + /// The identifier for the type of stability point structure inflow model elements. + /// + public const string InflowModelTypeElement = "instroommodel"; + + /// + /// The possible content of the element indicating a + /// low sill structure. + /// + public const string InflowModelLowSillStructure = "lagedrempel"; + + /// + /// The possible content of the element indicating a + /// flooded culvert structure. + /// + public const string InflowModelFloodedCulvertStructure = "verdronkenkoker"; + + /// + /// The identifier for the inside water level stochast name. + /// + public const string InsideWaterLevelStochastName = "binnenwaterstand"; + + /// + /// The identifier for the inside water level failure construction stochast name. + /// + public const string InsideWaterLevelFailureConstructionStochastName = "binnenwaterstandbijfalen"; + + /// + /// The identifier for the level crest structure stochast name. + /// + public const string LevelCrestStructureStochastName = "kerendehoogte"; + + /// + /// The identifier for the leveling count elements. + /// + public const string LevellingCountElement = "nrnivelleringen"; + + /// + /// The identifier for the load schematization type elements. + /// + public const string LoadSchematizationTypeElement = "belastingschematisering"; + + /// + /// The possible content of the + /// element indicating a linear schematization. + /// + public const string LoadSchematizationLinearStructure = "lineair"; + + /// + /// The possible content of the + /// element indicating a quadratic schematization. + /// + public const string LoadSchematizationQuadraticStructure = "kwadratisch"; + + /// + /// The identifier for the probability of a secondary collision on the structure per leveling elements. + /// + public const string ProbabilityCollisionSecondaryStructureElement = "kansaanvaringtweedekeermiddel"; + + /// + /// The identifier for the mass of the ship stochast name. + /// + public const string ShipMassStochastName = "massaschip"; + + /// + /// The identifier for the velocity of the ship stochast name. + /// + public const string ShipVelocityStochastName = "aanvaarsnelheid"; + + /// + /// The identifier for the stability properties of the linear load model stochast name. + /// + public const string StabilityLinearLoadModelStochastName = "lineairebelastingschematiseringstabiliteit"; + + /// + /// The identifier for the stability properties of the quadratic load model stochast name. + /// + public const string StabilityQuadraticLoadModelStochastName = "kwadratischebelastingschematiseringstabiliteit"; + + /// + /// The identifier for the threshold height of the open weir stochast name. + /// + public const string ThresholdHeightOpenWeirStochastName = "drempelhoogte"; + + /// + /// The identifier for the vertical distance of the structure elements. + /// + public const string VerticalDistanceElement = "afstandonderkantwandteendijk"; + + /// + /// The identifier for the factor for the storm duration for an open structure elements. + /// + public const string FactorStormDurationOpenStructureElement = "factorstormduur"; + + /// + /// The identifier for the volumic weight of water elements. + /// + public const string VolumicWeightWaterElement = "volumiekgewichtwater"; + } +} \ No newline at end of file Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/StabilityPointStructuresImporter.cs =================================================================== diff -u --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/StabilityPointStructuresImporter.cs (revision 0) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/StabilityPointStructuresImporter.cs (revision 56beff6e761d1d6f07fcd566791a03baad5c7358) @@ -0,0 +1,216 @@ +// 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 System; +using System.Collections.Generic; +using System.Linq; +using Core.Common.Base; +using Core.Common.Base.Data; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.IO.FileImporters; +using Ringtoets.Common.IO.Structures; +using Ringtoets.StabilityPointStructures.Data; + +namespace Ringtoets.StabilityPointStructures.IO.Configurations +{ + /// + /// Imports point shapefiles containing stability point structure locations and csv files containing stability point structure schematizations. + /// + public class StabilityPointStructuresImporter : StructuresImporter> + { + /// + /// Creates a new instance of . + /// + /// The point structure structures to import on. + /// The reference line used to check if the + /// objects found in the file are intersecting it. + /// The path to the file to import from. + /// Thrown when , + /// , or is null. + public StabilityPointStructuresImporter(ObservableList importTarget, ReferenceLine referenceLine, string filePath) + : base(importTarget, referenceLine, filePath) { } + + protected override void CreateSpecificStructures(ICollection structureLocations, + Dictionary> groupedStructureParameterRows) + { + IEnumerable importedStabilityPointStructures = CreateStabilityPointStructures(structureLocations.ToList(), groupedStructureParameterRows); + + foreach (StabilityPointStructure stabilityPointStructure in importedStabilityPointStructures) + { + ImportTarget.Add(stabilityPointStructure); + } + } + + private IEnumerable CreateStabilityPointStructures(IList structureLocations, + Dictionary> groupedStructureParameterRows) + { + var stabilityPointStructures = new List(); + foreach (StructureLocation structureLocation in structureLocations) + { + string id = structureLocation.Id; + + List structureParameterRows = groupedStructureParameterRows.ContainsKey(id) + ? groupedStructureParameterRows[id] + : new List(); + + ValidationResult parameterRowsValidationResult = StructuresParameterRowsValidator.ValidateStabilityPointStructuresParameters(structureParameterRows); + if (!parameterRowsValidationResult.IsValid) + { + LogValidationErrorForStructure(structureLocation.Name, structureLocation.Id, parameterRowsValidationResult.ErrorMessages); + continue; + } + + StabilityPointStructure stabilityPointStructure = CreateStabilityPointStructure(structureLocation, structureParameterRows); + stabilityPointStructures.Add(stabilityPointStructure); + } + return stabilityPointStructures; + } + + private StabilityPointStructure CreateStabilityPointStructure(StructureLocation structureLocation, List structureParameterRows) + { + Dictionary rowData = structureParameterRows.ToDictionary(row => row.ParameterId, row => row, StringComparer.OrdinalIgnoreCase); + + string structureName = structureLocation.Name; + return new StabilityPointStructure( + new StabilityPointStructure.ConstructionProperties + { + Name = structureName, + Id = structureLocation.Id, + Location = structureLocation.Point, + StructureNormalOrientation = rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword1].NumericalValue, + StorageStructureArea = + { + Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword2].NumericalValue, + CoefficientOfVariation = GetCoefficientOfVariation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword2], structureName) + }, + AllowedLevelIncreaseStorage = + { + Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword3].NumericalValue, + StandardDeviation = GetStandardDeviation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword3], structureName) + }, + WidthFlowApertures = + { + Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword4].NumericalValue, + StandardDeviation = GetStandardDeviation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword4], structureName) + }, + InsideWaterLevel = + { + Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword5].NumericalValue, + StandardDeviation = GetStandardDeviation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword5], structureName) + }, + ThresholdHeightOpenWeir = + { + Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword6].NumericalValue, + StandardDeviation = GetStandardDeviation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword6], structureName) + }, + CriticalOvertoppingDischarge = + { + Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword7].NumericalValue, + CoefficientOfVariation = GetCoefficientOfVariation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword7], structureName) + }, + FlowWidthAtBottomProtection = + { + Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword8].NumericalValue, + StandardDeviation = GetStandardDeviation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword8], structureName) + }, + ConstructiveStrengthLinearLoadModel = + { + Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword9].NumericalValue, + CoefficientOfVariation = GetCoefficientOfVariation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword9], structureName) + }, + ConstructiveStrengthQuadraticLoadModel = + { + Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword10].NumericalValue, + CoefficientOfVariation = GetCoefficientOfVariation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword10], structureName) + }, + BankWidth = + { + Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword11].NumericalValue, + StandardDeviation = GetStandardDeviation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword11], structureName) + }, + InsideWaterLevelFailureConstruction = + { + Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword12].NumericalValue, + StandardDeviation = GetStandardDeviation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword12], structureName) + }, + EvaluationLevel = rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword13].NumericalValue, + LevelCrestStructure = + { + Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword14].NumericalValue, + StandardDeviation = GetStandardDeviation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword14], structureName) + }, + VerticalDistance = rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword15].NumericalValue, + FailureProbabilityRepairClosure = rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword16].NumericalValue, + FailureCollisionEnergy = + { + Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword17].NumericalValue, + CoefficientOfVariation = GetCoefficientOfVariation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword17], structureName) + }, + ShipMass = + { + Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword18].NumericalValue, + CoefficientOfVariation = GetCoefficientOfVariation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword18], structureName) + }, + ShipVelocity = + { + Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword19].NumericalValue, + CoefficientOfVariation = GetCoefficientOfVariation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword19], structureName) + }, + LevellingCount = (int) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword20].NumericalValue, + ProbabilityCollisionSecondaryStructure = rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword21].NumericalValue, + FlowVelocityStructureClosable = + { + Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword22].NumericalValue, + }, + StabilityLinearLoadModel = + { + Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword23].NumericalValue, + CoefficientOfVariation = GetCoefficientOfVariation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword23], structureName) + }, + StabilityQuadraticLoadModel = + { + Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword24].NumericalValue, + CoefficientOfVariation = GetCoefficientOfVariation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword24], structureName) + }, + AreaFlowApertures = + { + Mean = (RoundedDouble) rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword25].NumericalValue, + StandardDeviation = GetStandardDeviation(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword25], structureName) + }, + InflowModelType = GetStabilityPointStructureInflowModelType(rowData[StructureFilesKeywords.StabilityPointStructureParameterKeyword26]) + }); + } + + private static StabilityPointStructureInflowModelType GetStabilityPointStructureInflowModelType(StructuresParameterRow structureParameterRow) + { + string keywordValue = structureParameterRow.AlphanumericValue.ToLower(); + switch (keywordValue) + { + case StructureFilesKeywords.InflowModelTypeLowSill: + return StabilityPointStructureInflowModelType.LowSill; + case StructureFilesKeywords.InflowModelTypeFloodedCulvert: + return StabilityPointStructureInflowModelType.FloodedCulvert; + default: + throw new NotSupportedException(); + } + } + } +} \ No newline at end of file Fisheye: Tag 56beff6e761d1d6f07fcd566791a03baad5c7358 refers to a dead (removed) revision in file `Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Exporters/StabilityPointStructuresCalculationConfigurationExporter.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 56beff6e761d1d6f07fcd566791a03baad5c7358 refers to a dead (removed) revision in file `Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Importers/StabilityPointStructuresImporter.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 56beff6e761d1d6f07fcd566791a03baad5c7358 refers to a dead (removed) revision in file `Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Readers/StabilityPointStructuresCalculationConfigurationReader.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Ringtoets.StabilityPointStructures.IO.csproj =================================================================== diff -u -rdc66ef755cac379d0bf9723d772c319fa84cec92 -r56beff6e761d1d6f07fcd566791a03baad5c7358 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Ringtoets.StabilityPointStructures.IO.csproj (.../Ringtoets.StabilityPointStructures.IO.csproj) (revision dc66ef755cac379d0bf9723d772c319fa84cec92) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Ringtoets.StabilityPointStructures.IO.csproj (.../Ringtoets.StabilityPointStructures.IO.csproj) (revision 56beff6e761d1d6f07fcd566791a03baad5c7358) @@ -45,22 +45,22 @@ Properties\GlobalAssembly.cs - - - - - + + + + + True True Resources.resx - - + + - - - + + + @@ -99,9 +99,7 @@ Resources.Designer.cs - - - +