Skip to content
Snippets Groups Projects
Commit 0551a2b5 authored by Debolskiy Andrey's avatar Debolskiy Andrey :bicyclist_tone5:
Browse files

Added comments in Russian and the rest of checkvalue functions for classes

parent be1acdd0
No related branches found
No related tags found
No related merge requests found
......@@ -163,7 +163,7 @@ namespace MES_Wind
{
Coordinate dummyCellCoords = clim15RasterLayer.Bounds.CellCenter_ToProj(i,j);
WindStressPRM.Coordinate dummyClimCoords = new WindStressPRM.Coordinate(dummyCellCoords.X,dummyCellCoords.Y);
//add or substruct in range 0 - 27 to change what lines will be broken
//add or substruct in range 0 - 27 to change what lines will be broken
WindStressPRM.ClimateCell dummyClim = new WindStressPRM.ClimateCell(dummyClimCoords, clim5RasterLayer.DataSet.Value[j, i], clim10RasterLayer.DataSet.Value[j, i] - 10, clim15RasterLayer.DataSet.Value[j, i]);
//WindStressPRM.ClimateCell dummyClim = new WindStressPRM.ClimateCell(dummyClimCoords, 0, 0, 0);
climWindRow.Add(dummyClim);
......@@ -215,7 +215,23 @@ namespace MES_Wind
MessageBox.Show("Some entities in Column IsSource of powerstation datatable are not strict ones or zeros");
}
}
dummystation.type = featureData["Type"].ToString();
//casting stationtype
if (featureData["Type"].ToString().Trim().ToUpper() == "POLE")
{
dummystation.type = WindStressPRM.PowerStation.stationtype.pole;
}
else if (featureData["Type"].ToString().Trim().ToUpper() == "TRANS")
{
dummystation.type = WindStressPRM.PowerStation.stationtype.trans;
}
else if (featureData["Type"].ToString().Trim().ToUpper() == "ENDSTAT")
{
dummystation.type = WindStressPRM.PowerStation.stationtype.endstat;
}
else
{
throw new System.Exception("Point in powerstation layer has unrecognised type");
}
IPoint featurepointcoords = featurepoint.BasicGeometry as IPoint;
dummystation.coords = DotspPointToPRM(featurepointcoords);
powerpointsToPRM.Add(dummystation);
......
......@@ -5,15 +5,18 @@ namespace WindStressPRM
{
/// <summary>
/// Index class for raster lists in list
/// Индекс-класс для растровых массивов
/// </summary>
public class Index
{
/// <summary>
/// Outer index
/// Outer index
/// Внешний индекс
/// </summary>
public int Row;
/// <summary>
/// Inner index
/// Внутренний индекс
/// </summary>
public int Col;
/// <summary>
......@@ -37,14 +40,17 @@ namespace WindStressPRM
{
/// <summary>
/// easting coordinate
/// Координата по широте
/// </summary>
public double X;
/// <summary>
/// northing coordinate
/// Координата по долготе
/// </summary>
public double Y;
/// <summary>
/// designated constructor
/// Основной конструктор
/// </summary>
/// <param name="X"></param>
/// <param name="Y"></param>
......@@ -60,6 +66,10 @@ namespace WindStressPRM
this.Y = Y;
}
}
/// <summary>
/// Проверка на валидность значений
/// </summary>
/// <returns></returns>
public bool CheckValue()
{
bool checker = true;
......@@ -72,19 +82,23 @@ namespace WindStressPRM
}
/// <summary>
/// Cell obj for regular prognostic wind field
/// Объект ячейки для поля прогностического ветра на высоте 10м на регулярной сетке
/// </summary>
public class PrognosticCell
{
/// <summary>
/// U - component of wind velocity
/// U - component of wind velocity, m/s
/// U - компонента скорости ветра, м/с
/// </summary>
public double velocityX;
/// <summary>
/// V - component of wind velocity
/// V - component of wind velocity, m/s
/// V - компонента скорости ветра, м/с
/// </summary>
public double velocityY;
/// <summary>
/// Cell center coordinates
/// Координаты центра ячейки
/// </summary>
public Coordinate coords;
/// <summary>
......@@ -106,9 +120,14 @@ namespace WindStressPRM
this.velocityY = vY;
}
}
/// <summary>
/// Проверка полей на валидность
/// </summary>
/// <returns></returns>
public bool CheckValue()
{
bool checker = false;
///Скорость ветра на высоте 10м от поверхности на Земле не может превышать 70м/c
if (Math.Abs(velocityX) < 70) { checker = true; }
else { checker = false; }
if (Math.Abs(velocityY) < 70) { checker = true; }
......@@ -118,23 +137,28 @@ namespace WindStressPRM
}
/// <summary>
/// Cell obj for climate wind regular data
/// Объект - ячейка полей ветра определенной повторяемости на 10м на регулярной сетке
/// </summary>
public class ClimateCell
{
/// <summary>
/// once-in-5-years frequency wind
/// once-in-5-years frequency wind, m/s
/// скорость ветра повторяемости один раз в 5 лет, м/с
/// </summary>
public double wind5;
/// <summary>
/// once-in-10-years frequency wind
/// once-in-10-years frequency wind, m/s
/// скорость ветра повторяемости один раз в 10 лет, м/с
/// </summary>
public double wind10;
/// <summary>
/// once-in-15-years frequency wind
/// once-in-15-years frequency wind, m/s
/// скорость ветра повторяемости один раз в 15 лет, м/с
/// </summary>
public double wind15;
/// <summary>
/// Cell center coordinate pair
/// Координаты центра ячейки
/// </summary>
public Coordinate coords;
/// <summary>
......@@ -158,6 +182,10 @@ namespace WindStressPRM
this.wind15 = w15;
}
}
/// <summary>
/// Провекра валидности полей класса
/// </summary>
/// <returns></returns>
public bool CheckValue()
{
bool checker = true;
......@@ -168,12 +196,23 @@ namespace WindStressPRM
}
/// <summary>
/// Cell Size parameters
/// Параметры ячейки (регулярной сетки)
/// </summary>
public struct CellSize
{
/// <summary>
/// ширина ячейки (расстояние между соседними по широте центрами ячеек)
/// </summary>
public double width;
/// <summary>
/// высота ячейки (расстояние между соседними по долготе центрами ячеек)
/// </summary>
public double height;
/// <summary>
/// designated constructor
/// </summary>
/// <param name="wdh">Cell Width</param>
/// <param name="hgh">Cell Height</param>
public CellSize(double wdh, double hgh)
{
this.width = wdh;
......@@ -183,6 +222,10 @@ namespace WindStressPRM
throw new System.ArgumentException("Cell width or height values are incorrect!");
}
}
/// <summary>
/// Проверка валидности полей
/// </summary>
/// <returns></returns>
public bool CheckValue()
{
bool checker = true;
......@@ -193,46 +236,60 @@ 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;
/// <summary>
/// average height of cable span between two poles, meters
/// average height of cable span between two poles, meters
/// средняя высота пролета, м
/// </summary>
public double height;
/// <summary>
/// power kW for switches
/// Мощность ЛЭП, кВт
/// </summary>
public int power;
/// <summary>
/// Line vertices coordinate list
/// список координат вершин ЛЭП как линейного объекта
/// </summary>
public List<Coordinate> coords { get; set; }
/// <summary>
/// assigned powerstation/pole
/// идентификатор соответсвующего конца/начала линии (столб, трансформаторная подстанция, понижающая подстанция)
/// </summary>
public int pointFromID;
/// <summary>
/// assigned powerstation/pole
/// идентификатор соответсвующего конца/начала линии (столб, трансформаторная подстанция, понижающая подстанция)
/// </summary>
public int pointToID;
/// <summary>
/// broken/not broken switch
/// сломана (true) или нет (false) линяя
/// </summary>
public bool isbroken;
/// <summary>
/// power on switch
/// получает (true) или нет (false) линия питание
/// </summary>
public bool ison;
private int MissingIdValue = -1;
public Powerline()
{
//default constructor body
}
/// <summary>
/// designated constructor
/// </summary>
......@@ -256,19 +313,31 @@ namespace WindStressPRM
this.ison = false;
this.pointFromID = fromID;
this.pointToID = toID;
if (!(this.CheckValue()))
{ throw new System.ArgumentException("Powerline object wasn't initialized correctly"); }
}
/// <summary>
/// default constructor
/// проверка валидности полей
/// </summary>
public Powerline() : this(new List<Coordinate>(), -1, 0, 0, 0, -1, -1) { }
/// <returns></returns>
public bool CheckValue()
{
bool checker = true;
if ( identifier>= 0 && Math.Abs(year - 1985) < 45 && Math.Abs(height - 15)<15 && power > 0 && power < 1000 && pointFromID >=0 && pointToID >=0)
{ checker = true; }
else { checker = false; }
return checker;
}
}
/// <summary>
/// powerstation/pole point class
/// класс для трансформаторных подстанций/столбов/понижающих(конечных) подстанций
/// </summary>
public class PowerStation
{
/// <summary>
/// unique id
/// уникальный идентификатор подстанции/столба
/// </summary>
public int identifier;
/// <summary>
......@@ -277,29 +346,42 @@ namespace WindStressPRM
public Coordinate coords;
/// <summary>
/// station name field
/// название подстанции
/// </summary>
public string name;
/// <summary>
/// power, kW
/// мощность, кВт
/// </summary>
public int power;
/// <summary>
/// type of point - trans/pole/endpoint
/// тип станции - трансформаторная подстанция/столб/понижающая(конечная)подстанция
/// </summary>
public string type;
public enum stationtype {pole, trans, endstat};
/// <summary>
/// тип подстанции
/// </summary>
public stationtype type;
/// <summary>
/// is point a source?
/// является ли подстаниция источником питания (в случае ТЭЦ или питания от внешних для рассматриваемой цепи ЛЭП)
/// </summary>
public bool issource;
/// <summary>
/// power on switch
/// поступает (true) или нет (false) на подстанцию питание
/// </summary>
public bool ison;
/// <summary>
/// asigned powerlines list
/// список оканчивающихся/начинающихся на подстанции ЛЭП
/// </summary>
public List<Powerline> linelist;
private int MissingIdValue = -1;
public PowerStation()
{
//default constructor
}
/// <summary>
/// designated constructor
/// </summary>
......@@ -310,7 +392,7 @@ namespace WindStressPRM
/// <param name="sttype"></param>
/// <param name="issource"></param>
/// <param name="ison"></param>
public PowerStation(Coordinate crds, int id, string stname, int stpower, string sttype, bool issource)
public PowerStation(Coordinate crds, int id, string stname, int stpower, stationtype sttype, bool issource)
{
this.coords = crds;
this.identifier = id;
......@@ -320,10 +402,15 @@ namespace WindStressPRM
this.issource = issource;
this.ison = false;
}
/// <summary>
/// default constructor
/// </summary>
public PowerStation() : this(new Coordinate(0, 0), -1, "", 0, "", false) { }
public bool CheckValue()
{
bool checker = true;
if (identifier >=0 && power >0 && power < 1000 )
{ checker = true; }
else { checker = false; }
return checker;
}
}
enum FunctionType
......@@ -341,40 +428,49 @@ namespace WindStressPRM
{
/// <summary>
/// prognistic raster info
/// массив прогностического ветра
/// </summary>
public List<List<PrognosticCell>> prognosticCells {get; set;}
/// <summary>
/// prognostic raster cell info
/// параметры ячеек регулярной сетки прогностического ветра
/// </summary>
public CellSize prognosticCellSize { get; set; }
/// <summary>
/// affine coefficients from prognostic raster projections
/// коэффициенты аффиного проеобразования из проекции массива прогностического ветра
/// </summary>
public double[] prognosticAffineCoefficients { get; set; }
/// <summary>
/// climate raster array
/// массив климатических полей скорости ветра заданной повторяемости
/// </summary>
public List<List<ClimateCell>> climateCells { get; set; }
/// <summary>
/// climate raster cell info
/// параметры ячеек регулярной сетки климатических полей скорости ветра заданной повторяемости
/// </summary>
public CellSize climateCellSize { get; set; }
/// <summary>
/// affine coefficients from climate raster projection
/// коэффициенты аффинного преобразования из проекции массива климатических полей скорости ветра заданной повторяемости
/// </summary>
public double[] climateAffineCoefficients { 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 dist_threshold
{
......@@ -391,10 +487,12 @@ namespace WindStressPRM
{
/// <summary>
/// stations list without power
/// Список подстанций на которые не поступит питание в результате предсказанных поломок ЛЭП в сети
/// </summary>
public List<PowerStation> disabledStations { get; set; }
/// <summary>
/// broken lines list
/// Список прогнозируемых сломанных ЛЭП в результате ветрового воздействия
/// </summary>
public List<Powerline> disabledLines { get; set; }
}
......@@ -410,6 +508,7 @@ namespace WindStressPRM
/// <summary>
/// Main function for power graph algorithm
/// Основая функция для вычисления распределения питания по графу ЛЭП-подстанции
/// </summary>
public Output CheckPower(Input input)
{
......@@ -439,7 +538,8 @@ namespace WindStressPRM
}
foreach (PowerStation powerStation in input.powerStations)
{
if (!powerStation.ison && !(powerStation.type.ToUpperInvariant().Trim() == "POLE"))
//stations of type pole can be disabled if the line is broken
if (!powerStation.ison && !(powerStation.type == PowerStation.stationtype.pole))
{
output.disabledStations.Add(powerStation);
}
......@@ -468,7 +568,7 @@ namespace WindStressPRM
{
if (powerStation.identifier != sourcepoint.identifier && (powerStation.identifier == line.pointFromID || powerStation.identifier == line.pointToID))
{
if (!(sourcepoint.type.Trim().ToUpperInvariant() == "POLE")) {
if (!(sourcepoint.type == PowerStation.stationtype.pole)) {
powerStation.ison = true;
CheckPowerPointsForStation(powerStation);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment