using System; using System.Collections.Generic; using WindStressPRM; namespace Mes_Wind_console { class Program { static void Main(string[] args) { Test(); } static void Test() { const int rowCountPrognostic = 3; const int colCountPrognostic = 3; var prognosticMatrix = new Matrix<PrognosticCell> // TODO: Matrix Лишняя проверка Cells.Rank в RowsCount() / ColumnCount()? { Cells = new PrognosticCell[rowCountPrognostic, colCountPrognostic], Size = new CellSize(500, 500), Origin = new Coordinate(3555223.71, 5828444.07), // TODO: Coordinate в комментариях к полям - широта и долгота ?? done }; // fill cells of prognostic matrix for (int i = 0; i < rowCountPrognostic; i++) { for (int j = 0; j < colCountPrognostic; j++) { // Also you can use Double.NaN; double uValue = 100 * (i + j * 10); double vValue = -(i + j * 10); prognosticMatrix.Cells[i, j] = new PrognosticCell(uValue, vValue); // TODO: PrognosticCell комментарии к параметрам - размерность, про NaN } } //Now we create climate raster class const int rowCountClim = 3; const int columnCountClim = 3; var climateMatrix = new Matrix<ClimateCell> { Cells = new ClimateCell[rowCountClim, columnCountClim], Size = new CellSize(500, 500),// TODO: CellSize названия width/height. DONE Origin = new Coordinate(3555223.71, 5828444.07), }; // fill cells of climate matrix for (int i = 0; i < rowCountClim; i++) { for (int j = 0; j < columnCountClim; j++) { //add or substruct in range 0 - 27 to change what lines will be broken climateMatrix.Cells[i, j] = new ClimateCell(5, 10, 15, 20); // TODO: ClimateCell комментарии к параметрам - размерность, про NaN. DONE } } // create powerlines layer var powerlines = new List<Powerline>(); Coordinate first = climateMatrix.Origin; const int numStations = 5; const double step = 100; for (int i = 0; i < numStations - 1; i++) { // TODO: Powerline и др. детализация сообщения об ошибке (какой параметр вышел за пределы и его значение). DONE var dummyline = new Powerline(new List<Coordinate>(), 100 + i, 2000, 10, 330, i + 1, i); dummyline.Coordinates.Add(first); var second = new Coordinate(first.X + step, first.Y - step); dummyline.Coordinates.Add(second); first = second; powerlines.Add(dummyline); } //create Powerstation list var powerpoints = new List<PowerStation>(); for (int i = 0; i < numStations; i++) { // TODO: PowerStation и др. соответствие названий полей и параметров конструкторов. DONE // TODO: PowerStation проверка параметров на допустимый диапазон. DONE powerpoints.Add(new PowerStation( new Coordinate(climateMatrix.Origin.X + step * i, climateMatrix.Origin.X - step * i), i, String.Format("Station #{0}", i), 330, // TODO: PowerStation - название поля Voltage вместо Power?. DONE ((i == numStations - 1) ? PowerStation.StationType.Endstat : PowerStation.StationType.Pole), // TODO: StationType комментарии к значениям enum. Done (i == 0))); } //Create a PRM_wind class and add all the properties from above var prmwind = new StressPowerChecker(); var input = new Input { PowerLines = powerlines, PowerStations = powerpoints, // TODO: PrognosticCells/ClimateCells - требуется ли совпадение размеров и координат узлов двух данных матриц? Если требуется, то нужна проверка в CheckPower() // DONE, не требуется. PrognosticCells = prognosticMatrix, ClimateCells = climateMatrix, }; var output = prmwind.CheckPower(input); foreach (var line in output.DisabledLines) { Console.WriteLine("disabled line identifier is {0}", line.Identifier); } foreach (var station in output.DisabledStations) { Console.WriteLine("disabled station identifier is {0}", station.Identifier); } foreach (var coordinate in output.SpectificCoordinates) // TODO: Название Output.Spectific -> Specific ? { Console.WriteLine("in coordinate ({0}; {1}) 35kV and less could be broken", coordinate.X, coordinate.Y); } Console.WriteLine("end"); Console.ReadKey(); } } }