Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Mes_Wind_console
{
class Program
{
static void Main(string[] args)
{
const int rowCountPrognostic = 3;
const int colCountPrognostic = 3;
WindStressPRM.Matrix<WindStressPRM.PrognosticCell> prognosticMatrix = new WindStressPRM.Matrix<WindStressPRM.PrognosticCell>();
prognosticMatrix.Cells = new WindStressPRM.PrognosticCell[rowCountPrognostic, colCountPrognostic];
prognosticMatrix.Size = new WindStressPRM.CellSize(500, 500);
prognosticMatrix.Origin = new WindStressPRM.Coordinate(3555223.71, 5828444.07);
// 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 WindStressPRM.PrognosticCell(uValue, vValue);
}
}
//Now we create climate raster class
const int rowCountClim = 3;
const int columnCountClim = 3;
WindStressPRM.Matrix<WindStressPRM.ClimateCell> climateMatrix = new WindStressPRM.Matrix<WindStressPRM.ClimateCell>();
climateMatrix.Cells = new WindStressPRM.ClimateCell[rowCountClim, columnCountClim];
climateMatrix.Size = new WindStressPRM.CellSize(500, 500);
climateMatrix.Origin = new WindStressPRM.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
double clim5 = 5;
double clim10 = 10;
double clim15 = 15;
double clim25 = 20;
climateMatrix.Cells[i, j] = new WindStressPRM.ClimateCell(clim5, clim10, clim15, clim25);
}
}
// create powerlines layer
List<WindStressPRM.Powerline> powerlines = new List<WindStressPRM.Powerline>();
WindStressPRM.Coordinate first = climateMatrix.Origin;
const int numbStations = 5;
const double step = 100;
for (int i = 0; i < numbStations - 1; i++)
{
WindStressPRM.Powerline dummyline = new WindStressPRM.Powerline();
dummyline.Identifier = 100 + i;
dummyline.Year = 2000;
dummyline.Height = 10;
dummyline.Voltage = 330;
dummyline.PointFromID = i;
dummyline.PointToID = i + 1;
dummyline.Coordinates = new List<WindStressPRM.Coordinate>();
dummyline.Coordinates.Add(first);
WindStressPRM.Coordinate second = new WindStressPRM.Coordinate(first.X + step, first.Y - step);
dummyline.Coordinates.Add(second);
first = second;
powerlines.Add(dummyline);
}
//create PRM_station list to pass to PRM_wind from loaded point layer
List<WindStressPRM.PowerStation> powerpoints = new List<WindStressPRM.PowerStation>();
for (int i = 0; i < numbStations; i++)
{
WindStressPRM.PowerStation dummystation = new WindStressPRM.PowerStation();
dummystation.Identifier = i;
dummystation.Name = "dummy name";
dummystation.Power = 330;
dummystation.IsSource = i == 0;
//casting stationtype
dummystation.Stationtype = WindStressPRM.PowerStation.StationType.Pole;
if (i == numbStations - 1)
{
dummystation.Stationtype = WindStressPRM.PowerStation.StationType.Endstat;
}
dummystation.Coordinate = new WindStressPRM.Coordinate(climateMatrix.Origin.X + step * i, climateMatrix.Origin.X - step * i);
powerpoints.Add(dummystation);
}
//Create a PRM_wind class and add all the properties from above
WindStressPRM.StressPowerChecker prmwind = new WindStressPRM.StressPowerChecker();
WindStressPRM.Input input = new WindStressPRM.Input();
input.PowerLines = powerlines;
input.PowerStations = powerpoints;
input.PrognosticCells = prognosticMatrix;
input.ClimateCells = climateMatrix;
WindStressPRM.Output output = prmwind.CheckPower(input);
foreach (WindStressPRM.Powerline line in output.DisabledLines) {
Console.WriteLine("disabled line identifier is " + line.Identifier.ToString());
}
foreach (WindStressPRM.PowerStation station in output.DisabledStations) {
Console.WriteLine("disabled station identifier is " + station.Identifier.ToString());
}
foreach (WindStressPRM.Coordinate coordinate in output.SpectificCoordinates) {
Console.WriteLine("in coordinate " + coordinate.X.ToString() + "; " + coordinate.Y.ToString() + " 35kV and less could be broken");
}
Console.WriteLine("end");
}
}
}