diff --git a/WindStressPRM/DTO/Input.cs b/WindStressPRM/DTO/Input.cs new file mode 100644 index 0000000000000000000000000000000000000000..d8f3193f900ff301d7482069be1dfd04b7a64f17 --- /dev/null +++ b/WindStressPRM/DTO/Input.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace WindStressPRM +{ + /// <summary> + /// DTO for input + /// </summary> + public class Input + { + /// <summary> + /// prognistic raster info + /// массив прогностического ветра + /// </summary> + public Matrix<PrognosticCell> PrognosticCells { get; set; } + + /// <summary> + /// climate raster array + /// массив климатических полей скорости ветра заданной повторяемости + /// </summary> + public Matrix<ClimateCell> ClimateCells { get; set; } + + /// <summary> + /// lines list + /// список ЛЭП + /// </summary> + public List<Powerline> PowerLines { get; set; } + /// <summary> + /// stations/poles list + /// список точечных объектов - трансформаторных подстанций/столбов/понижающих(конечных) подстанций + /// </summary> + public List<PowerStation> PowerStations { get; set; } + /// <summary> + /// maximum distance for line segment, meters + /// максимальное расстояние между точками ЛЭП, для которых проверяется сломаются/несломаются под действием ветра + /// </summary> + public double DistThreshold + { + get + { + return 500; + } + } + } +} diff --git a/WindStressPRM/DTO/Output.cs b/WindStressPRM/DTO/Output.cs new file mode 100644 index 0000000000000000000000000000000000000000..62cb72ca4c17d497af768f7814101182ee2299e4 --- /dev/null +++ b/WindStressPRM/DTO/Output.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace WindStressPRM +{ + /// <summary> + /// Output + /// </summary> + public class Output + { + /// <summary> + /// stations list without power + /// Список подстанций на которые не поступит питание в результате предсказанных поломок ЛЭП в сети + /// </summary> + public List<PowerStation> DisabledStations { get; set; } + /// <summary> + /// broken lines list + /// Список прогнозируемых сломанных ЛЭП в результате ветрового воздействия + /// </summary> + public List<Powerline> DisabledLines { get; set; } + } +} diff --git a/WindStressPRM/Objects/ClimateCell.cs b/WindStressPRM/Objects/ClimateCell.cs new file mode 100644 index 0000000000000000000000000000000000000000..446828d9c9917b757fca4e27dc5c77bc23311c6f --- /dev/null +++ b/WindStressPRM/Objects/ClimateCell.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace WindStressPRM +{ + /// <summary> + /// Cell obj for climate wind regular data + /// Объект - ячейка полей ветра определенной повторяемости на 10м на регулярной сетке + /// </summary> + public class ClimateCell + { + /// <summary> + /// once-in-5-years frequency wind, m/s + /// скорость ветра повторяемости один раз в 5 лет, м/с + /// </summary> + public double Wind5; + /// <summary> + /// once-in-10-years frequency wind, m/s + /// скорость ветра повторяемости один раз в 10 лет, м/с + /// </summary> + public double Wind10 { get; private set; } + /// <summary> + /// once-in-15-years frequency wind, m/s + /// скорость ветра повторяемости один раз в 15 лет, м/с + /// </summary> + public double Wind15 { get; private set; } + /// <summary> + /// Cell center coordinate pair + /// Координаты центра ячейки + /// </summary> + public Coordinate Coordinate { get; private set; } + /// <summary> + /// designated constructor + /// </summary> + /// <param name="coord"></param> + /// <param name="w5"></param> + /// <param name="w10"></param> + /// <param name="w15"></param> + public ClimateCell(Coordinate coord, double w5, double w10, double w15) + { + this.Coordinate = coord; + this.Wind5 = w5; + this.Wind10 = w10; + this.Wind15 = w15; + if (!(this.CheckValue())) + { + throw new System.ArgumentException("Climate wind value is not correct"); + } + } + /// <summary> + /// Провекра валидности полей класса + /// </summary> + /// <returns></returns> + public bool CheckValue() + { + double w5 = Wind5; + double w10 = Wind10; + double w15 = Wind15; + if (Double.IsNaN(w5)) // if is Nan - zerofied it. + { + w5 = 0; + } + if (Double.IsNaN(w10)) + { + w10 = 0; + } + if (Double.IsNaN(w15)) + { + w15 = 0; + } + // ветер по модулю не должен превышать 70м/с + return Math.Abs(w5) < 70 && Math.Abs(w10) < 70 && Math.Abs(w15) < 70; + } + } +} diff --git a/WindStressPRM/Objects/PowerStation.cs b/WindStressPRM/Objects/PowerStation.cs new file mode 100644 index 0000000000000000000000000000000000000000..9a130623d433bb9201aeb316c70230ecc3e96b8d --- /dev/null +++ b/WindStressPRM/Objects/PowerStation.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace WindStressPRM +{ + /// <summary> + /// powerstation/pole point class + /// класс для трансформаторных подстанций/столбов/понижающих(конечных) подстанций + /// </summary> + public class PowerStation + { + /// <summary> + /// unique id + /// уникальный идентификатор подстанции/столба + /// </summary> + public int Identifier { get; set; } + /// <summary> + /// Coordinates + /// </summary> + public Coordinate Coordinate { get; set; } + /// <summary> + /// station name field + /// название подстанции + /// </summary> + public string Name { get; set; } + /// <summary> + /// power, kW + /// мощность, кВ + /// </summary> + public int Power { get; set; } + /// <summary> + /// type of point - trans/pole/endpoint + /// тип станции - трансформаторная подстанция/столб/понижающая(конечная)подстанция + /// </summary> + public enum StationType + { + Pole, Trans, Endstat + }; + /// <summary> + /// тип подстанции + /// </summary> + public StationType Stationtype { get; set; } + /// <summary> + /// is point a source? + /// является ли подстаниция источником питания (в случае ТЭЦ или питания от внешних для рассматриваемой цепи ЛЭП) + /// </summary> + public bool IsSource { get; set; } + /// <summary> + /// power on switch + /// поступает (true) или нет (false) на подстанцию питание + /// </summary> + public bool IsON { get; set; } + /// <summary> + /// asigned powerlines list + /// список оканчивающихся/начинающихся на подстанции ЛЭП + /// </summary> + public IList<Powerline> LineList { get; set; } + public PowerStation() + { + //default constructor + } + /// <summary> + /// designated constructor + /// </summary> + /// <param name="crds"></param> + /// <param name="id"></param> + /// <param name="stname"></param> + /// <param name="stpower"></param> + /// <param name="sttype"></param> + /// <param name="issource"></param> + /// <param name="ison"></param> + public PowerStation(Coordinate crds, int id, string stname, int stpower, StationType sttype, bool issource) + { + this.Coordinate = crds; + this.Identifier = id; + this.Name = stname; + this.Power = stpower; + this.Stationtype = sttype; + this.IsSource = issource; + this.IsON = false; + } + public bool CheckValue() + { + bool checker = Identifier >= 0 && Power > 0 && Power < 1000; + return checker; + } + } +} diff --git a/WindStressPRM/Objects/Powerline.cs b/WindStressPRM/Objects/Powerline.cs new file mode 100644 index 0000000000000000000000000000000000000000..171a3ce2f0b17190427d4230618ce1e2f2cc1c4e --- /dev/null +++ b/WindStressPRM/Objects/Powerline.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace WindStressPRM +{ + /// <summary> + /// power line object + /// объект - ЛЭП + /// </summary> + public class Powerline + { + /// <summary> + /// unique id + /// уникальный идентификатор + /// </summary> + public int Identifier { get; set; } + /// <summary> + /// year of construction + /// год постройки ЛЭП + /// </summary> + public int Year { get; set; } + /// <summary> + /// average height of cable span between two poles, meters + /// средняя высота пролета, м + /// </summary> + public double Height { get; set; } + /// <summary> + /// power kV for switches + /// Напряжение ЛЭП, кВ + /// </summary> + public int Power { get; set; } + /// <summary> + /// Line vertices coordinate list + /// список координат вершин ЛЭП как линейного объекта + /// </summary> + public IList<Coordinate> Coordinates { get; set; } + /// <summary> + /// assigned powerstation/pole + /// идентификатор соответсвующего конца/начала линии (столб, трансформаторная подстанция, понижающая подстанция) + /// </summary> + public int PointFromID { get; set; } + /// <summary> + /// assigned powerstation/pole + /// идентификатор соответсвующего конца/начала линии (столб, трансформаторная подстанция, понижающая подстанция) + /// </summary> + public int PointToID { get; set; } + /// <summary> + /// broken/not broken switch + /// сломана (true) или нет (false) линяя + /// </summary> + public bool IsBroken { get; set; } + /// <summary> + /// power on switch + /// получает (true) или нет (false) линия питание + /// </summary> + public bool IsON { get; set; } + + public Powerline() + { + //default constructor body + } + /// <summary> + /// designated constructor + /// </summary> + /// <param name="coord"></param> + /// <param name="id"></param> + /// <param name="yer"></param> + /// <param name="h"></param> + /// <param name="pw"></param> + /// <param name="isbrkn"></param> + /// <param name="ison"></param> + /// <param name="toID"></param> + /// <param name="fromID"></param> + public Powerline(IList<Coordinate> coordinates, int id, int year, double height, int power, int toID, int fromID) + { + this.Coordinates = coordinates; + this.Identifier = id; + this.Year = year; + this.Height = height; + this.Power = power; + this.IsBroken = false; + this.IsON = false; + this.PointFromID = fromID; + this.PointToID = toID; + if (!(this.CheckValue())) + { + throw new System.ArgumentException("Powerline object wasn't initialized correctly"); + } + } + /// <summary> + /// проверка валидности полей + /// </summary> + /// <returns></returns> + public bool CheckValue() + { + bool checker = + Identifier >= 0 && Math.Abs(Year - 1985) < 45 && + Math.Abs(Height - 15) < 15 && Power > 0 && Power < 1000 && + PointFromID >= 0 && PointToID >= 0; + return checker; + } + } +} diff --git a/WindStressPRM/Objects/PrognosticCell.cs b/WindStressPRM/Objects/PrognosticCell.cs new file mode 100644 index 0000000000000000000000000000000000000000..b1fb9923d46f7efad24c69c541994327f33b56c6 --- /dev/null +++ b/WindStressPRM/Objects/PrognosticCell.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace WindStressPRM +{ + /// <summary> + /// Cell obj for regular prognostic wind field + /// Объект ячейки для поля прогностического ветра на высоте 10м на регулярной сетке + /// </summary> + public class PrognosticCell + { + /// <summary> + /// U - component of wind velocity, m/s + /// U - компонента скорости ветра, м/с + /// </summary> + public double VelocityX { get; private set; } + /// <summary> + /// V - component of wind velocity, m/s + /// V - компонента скорости ветра, м/с + /// </summary> + public double VelocityY { get; private set; } + /// <summary> + /// Cell center coordinates + /// Координаты центра ячейки + /// </summary> + public Coordinate Coordinate { get; private set; } + /// <summary> + /// designated constructor + /// </summary> + /// <param name="coord"> Coordinate pair</param> + /// <param name="vX"> U component</param> + /// <param name="vY"> V component</param> + public PrognosticCell(Coordinate coord, double vX, double vY) + { + this.Coordinate = coord; + this.VelocityX = vX; + this.VelocityY = vY; + if (!(this.CheckValue())) + { + throw new System.ArgumentException("Prognostic wind velocities are incorrect"); + } + } + /// <summary> + /// Проверка полей на валидность + /// </summary> + /// <returns></returns> + public bool CheckValue() + { + bool res1 = Double.IsNaN(VelocityX); + bool res2 = Double.IsNaN(VelocityY); + if (res1 != res2) + { + return false; + } + // пустые данные + if (res1 == res2 == true) + { + return true; + } + ///Скорость ветра на высоте 10м от поверхности на Земле не может превышать 70м/c + return Math.Abs(Math.Pow(VelocityX, 2) + Math.Pow(VelocityY, 2)) <= 4900; + } + } +} diff --git a/WindStressPRM/Matrix.cs b/WindStressPRM/Utils/CellSize.cs similarity index 58% rename from WindStressPRM/Matrix.cs rename to WindStressPRM/Utils/CellSize.cs index 66a4146a5ec75980bf95129496578dfcfc7a6226..0a76f253eb009c9424660d7492fb90c712b274ac 100644 --- a/WindStressPRM/Matrix.cs +++ b/WindStressPRM/Utils/CellSize.cs @@ -1,43 +1,10 @@ using System; using System.Collections.Generic; +using System.Linq; +using System.Text; namespace WindStressPRM { - /// <summary> - /// Generic Matrix of type T - /// </summary> - /// <typeparam name="T"></typeparam> - public class Matrix<T> - { - /// <summary> - /// AffineCoefficients for matrix from raster projection - /// </summary> - public double[] AffineCoefficients { get; set; } - /// <summary> - /// Size of cell. In meters - /// </summary> - public CellSize Size { get; set; } - /// <summary> - /// Cells Container - /// </summary> - public T[,] Cells { get; set; } - /// <summary> - /// Number of rows in matrix - /// </summary> - /// <returns></returns> - public int RowsCount() - { - return Cells.Rank > 0 ? Cells.GetLength(0) : 0; - } - /// <summary> - /// Number of columns - /// </summary> - /// <returns></returns> - public int ColumnCount() - { - return Cells.Rank > 1 ? Cells.GetLength(1) : 0; - } - } /// <summary> /// Cell Sizes /// Параметры ячейки (регулярной сетки) diff --git a/WindStressPRM/Utils/Coordinate.cs b/WindStressPRM/Utils/Coordinate.cs new file mode 100644 index 0000000000000000000000000000000000000000..07a764f9400cf185284a8d05a8a217f7909104a5 --- /dev/null +++ b/WindStressPRM/Utils/Coordinate.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; + +namespace WindStressPRM +{ + /// <summary> + /// Coordinate pair + /// </summary> + public class Coordinate + { + /// <summary> + /// easting coordinate + /// Координата по широте + /// </summary> + public double X { get; private set; } + /// <summary> + /// northing coordinate + /// Координата по долготе + /// </summary> + public double Y { get; private set; } + /// <summary> + /// designated constructor + /// Основной конструктор + /// </summary> + /// <param name="X"></param> + /// <param name="Y"></param> + public Coordinate(double X, double Y) + { + this.X = X; + this.Y = Y; + if (!(this.CheckValue())) + { + throw new System.ArgumentException("Passed coordinates are not valid!"); + } + } + /// <summary> + /// Проверка на валидность значений + /// </summary> + /// <returns></returns> + public bool CheckValue() + { + return !Double.IsNaN(X) && !Double.IsInfinity(X) && !Double.IsNaN(Y) && !Double.IsInfinity(Y); + } + } +} diff --git a/WindStressPRM/Utils/Index.cs b/WindStressPRM/Utils/Index.cs new file mode 100644 index 0000000000000000000000000000000000000000..e115fee98672a7dfb64489e98e1cde97f9d0ff58 --- /dev/null +++ b/WindStressPRM/Utils/Index.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; + +namespace WindStressPRM +{ + /// <summary> + /// Index class for raster lists in list + /// Индекс-класс для растровых массивов + /// </summary> + public class Index + { + /// <summary> + /// Outer index + /// Внешний индекс + /// </summary> + public int Row { get; set; } + /// <summary> + /// Inner index + /// Внутренний индекс + /// </summary> + public int Col { get; set; } + /// <summary> + /// designated constructor + /// </summary> + /// <param name="Row">row index</param> + /// <param name="Col">column index</param> + public Index(int Row, int Col) + { + if (Row <= -1 || Col <= -1) + { + throw new System.ArgumentOutOfRangeException("Index must be initialized with nonegative integer value"); + } + this.Row = Row; + this.Col = Col; + } + } +} diff --git a/WindStressPRM/Utils/Matrix.cs b/WindStressPRM/Utils/Matrix.cs new file mode 100644 index 0000000000000000000000000000000000000000..494d4a4b5db6831b749067dfca39329300661b29 --- /dev/null +++ b/WindStressPRM/Utils/Matrix.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; + +namespace WindStressPRM +{ + /// <summary> + /// Generic Matrix of type T + /// </summary> + /// <typeparam name="T"></typeparam> + public class Matrix<T> + { + /// <summary> + /// AffineCoefficients for matrix from raster projection + /// </summary> + public double[] AffineCoefficients { get; set; } + /// <summary> + /// Size of cell. In meters + /// </summary> + public CellSize Size { get; set; } + /// <summary> + /// Cells Container + /// </summary> + public T[,] Cells { get; set; } + /// <summary> + /// Number of rows in matrix + /// </summary> + /// <returns></returns> + public int RowsCount() + { + return Cells.Rank > 0 ? Cells.GetLength(0) : 0; + } + /// <summary> + /// Number of columns + /// </summary> + /// <returns></returns> + public int ColumnCount() + { + return Cells.Rank > 1 ? Cells.GetLength(1) : 0; + } + } +} diff --git a/WindStressPRM/WindStressPRM.cs b/WindStressPRM/WindStressPRM.cs index eb5bf8acdebbe3c1934fcd7cb7846018870d9d57..cc8a808af31e9341249723e9a8c1667690d9915e 100644 --- a/WindStressPRM/WindStressPRM.cs +++ b/WindStressPRM/WindStressPRM.cs @@ -3,380 +3,6 @@ using System.Collections.Generic; namespace WindStressPRM { - /// <summary> - /// Index class for raster lists in list - /// Индекс-класс для растровых массивов - /// </summary> - public class Index - { - /// <summary> - /// Outer index - /// Внешний индекс - /// </summary> - public int Row { get; set; } - /// <summary> - /// Inner index - /// Внутренний индекс - /// </summary> - public int Col { get; set; } - /// <summary> - /// designated constructor - /// </summary> - /// <param name="Row">row index</param> - /// <param name="Col">column index</param> - public Index(int Row, int Col) - { - if (Row <= -1 || Col <= -1) { - throw new System.ArgumentOutOfRangeException("Index must be initialized with nonegative integer value"); - } - this.Row = Row; - this.Col = Col; - } - } - /// <summary> - /// Coordinate pair - /// </summary> - public class Coordinate - { - /// <summary> - /// easting coordinate - /// Координата по широте - /// </summary> - public double X { get; private set;} - /// <summary> - /// northing coordinate - /// Координата по долготе - /// </summary> - public double Y { get; private set; } - /// <summary> - /// designated constructor - /// Основной конструктор - /// </summary> - /// <param name="X"></param> - /// <param name="Y"></param> - public Coordinate(double X, double Y) - { - this.X = X; - this.Y = Y; - if (!(this.CheckValue())) - { - throw new System.ArgumentException("Passed coordinates are not valid!"); - } - } - /// <summary> - /// Проверка на валидность значений - /// </summary> - /// <returns></returns> - public bool CheckValue() - { - return !Double.IsNaN(X) && !Double.IsInfinity(X) && !Double.IsNaN(Y) && !Double.IsInfinity(Y); - } - } - /// <summary> - /// Cell obj for regular prognostic wind field - /// Объект ячейки для поля прогностического ветра на высоте 10м на регулярной сетке - /// </summary> - public class PrognosticCell - { - /// <summary> - /// U - component of wind velocity, m/s - /// U - компонента скорости ветра, м/с - /// </summary> - public double VelocityX { get; private set; } - /// <summary> - /// V - component of wind velocity, m/s - /// V - компонента скорости ветра, м/с - /// </summary> - public double VelocityY { get; private set; } - /// <summary> - /// Cell center coordinates - /// Координаты центра ячейки - /// </summary> - public Coordinate Coordinate { get; private set; } - /// <summary> - /// designated constructor - /// </summary> - /// <param name="coord"> Coordinate pair</param> - /// <param name="vX"> U component</param> - /// <param name="vY"> V component</param> - public PrognosticCell(Coordinate coord, double vX, double vY) - { - this.Coordinate = coord; - this.VelocityX = vX; - this.VelocityY = vY; - if (!(this.CheckValue())) - { - throw new System.ArgumentException("Prognostic wind velocities are incorrect"); - } - } - /// <summary> - /// Проверка полей на валидность - /// </summary> - /// <returns></returns> - public bool CheckValue() - { - bool res1 = Double.IsNaN(VelocityX); - bool res2 = Double.IsNaN(VelocityY); - if (res1 != res2) { - return false; - } - // пустые данные - if (res1 == res2 == true) { - return true; - } - ///Скорость ветра на высоте 10м от поверхности на Земле не может превышать 70м/c - return Math.Abs(Math.Pow(VelocityX, 2) + Math.Pow(VelocityY, 2)) <= 4900; - } - } - /// <summary> - /// Cell obj for climate wind regular data - /// Объект - ячейка полей ветра определенной повторяемости на 10м на регулярной сетке - /// </summary> - public class ClimateCell - { - /// <summary> - /// once-in-5-years frequency wind, m/s - /// скорость ветра повторяемости один раз в 5 лет, м/с - /// </summary> - public double Wind5; - /// <summary> - /// once-in-10-years frequency wind, m/s - /// скорость ветра повторяемости один раз в 10 лет, м/с - /// </summary> - public double Wind10 { get; private set; } - /// <summary> - /// once-in-15-years frequency wind, m/s - /// скорость ветра повторяемости один раз в 15 лет, м/с - /// </summary> - public double Wind15 { get; private set; } - /// <summary> - /// Cell center coordinate pair - /// Координаты центра ячейки - /// </summary> - public Coordinate Coordinate { get; private set; } - /// <summary> - /// designated constructor - /// </summary> - /// <param name="coord"></param> - /// <param name="w5"></param> - /// <param name="w10"></param> - /// <param name="w15"></param> - public ClimateCell(Coordinate coord, double w5, double w10, double w15) - { - this.Coordinate = coord; - this.Wind5 = w5; - this.Wind10 = w10; - this.Wind15 = w15; - if (!(this.CheckValue())) - { - throw new System.ArgumentException("Climate wind value is not correct"); - } - } - /// <summary> - /// Провекра валидности полей класса - /// </summary> - /// <returns></returns> - public bool CheckValue() - { - double w5 = Wind5; - double w10 = Wind10; - double w15 = Wind15; - if (Double.IsNaN(w5)) // if is Nan - zerofied it. - { - w5 = 0; - } - if (Double.IsNaN(w10)) - { - w10 = 0; - } - if (Double.IsNaN(w15)) - { - w15 = 0; - } - // ветер по модулю не должен превышать 70м/с - return Math.Abs(w5) < 70 && Math.Abs(w10) < 70 && Math.Abs(w15) < 70; - } - } - /// <summary> - /// power line object - /// объект - ЛЭП - /// </summary> - public class Powerline - { - /// <summary> - /// unique id - /// уникальный идентификатор - /// </summary> - public int Identifier { get; set; } - /// <summary> - /// year of construction - /// год постройки ЛЭП - /// </summary> - public int Year { get; set; } - /// <summary> - /// average height of cable span between two poles, meters - /// средняя высота пролета, м - /// </summary> - public double Height { get; set; } - /// <summary> - /// power kV for switches - /// Напряжение ЛЭП, кВ - /// </summary> - public int Power { get; set; } - /// <summary> - /// Line vertices coordinate list - /// список координат вершин ЛЭП как линейного объекта - /// </summary> - public IList<Coordinate> Coordinates { get; set; } - /// <summary> - /// assigned powerstation/pole - /// идентификатор соответсвующего конца/начала линии (столб, трансформаторная подстанция, понижающая подстанция) - /// </summary> - public int PointFromID { get; set; } - /// <summary> - /// assigned powerstation/pole - /// идентификатор соответсвующего конца/начала линии (столб, трансформаторная подстанция, понижающая подстанция) - /// </summary> - public int PointToID { get; set; } - /// <summary> - /// broken/not broken switch - /// сломана (true) или нет (false) линяя - /// </summary> - public bool IsBroken { get; set; } - /// <summary> - /// power on switch - /// получает (true) или нет (false) линия питание - /// </summary> - public bool IsON { get; set; } - - public Powerline() - { - //default constructor body - } - /// <summary> - /// designated constructor - /// </summary> - /// <param name="coord"></param> - /// <param name="id"></param> - /// <param name="yer"></param> - /// <param name="h"></param> - /// <param name="pw"></param> - /// <param name="isbrkn"></param> - /// <param name="ison"></param> - /// <param name="toID"></param> - /// <param name="fromID"></param> - public Powerline(IList<Coordinate> coordinates, int id, int year, double height, int power, int toID, int fromID) - { - this.Coordinates = coordinates; - this.Identifier = id; - this.Year = year; - this.Height = height; - this.Power = power; - this.IsBroken = false; - this.IsON = false; - this.PointFromID = fromID; - this.PointToID = toID; - if (!(this.CheckValue())) - { - throw new System.ArgumentException("Powerline object wasn't initialized correctly"); - } - } - /// <summary> - /// проверка валидности полей - /// </summary> - /// <returns></returns> - public bool CheckValue() - { - bool checker = - Identifier >= 0 && Math.Abs(Year - 1985) < 45 && - Math.Abs(Height - 15) < 15 && Power > 0 && Power < 1000 && - PointFromID >= 0 && PointToID >= 0; - return checker; - } - } - /// <summary> - /// powerstation/pole point class - /// класс для трансформаторных подстанций/столбов/понижающих(конечных) подстанций - /// </summary> - public class PowerStation - { - /// <summary> - /// unique id - /// уникальный идентификатор подстанции/столба - /// </summary> - public int Identifier { get; set; } - /// <summary> - /// Coordinates - /// </summary> - public Coordinate Coordinate { get; set; } - /// <summary> - /// station name field - /// название подстанции - /// </summary> - public string Name { get; set; } - /// <summary> - /// power, kW - /// мощность, кВ - /// </summary> - public int Power { get; set; } - /// <summary> - /// type of point - trans/pole/endpoint - /// тип станции - трансформаторная подстанция/столб/понижающая(конечная)подстанция - /// </summary> - public enum StationType - { - Pole, Trans, Endstat - }; - /// <summary> - /// тип подстанции - /// </summary> - public StationType Stationtype { get; set; } - /// <summary> - /// is point a source? - /// является ли подстаниция источником питания (в случае ТЭЦ или питания от внешних для рассматриваемой цепи ЛЭП) - /// </summary> - public bool IsSource { get; set; } - /// <summary> - /// power on switch - /// поступает (true) или нет (false) на подстанцию питание - /// </summary> - public bool IsON { get; set; } - /// <summary> - /// asigned powerlines list - /// список оканчивающихся/начинающихся на подстанции ЛЭП - /// </summary> - public IList<Powerline> LineList { get; set; } - public PowerStation() - { - //default constructor - } - /// <summary> - /// designated constructor - /// </summary> - /// <param name="crds"></param> - /// <param name="id"></param> - /// <param name="stname"></param> - /// <param name="stpower"></param> - /// <param name="sttype"></param> - /// <param name="issource"></param> - /// <param name="ison"></param> - public PowerStation(Coordinate crds, int id, string stname, int stpower, StationType sttype, bool issource) - { - this.Coordinate = crds; - this.Identifier = id; - this.Name = stname; - this.Power = stpower; - this.Stationtype = sttype; - this.IsSource = issource; - this.IsON = false; - } - public bool CheckValue() - { - bool checker = Identifier >=0 && Power >0 && Power < 1000; - return checker; - } - } - enum FunctionType { FunctionVelocityX = 0, @@ -386,61 +12,6 @@ namespace WindStressPRM FunctionClimate15 = 4 } /// <summary> - /// DTO for input - /// </summary> - public class Input - { - /// <summary> - /// prognistic raster info - /// массив прогностического ветра - /// </summary> - public Matrix<PrognosticCell> PrognosticCells { get; set; } - - /// <summary> - /// climate raster array - /// массив климатических полей скорости ветра заданной повторяемости - /// </summary> - public Matrix<ClimateCell> ClimateCells { get; set; } - - /// <summary> - /// lines list - /// список ЛЭП - /// </summary> - public List<Powerline> PowerLines { get; set; } - /// <summary> - /// stations/poles list - /// список точечных объектов - трансформаторных подстанций/столбов/понижающих(конечных) подстанций - /// </summary> - public List<PowerStation> PowerStations { get; set; } - /// <summary> - /// maximum distance for line segment, meters - /// максимальное расстояние между точками ЛЭП, для которых проверяется сломаются/несломаются под действием ветра - /// </summary> - public double DistThreshold - { - get - { - return 500; - } - } - } - /// <summary> - /// Output - /// </summary> - public class Output - { - /// <summary> - /// stations list without power - /// Список подстанций на которые не поступит питание в результате предсказанных поломок ЛЭП в сети - /// </summary> - public List<PowerStation> DisabledStations { get; set; } - /// <summary> - /// broken lines list - /// Список прогнозируемых сломанных ЛЭП в результате ветрового воздействия - /// </summary> - public List<Powerline> DisabledLines { get; set; } - } - /// <summary> /// main calculations class /// </summary> public class StressPowerChecker diff --git a/WindStressPRM/WindStressPRM.csproj b/WindStressPRM/WindStressPRM.csproj index 333b5aef423db463b221f98142e8dfa6f9602275..81b36dad75ce37b388e1a836c5637ec045fe49f2 100644 --- a/WindStressPRM/WindStressPRM.csproj +++ b/WindStressPRM/WindStressPRM.csproj @@ -35,7 +35,16 @@ <Reference Include="Microsoft.CSharp" /> </ItemGroup> <ItemGroup> - <Compile Include="Matrix.cs" /> + <Compile Include="DTO\Input.cs" /> + <Compile Include="DTO\Output.cs" /> + <Compile Include="Objects\ClimateCell.cs" /> + <Compile Include="Utils\CellSize.cs" /> + <Compile Include="Utils\Coordinate.cs" /> + <Compile Include="Utils\Index.cs" /> + <Compile Include="Utils\Matrix.cs" /> + <Compile Include="Objects\Powerline.cs" /> + <Compile Include="Objects\PowerStation.cs" /> + <Compile Include="Objects\PrognosticCell.cs" /> <Compile Include="WindStressPRM.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup>