Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MES_Wind
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Debolskiy Andrey
MES_Wind
Commits
3e9f8ce8
Commit
3e9f8ce8
authored
8 years ago
by
Debolskiy Andrey
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into second_round_andrey
# Conflicts: # WindStressPRM/WindStressPRM.cs
parents
60dee1ff
4bd177f8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MES_Wind/frmMain.cs
+29
-29
29 additions, 29 deletions
MES_Wind/frmMain.cs
WindStressPRM/WindStressPRM.cs
+222
-134
222 additions, 134 deletions
WindStressPRM/WindStressPRM.cs
with
251 additions
and
163 deletions
MES_Wind/frmMain.cs
+
29
−
29
View file @
3e9f8ce8
...
...
@@ -180,14 +180,14 @@ namespace MES_Wind
{
WindStressPRM
.
Powerline
dummyline
=
new
WindStressPRM
.
Powerline
();
DataRow
featureData
=
feature
.
DataRow
;
dummyline
.
i
dentifier
=
feature
.
Fid
;
dummyline
.
y
ear
=
int
.
Parse
(
featureData
[
"Year"
].
ToString
());
dummyline
.
h
eight
=
double
.
Parse
(
featureData
[
"HeightOffs"
].
ToString
());
dummyline
.
p
ower
=
int
.
Parse
(
featureData
[
"Power"
].
ToString
());
dummyline
.
p
ointFromID
=
int
.
Parse
(
featureData
[
"PointFrom"
].
ToString
());
dummyline
.
p
ointToID
=
int
.
Parse
(
featureData
[
"PointTo"
].
ToString
());
dummyline
.
I
dentifier
=
feature
.
Fid
;
dummyline
.
Y
ear
=
int
.
Parse
(
featureData
[
"Year"
].
ToString
());
dummyline
.
H
eight
=
double
.
Parse
(
featureData
[
"HeightOffs"
].
ToString
());
dummyline
.
P
ower
=
int
.
Parse
(
featureData
[
"Power"
].
ToString
());
dummyline
.
P
ointFromID
=
int
.
Parse
(
featureData
[
"PointFrom"
].
ToString
());
dummyline
.
P
ointToID
=
int
.
Parse
(
featureData
[
"PointTo"
].
ToString
());
LineString
featureline
=
feature
.
BasicGeometry
as
LineString
;
dummyline
.
c
oords
=
DotspLinestringToPrm
(
featureline
);
dummyline
.
C
oord
inate
s
=
DotspLinestringToPrm
(
featureline
);
powerlinesToPRM
.
Add
(
dummyline
);
}
//create PRM_station list to pass to PRM_wind from loaded point layer
...
...
@@ -196,19 +196,19 @@ namespace MES_Wind
{
WindStressPRM
.
PowerStation
dummystation
=
new
WindStressPRM
.
PowerStation
();
DataRow
featureData
=
featurepoint
.
DataRow
;
dummystation
.
i
dentifier
=
featurepoint
.
Fid
;
dummystation
.
n
ame
=
featureData
[
"Name"
].
ToString
();
dummystation
.
p
ower
=
int
.
Parse
(
featureData
[
"Power"
].
ToString
());
dummystation
.
I
dentifier
=
featurepoint
.
Fid
;
dummystation
.
N
ame
=
featureData
[
"Name"
].
ToString
();
dummystation
.
P
ower
=
int
.
Parse
(
featureData
[
"Power"
].
ToString
());
int
issr
=
int
.
Parse
(
featureData
[
"IsSource"
].
ToString
());
if
(
issr
==
0
)
{
dummystation
.
iss
ource
=
false
;
dummystation
.
IsS
ource
=
false
;
}
else
{
if
(
issr
==
1
)
{
dummystation
.
iss
ource
=
true
;
dummystation
.
IsS
ource
=
true
;
}
else
{
...
...
@@ -218,45 +218,45 @@ namespace MES_Wind
//casting stationtype
if
(
featureData
[
"Type"
].
ToString
().
Trim
().
ToUpper
()
==
"POLE"
)
{
dummystation
.
type
=
WindStressPRM
.
PowerStation
.
s
tation
t
ype
.
p
ole
;
dummystation
.
Station
type
=
WindStressPRM
.
PowerStation
.
S
tation
T
ype
.
P
ole
;
}
else
if
(
featureData
[
"Type"
].
ToString
().
Trim
().
ToUpper
()
==
"TRANS"
)
{
dummystation
.
type
=
WindStressPRM
.
PowerStation
.
s
tation
t
ype
.
t
rans
;
dummystation
.
Station
type
=
WindStressPRM
.
PowerStation
.
S
tation
T
ype
.
T
rans
;
}
else
if
(
featureData
[
"Type"
].
ToString
().
Trim
().
ToUpper
()
==
"ENDSTAT"
)
{
dummystation
.
type
=
WindStressPRM
.
PowerStation
.
s
tation
t
ype
.
e
ndstat
;
dummystation
.
Station
type
=
WindStressPRM
.
PowerStation
.
S
tation
T
ype
.
E
ndstat
;
}
else
{
throw
new
System
.
Exception
(
"Point in powerstation layer has unrecognised type"
);
}
IPoint
featurepointcoords
=
featurepoint
.
BasicGeometry
as
IPoint
;
dummystation
.
c
oord
s
=
DotspPointToPRM
(
featurepointcoords
);
dummystation
.
C
oord
inate
=
DotspPointToPRM
(
featurepointcoords
);
powerpointsToPRM
.
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
.
p
owerLines
=
powerlinesToPRM
;
input
.
p
owerStations
=
powerpointsToPRM
;
input
.
p
rognosticCells
=
prognosticWind
;
input
.
p
rognosticCellSize
=
progcellsize
;
input
.
p
rognosticAffineCoefficients
=
prog_aff
;
input
.
c
limateCells
=
climWind
;
input
.
c
limateCellSize
=
climCellsize
;
input
.
c
limateAffineCoefficients
=
climAffinecoeffs
;
input
.
P
owerLines
=
powerlinesToPRM
;
input
.
P
owerStations
=
powerpointsToPRM
;
input
.
P
rognosticCells
=
prognosticWind
;
input
.
P
rognosticCellSize
=
progcellsize
;
input
.
P
rognosticAffineCoefficients
=
prog_aff
;
input
.
C
limateCells
=
climWind
;
input
.
C
limateCellSize
=
climCellsize
;
input
.
C
limateAffineCoefficients
=
climAffinecoeffs
;
WindStressPRM
.
Output
output
=
prmwind
.
CheckPower
(
input
);
// new FeatureSet for resulting disabled points
IFeatureSet
disabledPointSet
=
new
FeatureSet
(
FeatureType
.
Point
);
disabledPointSet
.
Projection
=
map1
.
Projection
;
DataColumn
pointcolumn
=
new
DataColumn
(
"ID"
);
disabledPointSet
.
DataTable
.
Columns
.
Add
(
pointcolumn
);
foreach
(
WindStressPRM
.
PowerStation
disabledStation
in
output
.
d
isabledStations
)
foreach
(
WindStressPRM
.
PowerStation
disabledStation
in
output
.
D
isabledStations
)
{
Coordinate
coords
=
new
Coordinate
(
disabledStation
.
c
oord
s
.
X
,
disabledStation
.
c
oord
s
.
Y
);
Coordinate
coords
=
new
Coordinate
(
disabledStation
.
C
oord
inate
.
X
,
disabledStation
.
C
oord
inate
.
Y
);
DotSpatial
.
Topology
.
Point
disabledPoint
=
new
DotSpatial
.
Topology
.
Point
(
coords
);
Feature
disabledPointFeature
=
new
Feature
(
disabledPoint
);
//disabledPointFeature.DataRow["ID"] = disabledStation.identifier;
...
...
@@ -275,17 +275,17 @@ namespace MES_Wind
DataColumn
lineIDcolumn
=
new
DataColumn
(
"ID"
);
disabledLineSet
.
DataTable
.
Columns
.
Add
(
lineIDcolumn
);
int
lineID
=
0
;
foreach
(
WindStressPRM
.
Powerline
disabledLine
in
output
.
d
isabledLines
)
foreach
(
WindStressPRM
.
Powerline
disabledLine
in
output
.
D
isabledLines
)
{
List
<
Coordinate
>
lineArray
=
new
List
<
Coordinate
>();
foreach
(
WindStressPRM
.
Coordinate
prmcoordinate
in
disabledLine
.
c
oords
)
foreach
(
WindStressPRM
.
Coordinate
prmcoordinate
in
disabledLine
.
C
oord
inate
s
)
{
Coordinate
lineVerticeCoords
=
new
Coordinate
(
prmcoordinate
.
X
,
prmcoordinate
.
Y
);
lineArray
.
Add
(
lineVerticeCoords
);
}
LineString
lineGeometry
=
new
LineString
(
lineArray
);
IFeature
lineFeature
=
disabledLineSet
.
AddFeature
(
lineGeometry
);
lineID
=
disabledLine
.
i
dentifier
;
lineID
=
disabledLine
.
I
dentifier
;
lineFeature
.
DataRow
[
"ID"
]
=
lineID
;
}
//add resulting layer to the map
...
...
This diff is collapsed.
Click to expand it.
WindStressPRM/WindStressPRM.cs
+
222
−
134
View file @
3e9f8ce8
...
...
@@ -57,7 +57,7 @@ namespace WindStressPRM
public
Coordinate
(
double
X
,
double
Y
)
{
if
(!(
this
.
CheckValue
()))
{
{
throw
new
System
.
ArgumentException
(
"Passed coordinates are not valid!"
);
}
else
...
...
@@ -73,10 +73,13 @@ namespace WindStressPRM
public
bool
CheckValue
()
{
bool
checker
=
true
;
if
(
X
!=
null
)
{
checker
=
true
;
}
else
{
checker
=
false
;
}
if
(
Y
!=
null
)
{
checker
=
true
;
}
else
{
checker
=
false
;
}
if
(
X
!=
null
&&
Y
!=
null
)
{
checker
=
true
;
}
else
{
checker
=
false
;
}
return
checker
;
}
}
...
...
@@ -90,17 +93,17 @@ namespace WindStressPRM
/// U - component of wind velocity, m/s
/// U - компонента скорости ветра, м/с
/// </summary>
public
double
v
elocityX
;
public
double
V
elocityX
;
/// <summary>
/// V - component of wind velocity, m/s
/// V - компонента скорости ветра, м/с
/// </summary>
public
double
v
elocityY
;
public
double
V
elocityY
;
/// <summary>
/// Cell center coordinates
/// Координаты центра ячейки
/// </summary>
public
Coordinate
c
oord
s
;
public
Coordinate
C
oord
inate
;
/// <summary>
/// designated constructor
/// </summary>
...
...
@@ -115,9 +118,9 @@ namespace WindStressPRM
}
else
{
this
.
c
oord
s
=
coord
;
this
.
v
elocityX
=
vX
;
this
.
v
elocityY
=
vY
;
this
.
C
oord
inate
=
coord
;
this
.
V
elocityX
=
vX
;
this
.
V
elocityY
=
vY
;
}
}
/// <summary>
...
...
@@ -128,10 +131,13 @@ namespace WindStressPRM
{
bool
checker
=
false
;
///Скорость ветра на высоте 10м от поверхности на Земле не может превышать 70м/c
if
(
Math
.
Abs
(
velocityX
)
<
70
)
{
checker
=
true
;
}
else
{
checker
=
false
;
}
if
(
Math
.
Abs
(
velocityY
)
<
70
)
{
checker
=
true
;
}
else
{
checker
=
false
;
}
if
(
Math
.
Abs
(
VelocityX
)
<
70
&&
Math
.
Abs
(
VelocityY
)
<
70
)
{
checker
=
true
;
}
else
{
checker
=
false
;
}
return
checker
;
}
}
...
...
@@ -145,22 +151,22 @@ namespace WindStressPRM
/// once-in-5-years frequency wind, m/s
/// скорость ветра повторяемости один раз в 5 лет, м/с
/// </summary>
public
double
w
ind5
;
public
double
W
ind5
;
/// <summary>
/// once-in-10-years frequency wind, m/s
/// скорость ветра повторяемости один раз в 10 лет, м/с
/// </summary>
public
double
w
ind10
;
public
double
W
ind10
;
/// <summary>
/// once-in-15-years frequency wind, m/s
/// скорость ветра повторяемости один раз в 15 лет, м/с
/// </summary>
public
double
w
ind15
;
public
double
W
ind15
;
/// <summary>
/// Cell center coordinate pair
/// Координаты центра ячейки
/// </summary>
public
Coordinate
c
oord
s
;
public
Coordinate
C
oord
inate
;
/// <summary>
/// designated constructor
/// </summary>
...
...
@@ -176,10 +182,10 @@ namespace WindStressPRM
}
else
{
this
.
c
oord
s
=
coord
;
this
.
w
ind5
=
w5
;
this
.
w
ind10
=
w10
;
this
.
w
ind15
=
w15
;
this
.
C
oord
inate
=
coord
;
this
.
W
ind5
=
w5
;
this
.
W
ind10
=
w10
;
this
.
W
ind15
=
w15
;
}
}
/// <summary>
...
...
@@ -189,8 +195,13 @@ namespace WindStressPRM
public
bool
CheckValue
()
{
bool
checker
=
true
;
if
(
Math
.
Abs
(
wind5
)
<
70
&&
Math
.
Abs
(
wind10
)
<
70
&&
Math
.
Abs
(
wind15
)
<
70
)
{
checker
=
true
;
}
else
{
checker
=
false
;
}
if
(
Math
.
Abs
(
Wind5
)
<
70
&&
Math
.
Abs
(
Wind10
)
<
70
&&
Math
.
Abs
(
Wind15
)
<
70
)
{
checker
=
true
;
}
else
{
checker
=
false
;
}
return
checker
;
}
}
...
...
@@ -203,11 +214,11 @@ namespace WindStressPRM
/// <summary>
/// ширина ячейки (расстояние между соседними по широте центрами ячеек)
/// </summary>
public
double
w
idth
;
public
double
W
idth
;
/// <summary>
/// высота ячейки (расстояние между соседними по долготе центрами ячеек)
/// </summary>
public
double
h
eight
;
public
double
H
eight
;
/// <summary>
/// designated constructor
/// </summary>
...
...
@@ -215,8 +226,8 @@ namespace WindStressPRM
/// <param name="hgh">Cell Height</param>
public
CellSize
(
double
wdh
,
double
hgh
)
{
this
.
w
idth
=
wdh
;
this
.
h
eight
=
hgh
;
this
.
W
idth
=
wdh
;
this
.
H
eight
=
hgh
;
if
(!(
this
.
CheckValue
()))
{
throw
new
System
.
ArgumentException
(
"Cell width or height values are incorrect!"
);
...
...
@@ -229,7 +240,10 @@ namespace WindStressPRM
public
bool
CheckValue
()
{
bool
checker
=
true
;
if
(
width
>
0
&&
height
>
0
)
{
checker
=
true
;
}
if
(
Width
>
0
&&
Height
>
0
)
{
checker
=
true
;
}
else
{
checker
=
false
;
}
return
checker
;
}
...
...
@@ -244,47 +258,47 @@ namespace WindStressPRM
/// unique id
/// уникальный идентификатор
/// </summary>
public
int
i
dentifier
{
get
;
set
;
}
public
int
I
dentifier
{
get
;
set
;
}
/// <summary>
/// year of construction
/// год постройки ЛЭП
/// </summary>
public
int
y
ear
;
public
int
Y
ear
;
/// <summary>
/// average height of cable span between two poles, meters
/// средняя высота пролета, м
/// </summary>
public
double
h
eight
;
public
double
H
eight
;
/// <summary>
/// power kW for switches
/// Мощность ЛЭП, кВт
/// </summary>
public
int
p
ower
;
public
int
P
ower
;
/// <summary>
/// Line vertices coordinate list
/// список координат вершин ЛЭП как линейного объекта
/// </summary>
public
List
<
Coordinate
>
c
oords
{
get
;
set
;
}
public
List
<
Coordinate
>
C
oord
inate
s
{
get
;
set
;
}
/// <summary>
/// assigned powerstation/pole
/// идентификатор соответсвующего конца/начала линии (столб, трансформаторная подстанция, понижающая подстанция)
/// </summary>
public
int
p
ointFromID
;
public
int
P
ointFromID
;
/// <summary>
/// assigned powerstation/pole
/// идентификатор соответсвующего конца/начала линии (столб, трансформаторная подстанция, понижающая подстанция)
/// </summary>
public
int
p
ointToID
;
public
int
P
ointToID
;
/// <summary>
/// broken/not broken switch
/// сломана (true) или нет (false) линяя
/// </summary>
public
bool
isb
roken
;
public
bool
IsB
roken
;
/// <summary>
/// power on switch
/// получает (true) или нет (false) линия питание
/// </summary>
public
bool
ison
;
public
bool
IsON
;
private
int
MissingIdValue
=
-
1
;
public
Powerline
()
{
...
...
@@ -304,17 +318,19 @@ namespace WindStressPRM
/// <param name="fromID"></param>
public
Powerline
(
List
<
Coordinate
>
coordinates
,
int
id
,
int
year
,
double
height
,
int
power
,
int
toID
,
int
fromID
)
{
this
.
c
oords
=
coordinates
;
this
.
i
dentifier
=
id
;
this
.
y
ear
=
year
;
this
.
h
eight
=
height
;
this
.
p
ower
=
power
;
this
.
isb
roken
=
false
;
this
.
ison
=
false
;
this
.
p
ointFromID
=
fromID
;
this
.
p
ointToID
=
toID
;
this
.
C
oord
inate
s
=
coordinates
;
this
.
I
dentifier
=
id
;
this
.
Y
ear
=
year
;
this
.
H
eight
=
height
;
this
.
P
ower
=
power
;
this
.
IsB
roken
=
false
;
this
.
IsON
=
false
;
this
.
P
ointFromID
=
fromID
;
this
.
P
ointToID
=
toID
;
if
(!(
this
.
CheckValue
()))
{
throw
new
System
.
ArgumentException
(
"Powerline object wasn't initialized correctly"
);
}
{
throw
new
System
.
ArgumentException
(
"Powerline object wasn't initialized correctly"
);
}
}
/// <summary>
/// проверка валидности полей
...
...
@@ -323,8 +339,10 @@ namespace WindStressPRM
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
;
}
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
;
}
...
...
@@ -339,45 +357,48 @@ namespace WindStressPRM
/// unique id
/// уникальный идентификатор подстанции/столба
/// </summary>
public
int
i
dentifier
;
public
int
I
dentifier
;
/// <summary>
/// Coordinates
/// </summary>
public
Coordinate
c
oord
s
;
public
Coordinate
C
oord
inate
;
/// <summary>
/// station name field
/// название подстанции
/// </summary>
public
string
n
ame
;
public
string
N
ame
;
/// <summary>
/// power, kW
/// мощность, кВт
/// </summary>
public
int
p
ower
;
public
int
P
ower
;
/// <summary>
/// type of point - trans/pole/endpoint
/// тип станции - трансформаторная подстанция/столб/понижающая(конечная)подстанция
/// </summary>
public
enum
stationtype
{
pole
,
trans
,
endstat
};
public
enum
StationType
{
Pole
,
Trans
,
Endstat
};
/// <summary>
/// тип подстанции
/// </summary>
public
s
tation
t
ype
type
;
public
S
tation
T
ype
Station
type
;
/// <summary>
/// is point a source?
/// является ли подстаниция источником питания (в случае ТЭЦ или питания от внешних для рассматриваемой цепи ЛЭП)
/// </summary>
public
bool
iss
ource
;
public
bool
IsS
ource
;
/// <summary>
/// power on switch
/// поступает (true) или нет (false) на подстанцию питание
/// </summary>
public
bool
ison
;
public
bool
IsON
;
/// <summary>
/// asigned powerlines list
/// список оканчивающихся/начинающихся на подстанции ЛЭП
/// </summary>
public
List
<
Powerline
>
l
ine
l
ist
;
public
List
<
Powerline
>
L
ine
L
ist
;
public
PowerStation
()
{
//default constructor
...
...
@@ -392,21 +413,23 @@ namespace WindStressPRM
/// <param name="sttype"></param>
/// <param name="issource"></param>
/// <param name="ison"></param>
public
PowerStation
(
Coordinate
crds
,
int
id
,
string
stname
,
int
stpower
,
s
tation
t
ype
sttype
,
bool
issource
)
public
PowerStation
(
Coordinate
crds
,
int
id
,
string
stname
,
int
stpower
,
S
tation
T
ype
sttype
,
bool
issource
)
{
this
.
c
oord
s
=
crds
;
this
.
i
dentifier
=
id
;
this
.
n
ame
=
stname
;
this
.
p
ower
=
stpower
;
this
.
type
=
sttype
;
this
.
iss
ource
=
issource
;
this
.
ison
=
false
;
this
.
C
oord
inate
=
crds
;
this
.
I
dentifier
=
id
;
this
.
N
ame
=
stname
;
this
.
P
ower
=
stpower
;
this
.
Station
type
=
sttype
;
this
.
IsS
ource
=
issource
;
this
.
IsON
=
false
;
}
public
bool
CheckValue
()
{
bool
checker
=
true
;
if
(
identifier
>=
0
&&
power
>
0
&&
power
<
1000
)
{
checker
=
true
;
}
if
(
Identifier
>=
0
&&
Power
>
0
&&
Power
<
1000
)
{
checker
=
true
;
}
else
{
checker
=
false
;
}
return
checker
;
...
...
@@ -430,55 +453,67 @@ namespace WindStressPRM
/// prognistic raster info
/// массив прогностического ветра
/// </summary>
public
List
<
List
<
PrognosticCell
>>
p
rognosticCells
{
get
;
set
;}
public
List
<
List
<
PrognosticCell
>>
P
rognosticCells
{
get
;
set
;
}
/// <summary>
/// prognostic raster cell info
/// параметры ячеек регулярной сетки прогностического ветра
/// </summary>
public
CellSize
p
rognosticCellSize
{
get
;
set
;
}
public
CellSize
P
rognosticCellSize
{
get
;
set
;
}
/// <summary>
/// affine coefficients from prognostic raster projections
/// коэффициенты аффиного проеобразования из проекции массива прогностического ветра
/// </summary>
public
double
[]
p
rognosticAffineCoefficients
{
get
;
set
;
}
public
double
[]
P
rognosticAffineCoefficients
{
get
;
set
;
}
/// <summary>
/// climate raster array
/// массив климатических полей скорости ветра заданной повторяемости
/// </summary>
public
List
<
List
<
ClimateCell
>>
c
limateCells
{
get
;
set
;
}
public
List
<
List
<
ClimateCell
>>
C
limateCells
{
get
;
set
;
}
/// <summary>
/// climate raster cell info
/// параметры ячеек регулярной сетки климатических полей скорости ветра заданной повторяемости
/// </summary>
public
CellSize
c
limateCellSize
{
get
;
set
;
}
public
CellSize
C
limateCellSize
{
get
;
set
;
}
/// <summary>
/// affine coefficients from climate raster projection
/// коэффициенты аффинного преобразования из проекции массива климатических полей скорости ветра заданной повторяемости
/// </summary>
public
double
[]
c
limateAffineCoefficients
{
get
;
set
;
}
public
double
[]
C
limateAffineCoefficients
{
get
;
set
;
}
/// <summary>
/// lines list
/// список ЛЭП
/// </summary>
public
List
<
Powerline
>
p
owerLines
{
get
;
set
;
}
public
List
<
Powerline
>
P
owerLines
{
get
;
set
;
}
/// <summary>
/// stations/poles list
/// список точечных объектов - трансформаторных подстанций/столбов/понижающих(конечных) подстанций
/// </summary>
public
List
<
PowerStation
>
p
owerStations
{
get
;
set
;
}
public
List
<
PowerStation
>
P
owerStations
{
get
;
set
;
}
/// <summary>
/// maximum distance for line segment, meters
/// максимальное расстояние между точками ЛЭП, для которых проверяется сломаются/несломаются под действием ветра
/// </summary>
public
double
d
ist
_t
hreshold
public
double
D
ist
T
hreshold
{
get
{
return
500
;
}
}
/// <summary>
/// missing raster value for cells, if you haven't normal value use this one.
/// потерянное значение для растрового объекта; Если Вы не имеете данных - используйте это значение
/// </summary>
public
double
kMissingRasterValue
{
get
{
return
-
9999
;
}
}
}
/// <summary>
/// Output
...
...
@@ -489,12 +524,12 @@ namespace WindStressPRM
/// stations list without power
/// Список подстанций на которые не поступит питание в результате предсказанных поломок ЛЭП в сети
/// </summary>
public
List
<
PowerStation
>
d
isabledStations
{
get
;
set
;
}
public
List
<
PowerStation
>
D
isabledStations
{
get
;
set
;
}
/// <summary>
/// broken lines list
/// Список прогнозируемых сломанных ЛЭП в результате ветрового воздействия
/// </summary>
public
List
<
Powerline
>
d
isabledLines
{
get
;
set
;
}
public
List
<
Powerline
>
D
isabledLines
{
get
;
set
;
}
}
/// <summary>
/// main calculations class
...
...
@@ -504,7 +539,7 @@ namespace WindStressPRM
/// <summary>
/// Input Data
/// </summary>
private
Input
i
nput
;
private
Input
I
nput
;
/// <summary>
/// Main function for power graph algorithm
...
...
@@ -512,36 +547,36 @@ namespace WindStressPRM
/// </summary>
public
Output
CheckPower
(
Input
input
)
{
this
.
i
nput
=
input
;
this
.
I
nput
=
input
;
//Calculate which lines are broken
List
<
WindStressPRM
.
Powerline
>
prmBrokenLines
=
brokenPowerLinesAfterCheck
();
//get the graph
PreparingPowerItems
();
//start from source points
foreach
(
PowerStation
pwstation
in
input
.
p
owerStations
)
foreach
(
PowerStation
pwstation
in
input
.
P
owerStations
)
{
if
(
pwstation
.
iss
ource
)
if
(
pwstation
.
IsS
ource
)
{
CheckPowerPointsForStation
(
pwstation
);
}
}
//fill output
Output
output
=
new
Output
();
output
.
d
isabledStations
=
new
List
<
PowerStation
>();
output
.
d
isabledLines
=
new
List
<
Powerline
>();
foreach
(
Powerline
line
in
input
.
p
owerLines
)
output
.
D
isabledStations
=
new
List
<
PowerStation
>();
output
.
D
isabledLines
=
new
List
<
Powerline
>();
foreach
(
Powerline
line
in
input
.
P
owerLines
)
{
if
(
line
.
isb
roken
)
if
(
line
.
IsB
roken
)
{
output
.
d
isabledLines
.
Add
(
line
);
output
.
D
isabledLines
.
Add
(
line
);
}
}
foreach
(
PowerStation
powerStation
in
input
.
p
owerStations
)
foreach
(
PowerStation
powerStation
in
input
.
P
owerStations
)
{
//stations of type pole can be disabled if the line is broken
if
(!
powerStation
.
ison
&&
!(
powerStation
.
type
==
PowerStation
.
s
tation
t
ype
.
p
ole
))
if
(!
powerStation
.
IsON
&&
!(
powerStation
.
Station
type
==
PowerStation
.
S
tation
T
ype
.
P
ole
))
{
output
.
d
isabledStations
.
Add
(
powerStation
);
output
.
D
isabledStations
.
Add
(
powerStation
);
}
}
return
output
;
...
...
@@ -552,39 +587,39 @@ namespace WindStressPRM
/// <param name="sourcepoint"> powered station to search next powered station from</param>
private
void
CheckPowerPointsForStation
(
PowerStation
sourcepoint
)
{
if
(!
sourcepoint
.
ison
)
if
(!
sourcepoint
.
IsON
)
{
throw
new
Exception
(
"CheckPowerPointsForStation is called from disabled sourcepoint"
);
}
// if the point is not a pole - i.e. we know
// it can redistribute power within connected lines
// we turn it ON if any of the connected lines are powered
foreach
(
Powerline
line
in
sourcepoint
.
l
ine
l
ist
)
foreach
(
Powerline
line
in
sourcepoint
.
L
ine
L
ist
)
{
if
(!
line
.
isb
roken
&&
!
line
.
ison
)
if
(!
line
.
IsB
roken
&&
!
line
.
IsON
)
{
line
.
ison
=
true
;
foreach
(
PowerStation
powerStation
in
i
nput
.
p
owerStations
)
line
.
IsON
=
true
;
foreach
(
PowerStation
powerStation
in
I
nput
.
P
owerStations
)
{
if
(
powerStation
.
i
dentifier
!=
sourcepoint
.
i
dentifier
&&
(
powerStation
.
i
dentifier
==
line
.
p
ointFromID
||
powerStation
.
i
dentifier
==
line
.
p
ointToID
))
if
(
powerStation
.
I
dentifier
!=
sourcepoint
.
I
dentifier
&&
(
powerStation
.
I
dentifier
==
line
.
P
ointFromID
||
powerStation
.
I
dentifier
==
line
.
P
ointToID
))
{
if
(!(
sourcepoint
.
type
==
PowerStation
.
s
tation
t
ype
.
p
ole
))
{
powerStation
.
ison
=
true
;
if
(!(
sourcepoint
.
Station
type
==
PowerStation
.
S
tation
T
ype
.
P
ole
))
{
powerStation
.
IsON
=
true
;
CheckPowerPointsForStation
(
powerStation
);
}
else
{
// if line is a pole we have to check if it's actually able to
// get electricity to other points i.e. no connected lines are broken
bool
powerLineCheck
=
false
;
foreach
(
Powerline
powerline
in
powerStation
.
l
ine
l
ist
)
foreach
(
Powerline
powerline
in
powerStation
.
L
ine
L
ist
)
{
if
(
powerline
.
isb
roken
)
{
if
(
powerline
.
IsB
roken
)
{
powerLineCheck
=
true
;
}
}
if
(!
powerLineCheck
)
{
powerStation
.
ison
=
true
;
powerStation
.
IsON
=
true
;
CheckPowerPointsForStation
(
powerStation
);
}
}
...
...
@@ -602,26 +637,26 @@ namespace WindStressPRM
{
//First we make sure that all the sources are ON
//and all non sources are OFF
foreach
(
PowerStation
powerStation
in
i
nput
.
p
owerStations
)
foreach
(
PowerStation
powerStation
in
I
nput
.
P
owerStations
)
{
if
(
powerStation
.
iss
ource
==
true
)
{
powerStation
.
ison
=
true
;
if
(
powerStation
.
IsS
ource
==
true
)
{
powerStation
.
IsON
=
true
;
}
else
{
powerStation
.
ison
=
false
;
powerStation
.
IsON
=
false
;
}
// for each power station we create a list of powerlines it is attached to
List
<
Powerline
>
lines
=
new
List
<
Powerline
>();
foreach
(
Powerline
line
in
i
nput
.
p
owerLines
)
foreach
(
Powerline
line
in
I
nput
.
P
owerLines
)
{
//we also switch OFF all lines
line
.
ison
=
false
;
if
(
line
.
p
ointFromID
==
powerStation
.
i
dentifier
||
line
.
p
ointToID
==
powerStation
.
i
dentifier
)
{
line
.
IsON
=
false
;
if
(
line
.
P
ointFromID
==
powerStation
.
I
dentifier
||
line
.
P
ointToID
==
powerStation
.
I
dentifier
)
{
lines
.
Add
(
line
);
}
}
powerStation
.
l
ine
l
ist
=
lines
;
powerStation
.
L
ine
L
ist
=
lines
;
}
}
/// <summary>
...
...
@@ -632,10 +667,10 @@ namespace WindStressPRM
{
List
<
Powerline
>
brokenLines
=
new
List
<
Powerline
>();
// actually there are curves in powerLines
foreach
(
Powerline
powerCurve
in
i
nput
.
p
owerLines
)
foreach
(
Powerline
powerCurve
in
I
nput
.
P
owerLines
)
{
// get coordinates list
List
<
Coordinate
>
points
=
powerCurve
.
c
oords
;
List
<
Coordinate
>
points
=
powerCurve
.
C
oord
inate
s
;
List
<
bool
>
checkList
=
new
List
<
bool
>();
// cycle throw all points in line
...
...
@@ -645,17 +680,17 @@ namespace WindStressPRM
double
y1
=
points
[
i
-
1
].
Y
;
double
x2
=
points
[
i
].
X
;
double
y2
=
points
[
i
].
Y
;
bool
result
=
linearLineIsBroken
(
points
[
i
-
1
],
points
[
i
],
powerCurve
.
h
eight
,
powerCurve
.
p
ower
);
bool
result
=
linearLineIsBroken
(
points
[
i
-
1
],
points
[
i
],
powerCurve
.
H
eight
,
powerCurve
.
P
ower
);
checkList
.
Add
(
result
);
}
foreach
(
bool
chkpnt
in
checkList
)
{
if
(
chkpnt
==
true
)
{
powerCurve
.
isb
roken
=
true
;
powerCurve
.
IsB
roken
=
true
;
}
}
if
(
powerCurve
.
isb
roken
)
if
(
powerCurve
.
IsB
roken
)
{
brokenLines
.
Add
(
powerCurve
);
}
...
...
@@ -677,7 +712,7 @@ namespace WindStressPRM
private
bool
linearLineIsBroken
(
Coordinate
coord1
,
Coordinate
coord2
,
double
heightLine
,
int
power
)
{
double
distance
=
Math
.
Sqrt
((
coord2
.
X
-
coord1
.
X
)
*
(
coord2
.
X
-
coord1
.
X
)
+
(
coord2
.
Y
-
coord1
.
Y
)
*
(
coord2
.
Y
-
coord1
.
Y
));
double
distpropD
=
distance
/
i
nput
.
d
ist
_t
hreshold
;
double
distpropD
=
distance
/
I
nput
.
D
ist
T
hreshold
;
List
<
Coordinate
>
pointlist
=
new
List
<
Coordinate
>();
Coordinate
midpoint
=
new
Coordinate
(
0
,
0
);
int
distpropI
=
Convert
.
ToInt32
(
distpropD
);
...
...
@@ -778,13 +813,13 @@ namespace WindStressPRM
case
FunctionType
.
FunctionVelocityX
:
case
FunctionType
.
FunctionVelocityY
:
{
return
i
nput
.
p
rognosticAffineCoefficients
;
return
I
nput
.
P
rognosticAffineCoefficients
;
}
case
FunctionType
.
FunctionClimate5
:
case
FunctionType
.
FunctionClimate10
:
case
FunctionType
.
FunctionClimate15
:
{
return
i
nput
.
c
limateAffineCoefficients
;
return
I
nput
.
C
limateAffineCoefficients
;
}
default
:
break
;
...
...
@@ -834,13 +869,13 @@ namespace WindStressPRM
case
FunctionType
.
FunctionVelocityX
:
case
FunctionType
.
FunctionVelocityY
:
{
return
i
nput
.
p
rognosticCells
[
index
.
Row
][
index
.
Col
].
c
oord
s
;
return
I
nput
.
P
rognosticCells
[
index
.
Row
][
index
.
Col
].
C
oord
inate
;
}
case
FunctionType
.
FunctionClimate5
:
case
FunctionType
.
FunctionClimate10
:
case
FunctionType
.
FunctionClimate15
:
{
return
i
nput
.
c
limateCells
[
index
.
Row
][
index
.
Col
].
c
oord
s
;
return
I
nput
.
C
limateCells
[
index
.
Row
][
index
.
Col
].
C
oord
inate
;
}
default
:
break
;
...
...
@@ -855,13 +890,13 @@ namespace WindStressPRM
case
FunctionType
.
FunctionVelocityX
:
case
FunctionType
.
FunctionVelocityY
:
{
return
forRows
?
i
nput
.
p
rognosticCells
.
Count
:
i
nput
.
p
rognosticCells
[
0
].
Count
;
return
forRows
?
I
nput
.
P
rognosticCells
.
Count
:
I
nput
.
P
rognosticCells
[
0
].
Count
;
}
case
FunctionType
.
FunctionClimate5
:
case
FunctionType
.
FunctionClimate10
:
case
FunctionType
.
FunctionClimate15
:
{
return
forRows
?
i
nput
.
c
limateCells
.
Count
:
i
nput
.
c
limateCells
[
0
].
Count
;
return
forRows
?
I
nput
.
C
limateCells
.
Count
:
I
nput
.
C
limateCells
[
0
].
Count
;
}
default
:
break
;
...
...
@@ -875,23 +910,23 @@ namespace WindStressPRM
{
case
FunctionType
.
FunctionVelocityX
:
{
return
i
nput
.
p
rognosticCells
[
index
.
Row
][
index
.
Col
].
v
elocityX
;
return
I
nput
.
P
rognosticCells
[
index
.
Row
][
index
.
Col
].
V
elocityX
;
}
case
FunctionType
.
FunctionVelocityY
:
{
return
i
nput
.
p
rognosticCells
[
index
.
Row
][
index
.
Col
].
v
elocityY
;
return
I
nput
.
P
rognosticCells
[
index
.
Row
][
index
.
Col
].
V
elocityY
;
}
case
FunctionType
.
FunctionClimate5
:
{
return
i
nput
.
c
limateCells
[
index
.
Row
][
index
.
Col
].
w
ind5
;
return
I
nput
.
C
limateCells
[
index
.
Row
][
index
.
Col
].
W
ind5
;
}
case
FunctionType
.
FunctionClimate10
:
{
return
i
nput
.
c
limateCells
[
index
.
Row
][
index
.
Col
].
w
ind10
;
return
I
nput
.
C
limateCells
[
index
.
Row
][
index
.
Col
].
W
ind10
;
}
case
FunctionType
.
FunctionClimate15
:
{
return
i
nput
.
c
limateCells
[
index
.
Row
][
index
.
Col
].
w
ind15
;
return
I
nput
.
C
limateCells
[
index
.
Row
][
index
.
Col
].
W
ind15
;
}
default
:
break
;
...
...
@@ -906,13 +941,13 @@ namespace WindStressPRM
case
FunctionType
.
FunctionVelocityX
:
case
FunctionType
.
FunctionVelocityY
:
{
return
i
nput
.
p
rognosticCellSize
;
return
I
nput
.
P
rognosticCellSize
;
}
case
FunctionType
.
FunctionClimate5
:
case
FunctionType
.
FunctionClimate10
:
case
FunctionType
.
FunctionClimate15
:
{
return
i
nput
.
c
limateCellSize
;
return
I
nput
.
C
limateCellSize
;
}
default
:
break
;
...
...
@@ -957,10 +992,63 @@ namespace WindStressPRM
double
valTopLeft
=
valueForFunction
(
functionType
,
rcTopLeft
);
double
valTopRight
=
valueForFunction
(
functionType
,
rcTopRight
);
Coordinate
origin
=
cellToProjection
(
rcBotLeft
,
functionType
);
//PRM_coordinate last = cellToProjection(rcTopRight, functionType);//test only
bool
testBotLeft
=
valBotLeft
==
Input
.
kMissingRasterValue
;
bool
testBotRight
=
valBotRight
==
Input
.
kMissingRasterValue
;
bool
testTopLeft
=
valTopLeft
==
Input
.
kMissingRasterValue
;
bool
testTopRight
=
valTopRight
==
Input
.
kMissingRasterValue
;
if
(
testBotLeft
||
testBotRight
||
testTopLeft
||
testTopRight
)
{
// tests indicates that value at test-cell is missed.
if
(
testTopRight
&&
testTopLeft
&&
testBotLeft
&&
testBotRight
)
{
throw
new
Exception
(
"Current value in such a bad place, you need to fill these place with raster values"
);
}
int
count
=
0
;
if
(
testBotLeft
)
{
valBotLeft
=
0
;
count
++;
}
if
(
testBotRight
)
{
valBotRight
=
0
;
count
++;
}
if
(
testTopLeft
)
{
valTopLeft
=
0
;
count
++;
}
if
(
testTopRight
)
{
valTopRight
=
0
;
count
++;
}
//of course there is count not 0;
if
(
count
==
0
)
{
throw
new
Exception
(
"Interpolation Logic Error"
);
}
double
average
=
(
valTopLeft
+
valTopRight
+
valBotLeft
+
valBotRight
)/
count
;
if
(
testBotLeft
)
{
valBotLeft
=
average
;
}
if
(
testBotRight
)
{
valBotRight
=
average
;
}
if
(
testTopLeft
)
{
valTopLeft
=
average
;
}
if
(
testTopRight
)
{
valTopRight
=
average
;
}
}
// sizes for cell
double
hx
=
cellSizeForFunction
(
functionType
).
w
idth
;
double
hy
=
cellSizeForFunction
(
functionType
).
h
eight
;
double
hx
=
cellSizeForFunction
(
functionType
).
W
idth
;
double
hy
=
cellSizeForFunction
(
functionType
).
H
eight
;
// coefficients
double
px
=
(
coords
.
X
-
origin
.
X
)
/
hx
;
double
py
=
(
coords
.
Y
-
origin
.
Y
)
/
hy
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment