Skip to content
Snippets Groups Projects
Commit 2493f6c8 authored by Антон Кудряшов's avatar Антон Кудряшов
Browse files

- fixed comments and checks

parent 0419d30a
No related branches found
No related tags found
No related merge requests found
......@@ -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();
......
......@@ -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; }
}
......
......@@ -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;
}
}
}
......@@ -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
......
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