diff --git a/MES_Wind/frmMain.cs b/MES_Wind/frmMain.cs index 3d0d8294330dc800fbb1d0a1f2e29774c9a62acb..6dfa09ad2f836503ec6979d93d2889291dff1073 100644 --- a/MES_Wind/frmMain.cs +++ b/MES_Wind/frmMain.cs @@ -226,47 +226,38 @@ namespace MES_Wind List<WindStressPRM.PowerStation> powerpointsToPRM = new List<WindStressPRM.PowerStation>(); foreach (IFeature featurepoint in pwpointsSet.Features) { - WindStressPRM.PowerStation dummystation = new WindStressPRM.PowerStation(); DataRow featureData = featurepoint.DataRow; - dummystation.Identifier = featurepoint.Fid; - dummystation.Name = featureData["Label"].ToString(); - dummystation.Voltage = int.Parse(featureData["Voltage"].ToString()); + int identifier = featurepoint.Fid; + String Name = featureData["Label"].ToString(); + int Voltage = int.Parse(featureData["Voltage"].ToString()); int issr = int.Parse(featureData["IsSource"].ToString()); - if (issr == 0) - { - dummystation.IsSource = false; - } - else - { - if (issr == 1) - { - dummystation.IsSource = true; - } - else - { - MessageBox.Show("Some entities in Column IsSource of powerstation datatable are not strict ones or zeros"); - } + bool isSource = issr == 1; + if (issr > 1) { + MessageBox.Show("Some entities in Column IsSource of powerstation datatable are not strict ones or zeros"); } + WindStressPRM.PowerStation.StationType stationType; //casting stationtype if (featureData["Sttype"].ToString().Trim().ToUpper() == "POLE") { - dummystation.Stationtype = WindStressPRM.PowerStation.StationType.Pole; + stationType = WindStressPRM.PowerStation.StationType.Pole; } else if (featureData["Sttype"].ToString().Trim().ToUpper() == "TRANS") { - dummystation.Stationtype = WindStressPRM.PowerStation.StationType.Trans; + stationType = WindStressPRM.PowerStation.StationType.Trans; } else if (featureData["Sttype"].ToString().Trim().ToUpper() == "ENDPOINT") { - dummystation.Stationtype = WindStressPRM.PowerStation.StationType.Endstat; + stationType = WindStressPRM.PowerStation.StationType.Endstat; } else { throw new System.Exception("Point in powerstation layer has unrecognised type"); } IPoint featurepointcoords = featurepoint.BasicGeometry as IPoint; - dummystation.Coordinate = DotspPointToPRM(featurepointcoords); - powerpointsToPRM.Add(dummystation); + WindStressPRM.PowerStation dummyStation = new WindStressPRM.PowerStation( + DotspPointToPRM(featurepointcoords), identifier, Name, Voltage, stationType, isSource + ); + powerpointsToPRM.Add(dummyStation); } //Create a PRM_wind class and add all the properties from above WindStressPRM.StressPowerChecker prmwind = new WindStressPRM.StressPowerChecker(); diff --git a/WindStressPRM/DTO/Output.cs b/WindStressPRM/DTO/Output.cs index 8d7630564160837b40ba7705ac87668098172c76..fc287ad8ac123c2d45d722c35d3a7b41fa565c90 100644 --- a/WindStressPRM/DTO/Output.cs +++ b/WindStressPRM/DTO/Output.cs @@ -21,8 +21,10 @@ namespace WindStressPRM /// </summary> public List<Powerline> DisabledLines { get; set; } /// <summary> - /// specific coordinates in which probable break of 35 kV powerlines may occure, checked on regular grid - /// список точек с возможной поломкой ЛЭП меньше 35кВ с регулярной сетки + /// specific coordinates in which probable break of 35 kV powerlines may occure, checked on regular grid with interpolation. + /// minimum distance between these points equals to Input.Distance35kVCheck meters. + /// список координат точек с возможной поломкой ЛЭП меньше 35кВ, среди пересечения скоростей и прогностического ветра. + /// минимальное расстояние между которыми не менее Input.Distance35kVCheck метров /// </summary> public List<Coordinate> SpecificCoordinates { get; set; } } diff --git a/WindStressPRM/Objects/ClimateCell.cs b/WindStressPRM/Objects/ClimateCell.cs index 8f67c2eeeafc8698709ec725baf7b1fd1bc23cde..0a8bcec048e2bb59cc72eba1bc4b7bd7649c16c9 100644 --- a/WindStressPRM/Objects/ClimateCell.cs +++ b/WindStressPRM/Objects/ClimateCell.cs @@ -12,23 +12,23 @@ namespace WindStressPRM public class ClimateCell { /// <summary> - /// once-in-5-years frequency wind, m/s - /// скорость ветра повторяемости один раз в 5 лет, м/с + /// once-in-5-years frequency wind module, m/s + /// модуль скорости ветра с повторяемостью один раз в 5 лет, м/с /// </summary> public double Wind5; /// <summary> - /// once-in-10-years frequency wind, m/s - /// скорость ветра повторяемости один раз в 10 лет, м/с + /// once-in-10-years frequency wind module, m/s + /// модуль скорости ветра с повторяемостью один раз в 10 лет, м/с /// </summary> public double Wind10 { get; private set; } /// <summary> - /// once-in-15-years frequency wind, m/s - /// скорость ветра повторяемости один раз в 15 лет, м/с + /// once-in-15-years frequency wind module, m/s + /// модуль скорости ветра с повторяемостью один раз в 15 лет, м/с /// </summary> public double Wind15 { get; private set; } /// <summary> - /// once-in-25-years frequency wind, m/s - /// скорость ветра повторяемости один раз в 25 лет, м/с + /// once-in-25-years frequency wind module, m/s + /// модуль скорости ветра с повторяемостью один раз в 25 лет, м/с /// для ЛЭП, построенных после 1987 года. /// </summary> public double Wind25 { get; private set; } @@ -73,16 +73,28 @@ namespace WindStressPRM { w15 = 0; } - if (Double.IsNaN(w25)) + if (Double.IsNaN(w25)) { w25 = 0; } // ветер по модулю не должен превышать 70м/с - if (w5 >= 0 && w5 > 70) { throw new System.ArgumentOutOfRangeException("w5", w5, "Expected 0=<w5<70"); } - if (w10 >= 0 && w10 > 70) { throw new System.ArgumentOutOfRangeException("w10", w10, "Expected 0=<w10<70"); } - if (w15 >= 0 && w15 > 70) { throw new System.ArgumentOutOfRangeException("w15", w15, "Expected 0=<w15<70"); } - if (w25 >= 0 && w25 > 70) { throw new System.ArgumentOutOfRangeException("w25", w25, "Expected 0=<w25<70"); } - return w5 >=0 && w5 < 70 && w10 >=0 && w10 < 70 && w15 >= 0 && w15 < 70 && w25 >= 0 && w25 < 70; + if (w5 < 0 || w5 > 70) + { + throw new System.ArgumentOutOfRangeException("w5", w5, "Expected 0=<w5<70"); + } + if (w10 < 0 || w10 > 70) + { + throw new System.ArgumentOutOfRangeException("w10", w10, "Expected 0=<w10<70"); + } + if (w15 < 0 || w15 > 70) + { + throw new System.ArgumentOutOfRangeException("w15", w15, "Expected 0=<w15<70"); + } + if (w25 < 0 || w25 > 70) + { + throw new System.ArgumentOutOfRangeException("w25", w25, "Expected 0=<w25<70"); + } + return true; } } } diff --git a/WindStressPRM/Objects/PowerStation.cs b/WindStressPRM/Objects/PowerStation.cs index 5611c7849285df0dd0ec9a91715c18f410b27bee..3f7ac8186b0afaf645cfbe4261a882b470e16ef6 100644 --- a/WindStressPRM/Objects/PowerStation.cs +++ b/WindStressPRM/Objects/PowerStation.cs @@ -67,10 +67,6 @@ namespace WindStressPRM /// список оканчивающихся/начинающихся на подстанции ЛЭП /// </summary> public IList<Powerline> LineList { get; set; } - public PowerStation() - { - //default constructor - } /// <summary> /// designated constructor /// </summary> @@ -89,14 +85,17 @@ namespace WindStressPRM this.Stationtype = stationtype; this.IsSource = issource; this.IsON = false; + CheckValue(); } - public bool CheckValue() + public void CheckValue() { bool checker = Identifier >= 0; - if (!checker) { throw new System.ArgumentOutOfRangeException("Identifier", Identifier, "Identifer expected to be more than 0"); } - checker = checker && Voltage > 0 && Voltage < 1500; - if (!checker) { throw new System.ArgumentOutOfRangeException("Voltage", Voltage, "Voltage expected to be in range (0,1500)"); } - return checker; + if (Identifier < 0) { + throw new System.ArgumentOutOfRangeException("Identifier", Identifier, "Identifer expected to be more than 0"); + } + if (Voltage < 0 || Voltage > 1500) { + throw new System.ArgumentOutOfRangeException("Voltage", Voltage, "Voltage expected to be in range (0,1500)"); + } } /// <summary> /// Gets attached lines list