diff --git a/MES_Wind/frmMain.cs b/MES_Wind/frmMain.cs index 7364a515ecf2291887d4753277fbecf09374033b..2c73368a788e0e4bb9120bb2b17cca23fb53c792 100644 --- a/MES_Wind/frmMain.cs +++ b/MES_Wind/frmMain.cs @@ -204,7 +204,7 @@ namespace MES_Wind WindStressPRM.Powerline dummyline = new WindStressPRM.Powerline(); DataRow featureData = feature.DataRow; dummyline.Identifier = feature.Fid; - dummyline.Year = 1990;//int.Parse(featureData["Year"].ToString()); + dummyline.Year = int.Parse(featureData["Year"].ToString()); dummyline.Height = double.Parse(featureData["HeightOffs"].ToString()); dummyline.Voltage = int.Parse(featureData["Voltage"].ToString()); dummyline.PointFromID = int.Parse(featureData["PointFrom"].ToString()); diff --git a/WindStressPRM/DTO/Input.cs b/WindStressPRM/DTO/Input.cs index d8f3193f900ff301d7482069be1dfd04b7a64f17..e6becc5dc0e056ff9d955e9589d2cf91792172f8 100644 --- a/WindStressPRM/DTO/Input.cs +++ b/WindStressPRM/DTO/Input.cs @@ -15,13 +15,11 @@ namespace WindStressPRM /// массив прогностического ветра /// </summary> public Matrix<PrognosticCell> PrognosticCells { get; set; } - /// <summary> /// climate raster array /// массив климатических полей скорости ветра заданной повторяемости /// </summary> public Matrix<ClimateCell> ClimateCells { get; set; } - /// <summary> /// lines list /// список ЛЭП @@ -29,19 +27,25 @@ namespace WindStressPRM public List<Powerline> PowerLines { get; set; } /// <summary> /// stations/poles list - /// список точечных объектов - трансформаторных подстанций/столбов/понижающих(конечных) подстанций + /// список точечных объектов - трансформаторных подстанций/столбов/понижающих(конечных) подстанций /// </summary> public List<PowerStation> PowerStations { get; set; } /// <summary> + /// step for interpolation in CheckSpecificLines() + /// шаг для интерполяции в CheckSpecificLines() + /// </summary> + public double Distance35kVCheck { get; set; } + /// <summary> /// maximum distance for line segment, meters /// максимальное расстояние между точками ЛЭП, для которых проверяется сломаются/несломаются под действием ветра /// </summary> - public double DistThreshold - { - get - { - return 500; - } + public double DistThreshold { get; set; } + /// <summary> + /// default constructor + /// </summary> + public Input() { + DistThreshold = 500; + Distance35kVCheck = 1000; } } } diff --git a/WindStressPRM/DTO/Output.cs b/WindStressPRM/DTO/Output.cs index 62cb72ca4c17d497af768f7814101182ee2299e4..ae5d1c78977c2d9036c4ad9f63bf4bf90aa18a08 100644 --- a/WindStressPRM/DTO/Output.cs +++ b/WindStressPRM/DTO/Output.cs @@ -20,5 +20,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кВ с регулярной сетки + /// </summary> + public List<Coordinate> SpectificCoordinates { get; set; } } } diff --git a/WindStressPRM/WindStressPRM.cs b/WindStressPRM/WindStressPRM.cs index 02d6abc6fd933d25cf40f423e4caa254015b9af3..419286cc1f7cafe0729301e0330a219da1274490 100644 --- a/WindStressPRM/WindStressPRM.cs +++ b/WindStressPRM/WindStressPRM.cs @@ -36,6 +36,7 @@ namespace WindStressPRM Output output = new Output(); output.DisabledStations = new List<PowerStation>(); output.DisabledLines = prmBrokenLines; + output.SpectificCoordinates = CheckSpecificLines(); foreach (PowerStation powerStation in input.PowerStations) { //stations of type pole can be disabled if the line is broken @@ -208,7 +209,7 @@ namespace WindStressPRM { return cell.Wind25; } - else if (power > 5 && power < 330) + else if (power > 5 && power <= 330) { return cell.Wind10; } @@ -273,6 +274,37 @@ namespace WindStressPRM return result; } + private List<Coordinate> CheckSpecificLines() + { + List<Coordinate> list = new List<Coordinate>(); + Coordinate firstCoordinate = Input.ClimateCells.Origin; + Index lastIndex = new Index( Input.ClimateCells.RowsCount() - 1, Input.ClimateCells.ColumnCount() - 1); + Coordinate lastCoordinate = Input.ClimateCells.CellToProjection(lastIndex); + for (double x = firstCoordinate.X; x <= lastCoordinate.X; + x += Math.Sign(lastCoordinate.X - firstCoordinate.X)*Input.Distance35kVCheck) + { + for (double y = firstCoordinate.Y; y <= lastCoordinate.Y; + y += Math.Sign(lastCoordinate.Y - firstCoordinate.Y) * Input.Distance35kVCheck) + { + Coordinate current = new Coordinate(x, y); + double wind = interpol<ClimateCell>(current, Input.ClimateCells, delegate(ClimateCell cell) { return cell.Wind10; }); + double u = interpol<PrognosticCell>(current, Input.PrognosticCells, delegate(PrognosticCell cell) { return cell.VelocityX; }); + double v = interpol<PrognosticCell>(current, Input.PrognosticCells, delegate(PrognosticCell cell) { return cell.VelocityY; }); + if (Double.IsNaN(u) || Double.IsNaN(v) || Double.IsNaN(wind)) + { + // interpolation fail. we can't say everything about here + // discussion: also we can save these points for detail analysis + continue; + } + Console.WriteLine((Math.Sqrt(u * u + v * v) - wind).ToString()); + if (Math.Sqrt(u*u + v*v) > wind) { + list.Add(current); + } + } + } + return list; + } + private double interpol<T>(Coordinate coords, Matrix<T> matrix, Func<T, double> valueGetter) { // select directions for projections