Index: DamEngine/branches/DamEngine 19.2/src/Deltares.DamEngine.Data/General/Dike.cs =================================================================== diff -u -r3344 -r3346 --- DamEngine/branches/DamEngine 19.2/src/Deltares.DamEngine.Data/General/Dike.cs (.../Dike.cs) (revision 3344) +++ DamEngine/branches/DamEngine 19.2/src/Deltares.DamEngine.Data/General/Dike.cs (.../Dike.cs) (revision 3346) @@ -214,36 +214,42 @@ if (isOperational) { - if (location.Scenarios.Count < 1) - { - throw new DikeException("Location " + location.Name + - " has no scenarios, at least one scenario is required."); - } + ValidateOperationalProject(location); + } + } + } - if (location.Scenarios.Count > 1) + private static void ValidateOperationalProject(Location location) + { + if (location.Scenarios.Count < 1) + { + throw new DikeException("Location " + location.Name + + " has no scenarios, at least one scenario is required."); + } + + if (location.Scenarios.Count > 1) + { + throw new DikeException(string.Format( + "For Operational (DamLive), location {0} has {1} scenarios but only one is allowed!", + location.Name, location.Scenarios.Count)); + } + + if (location.SensorLocation != null) + { + foreach (var sensor in location.SensorLocation.SensorGroup.SensorArray) + { + if (sensor.RelativeLocation < 0) { throw new DikeException(string.Format( - "For Operational (DamLive), location {0} has {1} scenarios but only one is allowed!", - location.Name, location.Scenarios.Count)); + "For Operational (DamLive), location {0} has a sensor ({1}) which can not not be relative '+ " + + "to the starting point (0) as its coordinate {2} is < 0 .", + location.Name, sensor.Name, sensor.RelativeLocation)); } - - if (location.SensorLocation != null) - { - foreach (var sensorArray in location.SensorLocation.SensorGroup.SensorArray) - { - if (sensorArray.RelativeLocation < 0) - { - throw new DikeException(string.Format( - "For Operational (DamLive), location {0} has sensor which are not relative to the starting point.", - location.Name)); - } - } - } } } } - + /// /// Adapt data so it is consistent ///