Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PropertyClasses/ClosingStructureProperties.cs =================================================================== diff -u -ra2c7b86519fdc614e1156b67ace16b5c9f265520 -rb70abd70f1cd326d1a753c5879a065149ac2ae84 --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PropertyClasses/ClosingStructureProperties.cs (.../ClosingStructureProperties.cs) (revision a2c7b86519fdc614e1156b67ace16b5c9f265520) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PropertyClasses/ClosingStructureProperties.cs (.../ClosingStructureProperties.cs) (revision b70abd70f1cd326d1a753c5879a065149ac2ae84) @@ -279,11 +279,11 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_Schematization")] [ResourcesDisplayName(typeof(Resources), "FailureProbablityOpenStructure_DisplayName")] [ResourcesDescription(typeof(Resources), "FailureProbablityOpenStructure_Description")] - public string FailureProbablityOpenStructure + public string FailureProbabilityOpenStructure { get { - return ProbabilityFormattingHelper.Format(data.FailureProbablityOpenStructure); + return ProbabilityFormattingHelper.Format(data.FailureProbabilityOpenStructure); } } Index: Ringtoets/Common/src/Ringtoets.Common.IO/Structures/StructureFilesKeywords.cs =================================================================== diff -u -re1cd9f27d423d4bfc6a0be647fa8388b3fefb8a2 -rb70abd70f1cd326d1a753c5879a065149ac2ae84 --- Ringtoets/Common/src/Ringtoets.Common.IO/Structures/StructureFilesKeywords.cs (.../StructureFilesKeywords.cs) (revision e1cd9f27d423d4bfc6a0be647fa8388b3fefb8a2) +++ Ringtoets/Common/src/Ringtoets.Common.IO/Structures/StructureFilesKeywords.cs (.../StructureFilesKeywords.cs) (revision b70abd70f1cd326d1a753c5879a065149ac2ae84) @@ -141,6 +141,136 @@ /// public const string ClosingStructureParameterKeyword15 = "KW_BETSLUIT15"; + /// + /// The first stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword1 = "KW_STERSTAB1"; + + /// + /// The second stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword2 = "KW_STERSTAB2"; + + /// + /// The third stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword3 = "KW_STERSTAB3"; + + /// + /// The fourth stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword4 = "KW_STERSTAB4"; + + /// + /// The fifth stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword5 = "KW_STERSTAB5"; + + /// + /// The sixth stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword6 = "KW_STERSTAB6"; + + /// + /// The seventh stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword7 = "KW_STERSTAB7"; + + /// + /// The eighth stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword8 = "KW_STERSTAB8"; + + /// + /// The ninth stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword9 = "KW_STERSTAB9"; + + /// + /// The tenth stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword10 = "KW_STERSTAB10"; + + /// + /// The eleventh stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword11 = "KW_STERSTAB11"; + + /// + /// The twelfth stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword12 = "KW_STERSTAB12"; + + /// + /// The thirteenth stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword13 = "KW_STERSTAB13"; + + /// + /// The fourteenth stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword14 = "KW_STERSTAB14"; + + /// + /// The fifteenth stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword15 = "KW_STERSTAB15"; + + /// + /// The sixteenth stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword16 = "KW_STERSTAB16"; + + /// + /// The seventeenth stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword17 = "KW_STERSTAB17"; + + /// + /// The eighteenth stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword18 = "KW_STERSTAB18"; + + /// + /// The nineteenth stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword19 = "KW_STERSTAB19"; + + /// + /// The twentieth stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword20 = "KW_STERSTAB20"; + + /// + /// The twenty-first stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword21 = "KW_STERSTAB21"; + + /// + /// The twenty-second stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword22 = "KW_STERSTAB22"; + + /// + /// The twenty-third stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword23 = "KW_STERSTAB23"; + + /// + /// The twenty-fourth stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword24 = "KW_STERSTAB24"; + + /// + /// The twenty-fifth stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword25 = "KW_STERSTAB25"; + + /// + /// The twenty-six stability point structure parameter keyword. + /// + public const string StabilityPointStructureParameterKeyword26 = "KW_STERSTAB26"; + #region Required Structure *.csv header column names /// Index: Ringtoets/Common/src/Ringtoets.Common.IO/Structures/StructuresParameterRowsValidator.cs =================================================================== diff -u -re1cd9f27d423d4bfc6a0be647fa8388b3fefb8a2 -rb70abd70f1cd326d1a753c5879a065149ac2ae84 --- Ringtoets/Common/src/Ringtoets.Common.IO/Structures/StructuresParameterRowsValidator.cs (.../StructuresParameterRowsValidator.cs) (revision e1cd9f27d423d4bfc6a0be647fa8388b3fefb8a2) +++ Ringtoets/Common/src/Ringtoets.Common.IO/Structures/StructuresParameterRowsValidator.cs (.../StructuresParameterRowsValidator.cs) (revision b70abd70f1cd326d1a753c5879a065149ac2ae84) @@ -36,20 +36,26 @@ private const int varianceValueColumn = 19; private const int varianceTypeColumn = 20; - private static List alphaNumericalKeywords = new List - { - "verticalewand", - "lagedrempel", - "verdronkenkoker" - }; - /// /// Denotes a small enough value, taking possible rounding into account, that the /// value is too close to the value 0.0 that makes a coefficient of variation /// to unreliable. /// private const double valueTooCloseToZero = 1e-4; + private static readonly List closingStructureInflowModelRuleKeywords = new List + { + "verticalewand", + "lagedrempel", + "verdronkenkoker" + }; + + private static readonly List stabilityPointStructureInflowModelRuleKeywords = new List + { + "lagedrempel", + "verdronkenkoker" + }; + private static readonly Dictionary>> heightStructuresRules = new Dictionary>> { @@ -125,10 +131,93 @@ "KW_BETSLUIT14", ProbabilityRule }, { - "KW_BETSLUIT15", InflowModel + "KW_BETSLUIT15", ClosingStructureInflowModelRule } }; + private static readonly Dictionary>> stabilityPointStructuresRules = + new Dictionary>> + { + { + "KW_STERSTAB1", StructureNormalOrientation + }, + { + "KW_STERSTAB2", VariationCoefficientLogNormalDistributionRule + }, + { + "KW_STERSTAB3", LogNormalDistributionRule + }, + { + "KW_STERSTAB4", VariationCoefficientNormalDistributionRule + }, + { + "KW_STERSTAB5", NormalDistributionRule + }, + { + "KW_STERSTAB6", NormalDistributionRule + }, + { + "KW_STERSTAB7", VariationCoefficientLogNormalDistributionRule + }, + { + "KW_STERSTAB8", LogNormalDistributionRule + }, + { + "KW_STERSTAB9", VariationCoefficientLogNormalDistributionRule + }, + { + "KW_STERSTAB10", VariationCoefficientLogNormalDistributionRule + }, + { + "KW_STERSTAB11", NormalDistributionRule + }, + { + "KW_STERSTAB12", NormalDistributionRule + }, + { + "KW_STERSTAB13", DoubleRule + }, + { + "KW_STERSTAB14", NormalDistributionRule + }, + { + "KW_STERSTAB15", PositiveDoubleRule + }, + { + "KW_STERSTAB16", ProbabilityRule + }, + { + "KW_STERSTAB17", PositiveDoubleRule + }, + { + "KW_STERSTAB18", VariationCoefficientNormalDistributionRule + }, + { + "KW_STERSTAB19", VariationCoefficientNormalDistributionRule + }, + { + "KW_STERSTAB20", PositiveDoubleRule + }, + { + "KW_STERSTAB21", PositiveDoubleRule + }, + { + "KW_STERSTAB22", NormalDistributionRule + }, + { + "KW_STERSTAB23", VariationCoefficientLogNormalDistributionRule + }, + { + "KW_STERSTAB24", VariationCoefficientLogNormalDistributionRule + }, + { + "KW_STERSTAB25", LogNormalDistributionRule + }, + { + "KW_STERSTAB26", StabilityPointStructureInflowModelRule + }, + }; + /// /// Validates a collection of for a height structure. /// @@ -151,6 +240,17 @@ return ValidateStructuresParameters(structureParameterRows, closingStructuresRules); } + /// + /// Validates a collection of for a stability point structure. + /// + /// The objects to validate. + /// A object containing the validation result. + /// Thrown when is null. + public static ValidationResult ValidateStabilityPointStructuresParameters(IList structureParameterRows) + { + return ValidateStructuresParameters(structureParameterRows, stabilityPointStructuresRules); + } + private static ValidationResult ValidateStructuresParameters(IList structureParameterRows, Dictionary>> rules) { @@ -182,12 +282,38 @@ return new ValidationResult(errorMessages); } + private static List DoubleRule(StructuresParameterRow row) + { + List messages = new List(); + + double value = row.NumericalValue; + if (double.IsNaN(value) || double.IsInfinity(value)) + { + messages.Add(string.Format(Resources.StructuresParameterRowsValidator_Line_0_column_1_probability_out_of_range, row.LineNumber, numericalValueColumn)); + } + + return messages; + } + + private static List PositiveDoubleRule(StructuresParameterRow row) + { + List messages = new List(); + + double value = row.NumericalValue; + if (double.IsNaN(value) || double.IsInfinity(value) || value < 0) + { + messages.Add(string.Format(Resources.StructuresParameterRowsValidator_Line_0_column_1_probability_out_of_range, row.LineNumber, numericalValueColumn)); + } + + return messages; + } + private static List ProbabilityRule(StructuresParameterRow row) { List messages = new List(); double mean = row.NumericalValue; - if (double.IsNaN(mean) || double.IsInfinity(mean)) + if (double.IsNaN(mean) || double.IsInfinity(mean) || mean < 0 || mean > 1) { messages.Add(string.Format(Resources.StructuresParameterRowsValidator_Line_0_column_1_probability_out_of_range, row.LineNumber, numericalValueColumn)); } @@ -281,15 +407,26 @@ return messages; } - private static List InflowModel(StructuresParameterRow row) + private static List ClosingStructureInflowModelRule(StructuresParameterRow row) { List messages = new List(); string value = row.AlphanumericValue.ToLower(); - if (!alphaNumericalKeywords.Contains(value)) + if (!closingStructureInflowModelRuleKeywords.Contains(value)) { messages.Add(string.Format(Resources.StructuresParameterRowsValidator_Line_0_column_1_value_invalid, row.LineNumber, alphanumericalValueColumn)); } return messages; } + + private static List StabilityPointStructureInflowModelRule(StructuresParameterRow row) + { + List messages = new List(); + string value = row.AlphanumericValue.ToLower(); + if (!stabilityPointStructureInflowModelRuleKeywords.Contains(value)) + { + messages.Add(string.Format(Resources.StructuresParameterRowsValidator_Line_0_column_1_value_invalid, row.LineNumber, alphanumericalValueColumn)); + } + return messages; + } } } \ No newline at end of file Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.IO.Test/HeightStructuresImporterTest.cs =================================================================== diff -u -r396f21603d742cdfb0e92817e5fd0b4df1e9f851 -rb70abd70f1cd326d1a753c5879a065149ac2ae84 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.IO.Test/HeightStructuresImporterTest.cs (.../HeightStructuresImporterTest.cs) (revision 396f21603d742cdfb0e92817e5fd0b4df1e9f851) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.IO.Test/HeightStructuresImporterTest.cs (.../HeightStructuresImporterTest.cs) (revision b70abd70f1cd326d1a753c5879a065149ac2ae84) @@ -50,17 +50,6 @@ } [Test] - public void Constructor_ImportTargetNull_ThrowArgumentNullException() - { - // Call - TestDelegate call = () => new HeightStructuresImporter(null, testReferenceLine, testFilePath); - - // Assert - var exception = Assert.Throws(call); - Assert.AreEqual("importTarget", exception.ParamName); - } - - [Test] public void Import_ValidIncompleteFile_LogAndTrue() { // Setup Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructure.cs =================================================================== diff -u -rfca049745871c8352ef2968048fdc0cca0c647e0 -rb70abd70f1cd326d1a753c5879a065149ac2ae84 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructure.cs (.../StabilityPointStructure.cs) (revision fca049745871c8352ef2968048fdc0cca0c647e0) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructure.cs (.../StabilityPointStructure.cs) (revision b70abd70f1cd326d1a753c5879a065149ac2ae84) @@ -20,8 +20,10 @@ // All rights reserved. using System; +using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Ringtoets.Common.Data; +using Ringtoets.Common.Data.Probabilistics; namespace Ringtoets.StabilityPointStructures.Data { @@ -37,9 +39,309 @@ /// The identifier of the structure. /// The location of the structure. /// The orientation of the stability point structure, relative to north. + /// The mean of the storage area of the stability point structure. + /// The coefficient of variation of the storage area of the stability point structure. + /// The mean allowed increase of level for storage of the stability point structure. + /// The standard deviation of allowed increase of level for storage of the stability point structure. + /// The mean of the width of the flow apertures of the stability point structure. + /// The coefficient of variation of the width of the flow apertures of the stability point structure. + /// The mean interior water level of the stability point structure. + /// The standard deviation of the interior water level of the stability point structure. + /// The mean threshold height of the opened stability point structure. + /// The standard deviation of the threshold height of the opened stability point structure. + /// The mean critical overtopping discharge of the stability point structure. + /// The coefficient of variation of critical overtopping discharge of the stability point structure. + /// The mean flow width of the stability point structure at the bottom protection. + /// The standard deviation of the flow width of the stability point structure at the bottom protection. + /// The mean constructive strength of the linear load model of the stability point structure. + /// The coefficient of variation of the constructive strength of the linear load model of the stability point structure. + /// The mean constructive strength of the quadratic load model of the stability point structure. + /// The coefficient of variation of the constructive strength of the quadratic load model of the stability point structure. + /// The mean bank width of the stability point structure. + /// The standard deviation of the bank width of the stability point structure. + /// The mean inside water level failure construction of the stability point structure. + /// The standard deviation of the inside water level failure construction of the stability point structure. + /// The evaluation level of the stability point structure. + /// The mean crest level of the stability point structure. + /// The standard deviation of the crest level of the stability point structure. + /// The vertical distance of the stability point structure. + /// The probability of failing to repair a failed closure of the stability point structure. + /// The mean failure collision energy of the stability point structure. + /// The coefficient of variation of the failure collision energy of the stability point structure. + /// The mean mass of the ship. + /// The coefficient of variation of the mass of the ship. + /// The mean velocity of the ship. + /// The coefficient of variation of the velocity of the ship. + /// Number of levellings per year. + /// The chance per levelling at a collision with the second retaining structure. + /// The mean maximum flow velocity at which the structure is closable. + /// The standard deviation of the maximum flow velocity at which the structure is closable. + /// The mean stability properties of the linear model of the stability point structure. + /// The coefficient of variation of the stability properties of the linear model of the stability point structure. + /// The mean stability properties of the quadratic model of the stability point structure. + /// The coefficient of variation of the stability properties of the quadratic model of the stability point structure. + /// The mean area of the flow aperture of the stability point structure. + /// The standard deviation of the area of the flow aperture of the stability point structure. + /// The type of stability point structure. /// Thrown when or is null /// , empty or consists of whitespace. /// Thrown when is null. - public StabilityPointStructure(string name, string id, Point2D location, double structureNormalOrientation) : base(name, id, location, structureNormalOrientation) { } + public StabilityPointStructure(string name, string id, Point2D location, + double structureNormalOrientation, + double storageStructureAreaMean, double storageStructureAreaCoefficientOfVariation, + double allowedLevelIncreaseStorageMean, double allowedLevelIncreaseStorageStandardDeviation, + double widthFlowAperturesMean, double widthFlowAperturesCoefficientOfVariation, + double insideWaterLevelMean, double insideWaterLevelStandardDeviation, + double thresholdHeightOpenWeirMean, double thresholdHeightOpenWeirStandardDeviation, + double criticalOvertoppingDischargeMean, double criticalOvertoppingDischargeCoefficientOfVariation, + double flowWidthAtBottomProtectionMean, double flowWidthAtBottomProtectionStandardDeviation, + double constructiveStrengthLinearModelMean, double constructiveStrengthLinearModelCoefficientOfVariation, + double constructiveStrengthQuadraticModelMean, double constructiveStrengthQuadraticModelCoefficientOfVariation, + double bankWidthMean, double bankWidthStandardDeviation, + double insideWaterLevelFailureConstructionMean, double insideWaterLevelFailureConstructionStandardDeviation, + double evaluationLevel, + double levelCrestStructureMean, double levelCrestStructureStandardDeviation, + double verticalDistance, + double failureProbabilityReparation, + double failureCollisionEnergyMean, double failureCollisionEnergyCoefficientOfVariation, + double shipMassMean, double shipMassCoefficientOfVariation, + double shipVelocityMean, double shipVelocityCoefficientOfVariation, + int levellingsPerYear, + double collisionChanceSecondRetainingStructurePerLevelling, + double flowVelocityStructureClosableMean, double flowVelocityStructureClosableStandarDeviation, + double stabilityLinearModelMean, double stabilityLinearModelCoefficientOfVariation, + double stabilityQuadraticModelMean, double stabilityQuadraticModelCoefficientOfVariation, + double areaFlowAperturesMean, double areaFlowAperturesStandardDeviation, + StabilityPointStructureType inflowModel + ) + : base(name, id, location, structureNormalOrientation) + { + StorageStructureArea = new VariationCoefficientLogNormalDistribution(2) + { + Mean = (RoundedDouble) storageStructureAreaMean, + CoefficientOfVariation = (RoundedDouble) storageStructureAreaCoefficientOfVariation + }; + AllowedLevelIncreaseStorage = new LogNormalDistribution(2) + { + Mean = (RoundedDouble) allowedLevelIncreaseStorageMean, + StandardDeviation = (RoundedDouble) allowedLevelIncreaseStorageStandardDeviation + }; + WidthFlowApertures = new VariationCoefficientNormalDistribution(2) + { + Mean = (RoundedDouble) widthFlowAperturesMean, + CoefficientOfVariation = (RoundedDouble) widthFlowAperturesCoefficientOfVariation + }; + InsideWaterLevel = new NormalDistribution(2) + { + Mean = (RoundedDouble) insideWaterLevelMean, + StandardDeviation = (RoundedDouble) insideWaterLevelStandardDeviation + }; + ThresholdHeightOpenWeir = new NormalDistribution(2) + { + Mean = (RoundedDouble) thresholdHeightOpenWeirMean, + StandardDeviation = (RoundedDouble) thresholdHeightOpenWeirStandardDeviation + }; + CriticalOvertoppingDischarge = new VariationCoefficientLogNormalDistribution(2) + { + Mean = (RoundedDouble) criticalOvertoppingDischargeMean, + CoefficientOfVariation = (RoundedDouble) criticalOvertoppingDischargeCoefficientOfVariation + }; + FlowWidthAtBottomProtection = new LogNormalDistribution(2) + { + Mean = (RoundedDouble) flowWidthAtBottomProtectionMean, + StandardDeviation = (RoundedDouble) flowWidthAtBottomProtectionStandardDeviation + }; + ConstructiveStrengthLinearModel = new VariationCoefficientLogNormalDistribution(2) + { + Mean = (RoundedDouble) constructiveStrengthLinearModelMean, + CoefficientOfVariation = (RoundedDouble) constructiveStrengthLinearModelCoefficientOfVariation + }; + ConstructiveStrengthQuadraticModel = new VariationCoefficientLogNormalDistribution(2) + { + Mean = (RoundedDouble) constructiveStrengthQuadraticModelMean, + CoefficientOfVariation = (RoundedDouble) constructiveStrengthQuadraticModelCoefficientOfVariation + }; + BankWidth = new NormalDistribution(2) + { + Mean = (RoundedDouble) bankWidthMean, + StandardDeviation = (RoundedDouble) bankWidthStandardDeviation + }; + InsideWaterLevelFailureConstruction = new NormalDistribution(2) + { + Mean = (RoundedDouble) insideWaterLevelFailureConstructionMean, + StandardDeviation = (RoundedDouble) insideWaterLevelFailureConstructionStandardDeviation + }; + EvaluationLevel = new RoundedDouble(2, evaluationLevel); + LevelCrestStructure = new NormalDistribution(2) + { + Mean = (RoundedDouble) levelCrestStructureMean, + StandardDeviation = (RoundedDouble) levelCrestStructureStandardDeviation + }; + VerticalDistance = new RoundedDouble(2, verticalDistance); + FailureProbabilityReparation = new RoundedDouble(2, failureProbabilityReparation); + FailureCollisionEnergy = new VariationCoefficientLogNormalDistribution(2) + { + Mean = (RoundedDouble) failureCollisionEnergyMean, + CoefficientOfVariation = (RoundedDouble) failureCollisionEnergyCoefficientOfVariation + }; + ShipMass = new VariationCoefficientNormalDistribution(2) + { + Mean = (RoundedDouble) shipMassMean, + CoefficientOfVariation = (RoundedDouble) shipMassCoefficientOfVariation + }; + ShipVelocity = new VariationCoefficientNormalDistribution(2) + { + Mean = (RoundedDouble) shipVelocityMean, + CoefficientOfVariation = (RoundedDouble) shipVelocityCoefficientOfVariation + }; + LevellingsPerYear = levellingsPerYear; + CollisionChanceSecondRetainingStructurePerLevelling = new RoundedDouble(2, collisionChanceSecondRetainingStructurePerLevelling); + FlowVelocityStructureClosable = new NormalDistribution(2) + { + Mean = (RoundedDouble) flowVelocityStructureClosableMean, + StandardDeviation = (RoundedDouble) flowVelocityStructureClosableStandarDeviation + }; + StabilityLinearModel = new VariationCoefficientLogNormalDistribution(2) + { + Mean = (RoundedDouble) stabilityLinearModelMean, + CoefficientOfVariation = (RoundedDouble) stabilityLinearModelCoefficientOfVariation + }; + StabilityQuadraticModel = new VariationCoefficientLogNormalDistribution(2) + { + Mean = (RoundedDouble) stabilityQuadraticModelMean, + CoefficientOfVariation = (RoundedDouble) stabilityQuadraticModelCoefficientOfVariation + }; + AreaFlowApertures = new LogNormalDistribution(2) + { + Mean = (RoundedDouble) areaFlowAperturesMean, + StandardDeviation = (RoundedDouble) areaFlowAperturesStandardDeviation + }; + InflowModel = inflowModel; + } + + /// + /// Gets the storage area of the stability point structure. + /// + public VariationCoefficientLogNormalDistribution StorageStructureArea { get; private set; } + + /// + /// Gets the allowed increase of level for storage of the stability point structure. + /// + public LogNormalDistribution AllowedLevelIncreaseStorage { get; private set; } + + /// + /// Gets the width of the flow apertures of the stability point structure. + /// + public VariationCoefficientNormalDistribution WidthFlowApertures { get; private set; } + + /// + /// Gets the interior water level of the stability point structure. + /// + public NormalDistribution InsideWaterLevel { get; private set; } + + /// + /// Gets the threshold height of the opened stability point structure. + /// + public NormalDistribution ThresholdHeightOpenWeir { get; private set; } + + /// + /// Gets the critical overtopping discharge of the stability point structure. + /// + public VariationCoefficientLogNormalDistribution CriticalOvertoppingDischarge { get; private set; } + + /// + /// Gets the flow width of the stability point structure at the bottom protection. + /// + public LogNormalDistribution FlowWidthAtBottomProtection { get; private set; } + + /// + /// Gets the constructive strength of the linear load model of the stability point structure. + /// + public VariationCoefficientLogNormalDistribution ConstructiveStrengthLinearModel { get; private set; } + + /// + /// Gets the constructive strength of the quadratic load model of the stability point structure. + /// + public VariationCoefficientLogNormalDistribution ConstructiveStrengthQuadraticModel { get; private set; } + + /// + /// Gets the bank width of the stability point structure. + /// + public NormalDistribution BankWidth { get; private set; } + + /// + /// Gets the inside water level failure construction of the stability point structure. + /// + public NormalDistribution InsideWaterLevelFailureConstruction { get; private set; } + + /// + /// Gets the evaluation level of the stability point structure. + /// + public RoundedDouble EvaluationLevel { get; private set; } + + /// + /// Gets the crest level of the stability point structure. + /// + public NormalDistribution LevelCrestStructure { get; private set; } + + /// + /// Gets the vertical distance of the stability point structure. + /// + public RoundedDouble VerticalDistance { get; private set; } + + /// + /// Gets the probability of failing to repair a failed closure of the stability point structure. + /// + public RoundedDouble FailureProbabilityReparation { get; private set; } + + /// + /// Gets the failure collision energy of the stability point structure. + /// + public VariationCoefficientLogNormalDistribution FailureCollisionEnergy { get; private set; } + + /// + /// Gets the mass of the ship. + /// + public VariationCoefficientNormalDistribution ShipMass { get; private set; } + + /// + /// Gets the velocity of the ship. + /// + public VariationCoefficientNormalDistribution ShipVelocity { get; private set; } + + /// + /// Gets the number of levellings per year. + /// + public int LevellingsPerYear { get; private set; } + + /// + /// Gets the chance per levelling at a collision with the second retaining structure. + /// + public RoundedDouble CollisionChanceSecondRetainingStructurePerLevelling { get; private set; } + + /// + /// Gets the maximum flow velocity at which the structure is closable. + /// + public NormalDistribution FlowVelocityStructureClosable { get; private set; } + + /// + /// Gets the stability properties of the linear model of the stability point structure. + /// + public VariationCoefficientLogNormalDistribution StabilityLinearModel { get; private set; } + + /// + /// Gets the stability properties of the quadratic model of the stability point structure. + /// + public VariationCoefficientLogNormalDistribution StabilityQuadraticModel { get; private set; } + + /// + /// Gets the area of the flow aperture of the stability point structure. + /// + public LogNormalDistribution AreaFlowApertures { get; private set; } + + /// + /// Gets the type of stability point structure. + /// + public StabilityPointStructureType InflowModel { get; private set; } } } \ No newline at end of file Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresInput.cs =================================================================== diff -u -rd26a556cd48a6494079d88774977215ee2177274 -rb70abd70f1cd326d1a753c5879a065149ac2ae84 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresInput.cs (.../StabilityPointStructuresInput.cs) (revision d26a556cd48a6494079d88774977215ee2177274) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresInput.cs (.../StabilityPointStructuresInput.cs) (revision b70abd70f1cd326d1a753c5879a065149ac2ae84) @@ -57,7 +57,7 @@ private readonly LogNormalDistribution flowWidthAtBottomProtection; private readonly VariationCoefficientLogNormalDistribution criticalOvertoppingDischarge; private readonly VariationCoefficientNormalDistribution widthFlowApertures; - private readonly NormalDistribution bermWidth; + private readonly NormalDistribution bankWidth; private readonly NormalDistribution flowVelocityStructureClosable; private ForeshoreProfile foreshoreProfile; private RoundedDouble structureNormalOrientation; @@ -209,7 +209,7 @@ CoefficientOfVariation = (RoundedDouble) 0.05 }; - bermWidth = new NormalDistribution(2) + bankWidth = new NormalDistribution(2) { Mean = (RoundedDouble) double.NaN, StandardDeviation = (RoundedDouble) double.NaN @@ -809,19 +809,19 @@ } /// - /// Gets or sets the berm width. + /// Gets or sets the bank width. /// [m] /// - public NormalDistribution BermWidth + public NormalDistribution BankWidth { get { - return bermWidth; + return bankWidth; } set { - bermWidth.Mean = value.Mean; - bermWidth.StandardDeviation = value.StandardDeviation; + bankWidth.Mean = value.Mean; + bankWidth.StandardDeviation = value.StandardDeviation; } } Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Ringtoets.StabilityPointStructures.IO.csproj =================================================================== diff -u -r647ac8ad2f242b5284ba04abada13ff22856ca85 -rb70abd70f1cd326d1a753c5879a065149ac2ae84 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Ringtoets.StabilityPointStructures.IO.csproj (.../Ringtoets.StabilityPointStructures.IO.csproj) (revision 647ac8ad2f242b5284ba04abada13ff22856ca85) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Ringtoets.StabilityPointStructures.IO.csproj (.../Ringtoets.StabilityPointStructures.IO.csproj) (revision b70abd70f1cd326d1a753c5879a065149ac2ae84) @@ -32,6 +32,10 @@ AllRules.ruleset + + ..\..\..\..\packages\log4net.2.0.4\lib\net40-full\log4net.dll + True + @@ -40,12 +44,36 @@ Properties\GlobalAssembly.cs + Copying.licenseheader + + + + {3BBFD65B-B277-4E50-AE6D-BD24C3434609} + Core.Common.Base + False + + + {D4200F43-3F72-4F42-AF0A-8CED416A38EC} + Ringtoets.Common.Data + False + + + {52BA7627-CBAB-4209-BE77-3B5F31378277} + Ringtoets.Common.IO + False + + + {3D4B9740-8348-4434-8D77-B611FC6EE57F} + Ringtoets.StabilityPointStructures.Data + False + + + + + + \ No newline at end of file Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Plugin/Ringtoets.StabilityPointStructures.Plugin.csproj =================================================================== diff -u -rc3a5f6f1b7c5a89cf8d81b52b48eea471b3a4ffe -rb70abd70f1cd326d1a753c5879a065149ac2ae84 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Plugin/Ringtoets.StabilityPointStructures.Plugin.csproj (.../Ringtoets.StabilityPointStructures.Plugin.csproj) (revision c3a5f6f1b7c5a89cf8d81b52b48eea471b3a4ffe) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Plugin/Ringtoets.StabilityPointStructures.Plugin.csproj (.../Ringtoets.StabilityPointStructures.Plugin.csproj) (revision b70abd70f1cd326d1a753c5879a065149ac2ae84) @@ -85,6 +85,11 @@ Ringtoets.Common.Forms False + + {52ba7627-cbab-4209-be77-3b5f31378277} + Ringtoets.Common.IO + False + {d951d6da-fe83-4920-9fdb-63bf96480b54} Ringtoets.Common.Service @@ -110,6 +115,11 @@ Ringtoets.StabilityPointStructures.Forms False + + {9A80CDD2-4681-4A5D-9A2C-A2FEE133E0F9} + Ringtoets.StabilityPointStructures.IO + False + Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Plugin/StabilityPointStructuresPlugin.cs =================================================================== diff -u -rc3a5f6f1b7c5a89cf8d81b52b48eea471b3a4ffe -rb70abd70f1cd326d1a753c5879a065149ac2ae84 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Plugin/StabilityPointStructuresPlugin.cs (.../StabilityPointStructuresPlugin.cs) (revision c3a5f6f1b7c5a89cf8d81b52b48eea471b3a4ffe) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Plugin/StabilityPointStructuresPlugin.cs (.../StabilityPointStructuresPlugin.cs) (revision b70abd70f1cd326d1a753c5879a065149ac2ae84) @@ -37,11 +37,13 @@ using Ringtoets.StabilityPointStructures.Data; using Ringtoets.StabilityPointStructures.Forms.PresentationObjects; using Ringtoets.StabilityPointStructures.Forms.Views; +using Ringtoets.StabilityPointStructures.IO; using Ringtoets.StabilityPointStructures.Plugin.Properties; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; using StabilityPointStructuresDataResources = Ringtoets.StabilityPointStructures.Data.Properties.Resources; using RingtoetsCommonServiceResources = Ringtoets.Common.Service.Properties.Resources; +using RingtoetsCommonIOResources = Ringtoets.Common.IO.Properties.Resources; namespace Ringtoets.StabilityPointStructures.Plugin { @@ -127,6 +129,21 @@ }; } + public override IEnumerable GetImportInfos() + { + yield return new ImportInfo + { + CreateFileImporter = (context, filePath) => new StabilityPointStructuresImporter(context.WrappedData, + context.AssessmentSection.ReferenceLine, + filePath), + Name = RingtoetsCommonFormsResources.StructuresImporter_DisplayName, + Category = RingtoetsCommonFormsResources.Ringtoets_Category, + Image = RingtoetsCommonFormsResources.StructuresIcon, + FileFilter = RingtoetsCommonIOResources.DataTypeDisplayName_shape_file_filter, + IsEnabled = context => context.AssessmentSection.ReferenceLine != null + }; + } + #region ViewInfo #region StabilityPointStructuresFailureMechanismResultView ViewInfo Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructureTest.cs =================================================================== diff -u -r396f21603d742cdfb0e92817e5fd0b4df1e9f851 -rb70abd70f1cd326d1a753c5879a065149ac2ae84 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructureTest.cs (.../StabilityPointStructureTest.cs) (revision 396f21603d742cdfb0e92817e5fd0b4df1e9f851) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructureTest.cs (.../StabilityPointStructureTest.cs) (revision b70abd70f1cd326d1a753c5879a065149ac2ae84) @@ -19,9 +19,12 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using Core.Common.Base.Data; using Core.Common.Base.Geometry; using NUnit.Framework; using Ringtoets.Common.Data; +using Ringtoets.Common.Data.Probabilistics; +using Ringtoets.Common.Data.TestUtil; namespace Ringtoets.StabilityPointStructures.Data.Test { @@ -33,13 +36,173 @@ { // Setup var location = new Point2D(1.22, 2.333); - const double structureNormalOrientation = 11.22; // Call - var structure = new StabilityPointStructure("aName", "anId", location, structureNormalOrientation); + var structure = new StabilityPointStructure("aName", "anId", location, + 123.456, + 234.567, 0.234, + 345.678, 0.345, + 456.789, 0.456, + 567.890, 0.567, + 678.901, 0.678, + 789.012, 0.789, + 890.123, 0.890, + 901.234, 0.901, + 123.456, 0.123, + 234.567, 0.234, + 345.678, 0.345, + 555.555, + 456.789, 0.456, + 555.55, + 0.55, + 567.890, 0.567, + 7777777.777, 0.777, + 567.890, 0.567, + 42, + 0.55, + 678.901, 0.678, + 789.012, 0.789, + 890.123, 0.890, + 901.234, 0.901, + StabilityPointStructureType.FloodedCulvert + ); // Assert Assert.IsInstanceOf(structure); + + VariationCoefficientLogNormalDistribution storageStructureArea = structure.StorageStructureArea; + Assert.AreEqual(2, storageStructureArea.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(234.57, storageStructureArea.Mean, storageStructureArea.Mean.GetAccuracy()); + Assert.AreEqual(2, storageStructureArea.CoefficientOfVariation.NumberOfDecimalPlaces); + Assert.AreEqual(0.23, storageStructureArea.CoefficientOfVariation, storageStructureArea.CoefficientOfVariation.GetAccuracy()); + + LogNormalDistribution allowedLevelIncreaseStorage = structure.AllowedLevelIncreaseStorage; + Assert.AreEqual(2, allowedLevelIncreaseStorage.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(345.68, allowedLevelIncreaseStorage.Mean, allowedLevelIncreaseStorage.Mean.GetAccuracy()); + Assert.AreEqual(2, allowedLevelIncreaseStorage.StandardDeviation.NumberOfDecimalPlaces); + Assert.AreEqual(0.35, allowedLevelIncreaseStorage.StandardDeviation, allowedLevelIncreaseStorage.StandardDeviation.GetAccuracy()); + + VariationCoefficientNormalDistribution widthFlowApertures = structure.WidthFlowApertures; + Assert.AreEqual(2, widthFlowApertures.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(456.79, widthFlowApertures.Mean, widthFlowApertures.Mean.GetAccuracy()); + Assert.AreEqual(2, widthFlowApertures.CoefficientOfVariation.NumberOfDecimalPlaces); + Assert.AreEqual(0.46, widthFlowApertures.CoefficientOfVariation, widthFlowApertures.CoefficientOfVariation.GetAccuracy()); + + NormalDistribution insideWaterLevel = structure.InsideWaterLevel; + Assert.AreEqual(2, insideWaterLevel.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(567.89, insideWaterLevel.Mean, insideWaterLevel.Mean.GetAccuracy()); + Assert.AreEqual(2, insideWaterLevel.StandardDeviation.NumberOfDecimalPlaces); + Assert.AreEqual(0.57, insideWaterLevel.StandardDeviation, insideWaterLevel.StandardDeviation.GetAccuracy()); + + NormalDistribution thresholdHeightOpenWeir = structure.ThresholdHeightOpenWeir; + Assert.AreEqual(2, thresholdHeightOpenWeir.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(678.90, thresholdHeightOpenWeir.Mean, thresholdHeightOpenWeir.Mean.GetAccuracy()); + Assert.AreEqual(2, thresholdHeightOpenWeir.StandardDeviation.NumberOfDecimalPlaces); + Assert.AreEqual(0.68, thresholdHeightOpenWeir.StandardDeviation, thresholdHeightOpenWeir.StandardDeviation.GetAccuracy()); + + VariationCoefficientLogNormalDistribution criticalOvertoppingDischarge = structure.CriticalOvertoppingDischarge; + Assert.AreEqual(2, criticalOvertoppingDischarge.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(789.01, criticalOvertoppingDischarge.Mean, criticalOvertoppingDischarge.Mean.GetAccuracy()); + Assert.AreEqual(2, criticalOvertoppingDischarge.CoefficientOfVariation.NumberOfDecimalPlaces); + Assert.AreEqual(0.79, criticalOvertoppingDischarge.CoefficientOfVariation, criticalOvertoppingDischarge.CoefficientOfVariation.GetAccuracy()); + + LogNormalDistribution flowWidthAtBottomProtection = structure.FlowWidthAtBottomProtection; + Assert.AreEqual(2, flowWidthAtBottomProtection.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(890.12, flowWidthAtBottomProtection.Mean, flowWidthAtBottomProtection.Mean.GetAccuracy()); + Assert.AreEqual(2, flowWidthAtBottomProtection.StandardDeviation.NumberOfDecimalPlaces); + Assert.AreEqual(0.89, flowWidthAtBottomProtection.StandardDeviation, flowWidthAtBottomProtection.StandardDeviation.GetAccuracy()); + + VariationCoefficientLogNormalDistribution constructiveStrengthLinearModel = structure.ConstructiveStrengthLinearModel; + Assert.AreEqual(2, constructiveStrengthLinearModel.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(901.23, constructiveStrengthLinearModel.Mean, constructiveStrengthLinearModel.Mean.GetAccuracy()); + Assert.AreEqual(2, constructiveStrengthLinearModel.CoefficientOfVariation.NumberOfDecimalPlaces); + Assert.AreEqual(0.90, constructiveStrengthLinearModel.CoefficientOfVariation, constructiveStrengthLinearModel.CoefficientOfVariation.GetAccuracy()); + + VariationCoefficientLogNormalDistribution constructiveStrengthQuadraticModel = structure.ConstructiveStrengthQuadraticModel; + Assert.AreEqual(2, constructiveStrengthQuadraticModel.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(123.46, constructiveStrengthQuadraticModel.Mean, constructiveStrengthQuadraticModel.Mean.GetAccuracy()); + Assert.AreEqual(2, constructiveStrengthQuadraticModel.CoefficientOfVariation.NumberOfDecimalPlaces); + Assert.AreEqual(0.12, constructiveStrengthQuadraticModel.CoefficientOfVariation, constructiveStrengthQuadraticModel.CoefficientOfVariation.GetAccuracy()); + + NormalDistribution bankWidth = structure.BankWidth; + Assert.AreEqual(2, bankWidth.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(234.57, bankWidth.Mean, bankWidth.Mean.GetAccuracy()); + Assert.AreEqual(2, bankWidth.StandardDeviation.NumberOfDecimalPlaces); + Assert.AreEqual(0.23, bankWidth.StandardDeviation, bankWidth.StandardDeviation.GetAccuracy()); + + NormalDistribution insideWaterLevelFailureConstruction = structure.InsideWaterLevelFailureConstruction; + Assert.AreEqual(2, insideWaterLevelFailureConstruction.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(345.68, insideWaterLevelFailureConstruction.Mean, insideWaterLevelFailureConstruction.Mean.GetAccuracy()); + Assert.AreEqual(2, insideWaterLevelFailureConstruction.StandardDeviation.NumberOfDecimalPlaces); + Assert.AreEqual(0.35, insideWaterLevelFailureConstruction.StandardDeviation, insideWaterLevelFailureConstruction.StandardDeviation.GetAccuracy()); + + Assert.IsInstanceOf(structure.EvaluationLevel); + Assert.AreEqual(2, structure.EvaluationLevel.NumberOfDecimalPlaces); + Assert.AreEqual(555.55, structure.EvaluationLevel, structure.EvaluationLevel.GetAccuracy()); + + NormalDistribution levelCrestStructure = structure.LevelCrestStructure; + Assert.AreEqual(2, levelCrestStructure.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(456.79, levelCrestStructure.Mean, levelCrestStructure.Mean.GetAccuracy()); + Assert.AreEqual(2, levelCrestStructure.StandardDeviation.NumberOfDecimalPlaces); + Assert.AreEqual(0.46, levelCrestStructure.StandardDeviation, levelCrestStructure.StandardDeviation.GetAccuracy()); + + Assert.IsInstanceOf(structure.VerticalDistance); + Assert.AreEqual(2, structure.VerticalDistance.NumberOfDecimalPlaces); + Assert.AreEqual(555.55, structure.VerticalDistance, structure.VerticalDistance.GetAccuracy()); + + Assert.IsInstanceOf(structure.FailureProbabilityReparation); + Assert.AreEqual(2, structure.FailureProbabilityReparation.NumberOfDecimalPlaces); + Assert.AreEqual(0.55, structure.FailureProbabilityReparation, structure.FailureProbabilityReparation.GetAccuracy()); + + VariationCoefficientLogNormalDistribution failureCollisionEnergy = structure.FailureCollisionEnergy; + Assert.AreEqual(2, failureCollisionEnergy.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(567.89, failureCollisionEnergy.Mean, failureCollisionEnergy.Mean.GetAccuracy()); + Assert.AreEqual(2, failureCollisionEnergy.CoefficientOfVariation.NumberOfDecimalPlaces); + Assert.AreEqual(0.57, failureCollisionEnergy.CoefficientOfVariation, failureCollisionEnergy.CoefficientOfVariation.GetAccuracy()); + + VariationCoefficientNormalDistribution shipMass = structure.ShipMass; + Assert.AreEqual(2, shipMass.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(7777777.78, shipMass.Mean, shipMass.Mean.GetAccuracy()); + Assert.AreEqual(2, shipMass.CoefficientOfVariation.NumberOfDecimalPlaces); + Assert.AreEqual(0.78, shipMass.CoefficientOfVariation, shipMass.CoefficientOfVariation.GetAccuracy()); + + VariationCoefficientNormalDistribution shipVelocity = structure.ShipVelocity; + Assert.AreEqual(2, shipVelocity.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(567.89, shipVelocity.Mean, shipVelocity.Mean.GetAccuracy()); + Assert.AreEqual(2, shipVelocity.CoefficientOfVariation.NumberOfDecimalPlaces); + Assert.AreEqual(0.57, shipVelocity.CoefficientOfVariation, shipVelocity.CoefficientOfVariation.GetAccuracy()); + + Assert.AreEqual(42, structure.LevellingsPerYear); + + Assert.IsInstanceOf(structure.CollisionChanceSecondRetainingStructurePerLevelling); + Assert.AreEqual(2, structure.CollisionChanceSecondRetainingStructurePerLevelling.NumberOfDecimalPlaces); + Assert.AreEqual(0.55, structure.CollisionChanceSecondRetainingStructurePerLevelling, structure.CollisionChanceSecondRetainingStructurePerLevelling.GetAccuracy()); + + NormalDistribution flowVelocityStructureClosable = structure.FlowVelocityStructureClosable; + Assert.AreEqual(2, flowVelocityStructureClosable.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(678.90, flowVelocityStructureClosable.Mean, flowVelocityStructureClosable.Mean.GetAccuracy()); + Assert.AreEqual(2, flowVelocityStructureClosable.StandardDeviation.NumberOfDecimalPlaces); + Assert.AreEqual(0.68, flowVelocityStructureClosable.StandardDeviation, flowVelocityStructureClosable.StandardDeviation.GetAccuracy()); + + VariationCoefficientLogNormalDistribution stabilityLinearModel = structure.StabilityLinearModel; + Assert.AreEqual(2, stabilityLinearModel.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(789.01, stabilityLinearModel.Mean, stabilityLinearModel.Mean.GetAccuracy()); + Assert.AreEqual(2, stabilityLinearModel.CoefficientOfVariation.NumberOfDecimalPlaces); + Assert.AreEqual(0.79, stabilityLinearModel.CoefficientOfVariation, stabilityLinearModel.CoefficientOfVariation.GetAccuracy()); + + VariationCoefficientLogNormalDistribution stabilityQuadraticModel = structure.StabilityQuadraticModel; + Assert.AreEqual(2, stabilityQuadraticModel.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(890.12, stabilityQuadraticModel.Mean, stabilityQuadraticModel.Mean.GetAccuracy()); + Assert.AreEqual(2, stabilityQuadraticModel.CoefficientOfVariation.NumberOfDecimalPlaces); + Assert.AreEqual(0.89, stabilityQuadraticModel.CoefficientOfVariation, stabilityQuadraticModel.CoefficientOfVariation.GetAccuracy()); + + LogNormalDistribution areaFlowApertures = structure.AreaFlowApertures; + Assert.AreEqual(2, areaFlowApertures.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(901.23, areaFlowApertures.Mean, areaFlowApertures.Mean.GetAccuracy()); + Assert.AreEqual(2, areaFlowApertures.StandardDeviation.NumberOfDecimalPlaces); + Assert.AreEqual(0.90, areaFlowApertures.StandardDeviation, areaFlowApertures.StandardDeviation.GetAccuracy()); + + Assert.AreEqual(StabilityPointStructureType.FloodedCulvert, structure.InflowModel); } } } \ No newline at end of file Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresInputTest.cs =================================================================== diff -u -ra6e0409b281c46630100de22ec860d3a3d4d8fa5 -rb70abd70f1cd326d1a753c5879a065149ac2ae84 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresInputTest.cs (.../StabilityPointStructuresInputTest.cs) (revision a6e0409b281c46630100de22ec860d3a3d4d8fa5) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresInputTest.cs (.../StabilityPointStructuresInputTest.cs) (revision b70abd70f1cd326d1a753c5879a065149ac2ae84) @@ -113,8 +113,8 @@ Assert.IsNaN(input.FailureProbabilityStructureWithErosion); AssertEqualValue(double.NaN, input.WidthFlowApertures.Mean); AssertEqualValue(0.05, input.WidthFlowApertures.CoefficientOfVariation); - Assert.IsNaN(input.BermWidth.Mean); - Assert.IsNaN(input.BermWidth.StandardDeviation); + Assert.IsNaN(input.BankWidth.Mean); + Assert.IsNaN(input.BankWidth.StandardDeviation); Assert.AreEqual(2, input.EvaluationLevel.NumberOfDecimalPlaces); AssertEqualValue(0, input.EvaluationLevel); Assert.AreEqual(2, input.VerticalDistance.NumberOfDecimalPlaces); @@ -791,11 +791,11 @@ NormalDistribution bermWidth = GenerateNormalDistribution(); // Call - input.BermWidth = bermWidth; + input.BankWidth = bermWidth; // Assert - AssertEqualValue(bermWidth.Mean, input.BermWidth.Mean); - AssertEqualValue(bermWidth.StandardDeviation, input.BermWidth.StandardDeviation); + AssertEqualValue(bermWidth.Mean, input.BankWidth.Mean); + AssertEqualValue(bermWidth.StandardDeviation, input.BankWidth.StandardDeviation); } [Test] Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/TreeNodeInfos/StabilityPointStructureTreeNodeInfoTest.cs =================================================================== diff -u -rfca049745871c8352ef2968048fdc0cca0c647e0 -rb70abd70f1cd326d1a753c5879a065149ac2ae84 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/TreeNodeInfos/StabilityPointStructureTreeNodeInfoTest.cs (.../StabilityPointStructureTreeNodeInfoTest.cs) (revision fca049745871c8352ef2968048fdc0cca0c647e0) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/TreeNodeInfos/StabilityPointStructureTreeNodeInfoTest.cs (.../StabilityPointStructureTreeNodeInfoTest.cs) (revision b70abd70f1cd326d1a753c5879a065149ac2ae84) @@ -105,7 +105,34 @@ private static StabilityPointStructure CreateSimpleStabilityPointStructure(string name) { - return new StabilityPointStructure(name, "1", new Point2D(1, 2), 11.22); + return new StabilityPointStructure(name, "1", new Point2D(1, 2), + 123.456, + 234.567, 0.234, + 345.678, 0.345, + 456.789, 0.456, + 567.890, 0.567, + 678.901, 0.678, + 789.012, 0.789, + 890.123, 0.890, + 901.234, 0.901, + 123.546, 0.123, + 234.567, 0.234, + 345.678, 0.345, + 555.555, + 456.789, 0.456, + 555.55, + 0.55, + 567.890, 0.567, + 7777777.777, 0.777, + 567.890, 0.567, + 42, + 0.55, + 678.901, 0.678, + 789.012, 0.789, + 890.123, 0.890, + 901.234, 0.901, + StabilityPointStructureType.FloodedCulvert + ); } } } \ No newline at end of file Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/TreeNodeInfos/StabilityPointStructuresContextTreeNodeInfoTest.cs =================================================================== diff -u -rfca049745871c8352ef2968048fdc0cca0c647e0 -rb70abd70f1cd326d1a753c5879a065149ac2ae84 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/TreeNodeInfos/StabilityPointStructuresContextTreeNodeInfoTest.cs (.../StabilityPointStructuresContextTreeNodeInfoTest.cs) (revision fca049745871c8352ef2968048fdc0cca0c647e0) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/TreeNodeInfos/StabilityPointStructuresContextTreeNodeInfoTest.cs (.../StabilityPointStructuresContextTreeNodeInfoTest.cs) (revision b70abd70f1cd326d1a753c5879a065149ac2ae84) @@ -79,7 +79,7 @@ mocks.ReplayAll(); var context = new StabilityPointStructuresContext(new ObservableList(), - assessmentSection); + assessmentSection); using (var plugin = new StabilityPointStructuresPlugin()) { @@ -104,7 +104,7 @@ mocks.ReplayAll(); var context = new StabilityPointStructuresContext(new ObservableList(), - assessmentSection); + assessmentSection); using (var plugin = new StabilityPointStructuresPlugin()) { @@ -244,7 +244,34 @@ private static StabilityPointStructure CreateStabilityPointStructure() { - return new StabilityPointStructure("Name", "Id", new Point2D(1, 2), 11.22); + return new StabilityPointStructure("Name", "Id", new Point2D(1, 2), + 123.456, + 234.567, 0.234, + 345.678, 0.345, + 456.789, 0.456, + 567.890, 0.567, + 678.901, 0.678, + 789.012, 0.789, + 890.123, 0.890, + 901.234, 0.901, + 123.546, 0.123, + 234.567, 0.234, + 345.678, 0.345, + 555.555, + 456.789, 0.456, + 555.55, + 0.55, + 567.890, 0.567, + 7777777.777, 0.777, + 567.890, 0.567, + 42, + 0.55, + 678.901, 0.678, + 789.012, 0.789, + 890.123, 0.890, + 901.234, 0.901, + StabilityPointStructureType.FloodedCulvert + ); } } } \ No newline at end of file Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/Ringtoets.StabilityPointStructures.IO.Test.csproj =================================================================== diff -u -r647ac8ad2f242b5284ba04abada13ff22856ca85 -rb70abd70f1cd326d1a753c5879a065149ac2ae84 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/Ringtoets.StabilityPointStructures.IO.Test.csproj (.../Ringtoets.StabilityPointStructures.IO.Test.csproj) (revision 647ac8ad2f242b5284ba04abada13ff22856ca85) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/Ringtoets.StabilityPointStructures.IO.Test.csproj (.../Ringtoets.StabilityPointStructures.IO.Test.csproj) (revision b70abd70f1cd326d1a753c5879a065149ac2ae84) @@ -35,6 +35,10 @@ none + + ..\..\..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll + True + @@ -43,12 +47,36 @@ Properties\GlobalAssembly.cs + Copying.licenseheader + + + + {3BBFD65B-B277-4E50-AE6D-BD24C3434609} + Core.Common.Base + + + {D4200F43-3F72-4F42-AF0A-8CED416A38EC} + Ringtoets.Common.Data + + + {52BA7627-CBAB-4209-BE77-3B5F31378277} + Ringtoets.Common.IO + + + {3D4B9740-8348-4434-8D77-B611FC6EE57F} + Ringtoets.StabilityPointStructures.Data + + + {9A80CDD2-4681-4A5D-9A2C-A2FEE133E0F9} + Ringtoets.StabilityPointStructures.IO + + + + + + \ No newline at end of file Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/ImportInfos/StabilityPointStructuresContextImportInfoTest.cs =================================================================== diff -u --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/ImportInfos/StabilityPointStructuresContextImportInfoTest.cs (revision 0) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/ImportInfos/StabilityPointStructuresContextImportInfoTest.cs (revision b70abd70f1cd326d1a753c5879a065149ac2ae84) @@ -0,0 +1,187 @@ +// 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.Drawing; +using System.Linq; +using Core.Common.Base; +using Core.Common.Base.IO; +using Core.Common.Gui.Plugin; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.StabilityPointStructures.Data; +using Ringtoets.StabilityPointStructures.Forms.PresentationObjects; +using Ringtoets.StabilityPointStructures.IO; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.StabilityPointStructures.Plugin.Test.ImportInfos +{ + [TestFixture] + public class StabilityPointStructuresContextImportInfoTest + { + [Test] + public void CreateFileImporter_Always_ExpectedPropertiesSet() + { + // Setup + var mocks = new MockRepository(); + var assessmentSectionMock = mocks.Stub(); + assessmentSectionMock.ReferenceLine = new ReferenceLine(); + mocks.ReplayAll(); + + var list = new ObservableList(); + + var importTarget = new StabilityPointStructuresContext(list, assessmentSectionMock); + + using (var plugin = new StabilityPointStructuresPlugin()) + { + ImportInfo importInfo = GetImportInfo(plugin); + + // Call + IFileImporter importer = importInfo.CreateFileImporter(importTarget, "test"); + + // Assert + Assert.IsInstanceOf(importer); + } + mocks.VerifyAll(); + } + + [Test] + public void Name_Always_ReturnExpectedName() + { + // Setup + using (var plugin = new StabilityPointStructuresPlugin()) + { + ImportInfo importInfo = GetImportInfo(plugin); + + // Call + string name = importInfo.Name; + + // Assert + Assert.AreEqual("Kunstwerklocaties", name); + } + } + + [Test] + public void Category_Always_ReturnExpectedCategory() + { + // Setup + using (var plugin = new StabilityPointStructuresPlugin()) + { + ImportInfo importInfo = GetImportInfo(plugin); + + // Call + string category = importInfo.Category; + + // Assert + Assert.AreEqual("Algemeen", category); + } + } + + [Test] + public void Image_Always_ReturnExpectedIcon() + { + // Setup + using (var plugin = new StabilityPointStructuresPlugin()) + { + ImportInfo importInfo = GetImportInfo(plugin); + + // Call + Image image = importInfo.Image; + + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.StructuresIcon, image); + } + } + + [Test] + public void FileFilter_Always_ReturnExpectedFileFilter() + { + // Setup + using (var plugin = new StabilityPointStructuresPlugin()) + { + ImportInfo importInfo = GetImportInfo(plugin); + + // Call + string fileFilter = importInfo.FileFilter; + + // Assert + Assert.AreEqual("Shapebestand (*.shp)|*.shp", fileFilter); + } + } + + [Test] + public void IsEnabled_ReferenceLineSet_ReturnTrue() + { + // Setup + var mocks = new MockRepository(); + var assessmentSectionMock = mocks.Stub(); + assessmentSectionMock.ReferenceLine = new ReferenceLine(); + mocks.ReplayAll(); + + var list = new ObservableList(); + + var context = new StabilityPointStructuresContext(list, assessmentSectionMock); + + using (var plugin = new StabilityPointStructuresPlugin()) + { + ImportInfo importInfo = GetImportInfo(plugin); + + // Call + bool isEnabled = importInfo.IsEnabled(context); + + // Assert + Assert.IsTrue(isEnabled); + } + mocks.VerifyAll(); + } + + [Test] + public void IsEnabled_ReferenceLineNotSet_ReturnFalse() + { + // Setup + var mocks = new MockRepository(); + var assessmentSectionMock = mocks.Stub(); + mocks.ReplayAll(); + + var list = new ObservableList(); + + var context = new StabilityPointStructuresContext(list, assessmentSectionMock); + + using (var plugin = new StabilityPointStructuresPlugin()) + { + ImportInfo importInfo = GetImportInfo(plugin); + + // Call + bool isEnabled = importInfo.IsEnabled(context); + + // Assert + Assert.IsFalse(isEnabled); + } + mocks.VerifyAll(); + } + + private static ImportInfo GetImportInfo(StabilityPointStructuresPlugin plugin) + { + return plugin.GetImportInfos().First(ii => ii.DataType == typeof(StabilityPointStructuresContext)); + } + } +} \ No newline at end of file Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/Ringtoets.StabilityPointStructures.Plugin.Test.csproj =================================================================== diff -u -re5f4a598d201934e48ab71795fb3b19cb9a960b1 -rb70abd70f1cd326d1a753c5879a065149ac2ae84 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/Ringtoets.StabilityPointStructures.Plugin.Test.csproj (.../Ringtoets.StabilityPointStructures.Plugin.Test.csproj) (revision e5f4a598d201934e48ab71795fb3b19cb9a960b1) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/Ringtoets.StabilityPointStructures.Plugin.Test.csproj (.../Ringtoets.StabilityPointStructures.Plugin.Test.csproj) (revision b70abd70f1cd326d1a753c5879a065149ac2ae84) @@ -54,6 +54,7 @@ Properties\GlobalAssembly.cs + @@ -93,6 +94,10 @@ {4d840673-3812-4338-a352-84854e32b8a0} Ringtoets.Common.Forms + + {52ba7627-cbab-4209-be77-3b5f31378277} + Ringtoets.Common.IO + {3D4B9740-8348-4434-8D77-B611FC6EE57F} Ringtoets.StabilityPointStructures.Data @@ -101,6 +106,10 @@ {D5F0A6B0-8710-4345-ABA1-D934C8E6783D} Ringtoets.StabilityPointStructures.Forms + + {9A80CDD2-4681-4A5D-9A2C-A2FEE133E0F9} + Ringtoets.StabilityPointStructures.IO + {E3DF5559-97D9-4038-BBE6-2E3DFB4F4C68} Ringtoets.StabilityPointStructures.Plugin Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/StabilityPointStructuresPluginTest.cs =================================================================== diff -u -r2efa0fbe22fee2482e1583a7d6f5ccfdf168f660 -rb70abd70f1cd326d1a753c5879a065149ac2ae84 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/StabilityPointStructuresPluginTest.cs (.../StabilityPointStructuresPluginTest.cs) (revision 2efa0fbe22fee2482e1583a7d6f5ccfdf168f660) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/StabilityPointStructuresPluginTest.cs (.../StabilityPointStructuresPluginTest.cs) (revision b70abd70f1cd326d1a753c5879a065149ac2ae84) @@ -98,5 +98,20 @@ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, closingStructuresResultViewInfo.Image); } } + + [Test] + public void GetImportInfos_ReturnsExpectedImportInfos() + { + // Setup + using (var plugin = new StabilityPointStructuresPlugin()) + { + // Call + ImportInfo[] importInfos = plugin.GetImportInfos().ToArray(); + + // Assert + Assert.AreEqual(1, importInfos.Length); + Assert.IsTrue(importInfos.Any(i => i.DataType == typeof(StabilityPointStructuresContext))); + } + } } } \ No newline at end of file