Newer
Older
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WindStressPRM
{
/// <summary>
/// powerstation/pole point class
/// класс для трансформаторных подстанций/столбов/понижающих(конечных) подстанций
/// </summary>
public class PowerStation
{
/// <summary>
/// unique id
/// уникальный идентификатор подстанции/столба
/// </summary>
public int Identifier { get; set; }
/// <summary>
/// Coordinates
/// </summary>
public Coordinate Coordinate { get; set; }
/// <summary>
/// station name field
/// название подстанции
/// </summary>
public string Name { get; set; }
/// <summary>

Debolskiy Andrey
committed
/// power, kV
/// напряжение, кВ
/// </summary>
public int Power { get; set; }
/// <summary>
/// type of point - trans/pole/endpoint
/// тип станции - трансформаторная подстанция/столб/понижающая(конечная)подстанция
///столбы не идут в аутпут, и обрабатываються алгоритмом, так что если есть на куске графа, саязанного только столбами есть сломанный сегмент
/// весб кусок графа обесточен
/// </summary>
public enum StationType
{
Pole, Trans, Endstat
};
/// <summary>
/// тип подстанции
/// </summary>
public StationType Stationtype { get; set; }
/// <summary>
/// is point a source?
/// является ли подстаниция источником питания (в случае ТЭЦ или питания от внешних для рассматриваемой цепи ЛЭП)
/// </summary>
public bool IsSource { get; set; }
/// <summary>
/// power on switch
/// поступает (true) или нет (false) на подстанцию питание
/// </summary>
public bool IsON { get; set; }
/// <summary>

Debolskiy Andrey
committed
/// parameter to control that on this station feeding line has higher power/voltage then leeching lines
/// параметр для контроля в алгоритме, чтобы линии питались от линий такого же или более высокого класса напряжения
/// </summary>
public int CurrentVolt { get; private set; }
/// <summary>
/// asigned powerlines list
/// список оканчивающихся/начинающихся на подстанции ЛЭП
/// </summary>
public IList<Powerline> LineList { get; set; }
public PowerStation()
{
//default constructor
}
/// <summary>
/// designated constructor
/// </summary>
/// <param name="crds"></param>
/// <param name="id"></param>
/// <param name="stname"></param>
/// <param name="stpower"></param>
/// <param name="sttype"></param>
/// <param name="issource"></param>
/// <param name="ison"></param>
public PowerStation(Coordinate crds, int id, string stname, int stpower, StationType sttype, bool issource)
{
this.Coordinate = crds;
this.Identifier = id;
this.Name = stname;
this.Power = stpower;
this.Stationtype = sttype;
this.IsSource = issource;
this.IsON = false;
}
public bool CheckValue()
{
bool checker = Identifier >= 0 && Power > 0 && Power < 1000;
return checker;
}

Debolskiy Andrey
committed
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/// <summary>
/// Gets attached lines list
/// </summary>
/// <param name="linenet"></param>
public void GetAttachedLines( List<Powerline> linenet)
{
this.LineList= new List<Powerline>();
foreach(Powerline line in linenet)
{
if ( line.PointFromID == this.Identifier || line.PointToID == this.Identifier)
{
this.LineList.Add(line);
}
}
return;
}
/// <summary>
/// initializes CurrentVolt parameter
/// </summary>
public void InitCurrentVolt()
{
int maxVolt =-1;
int minVolt =10000;
foreach (Powerline line in this.LineList)
{
if (line.Voltage > maxVolt) { maxVolt = line.Voltage; }
if (line.Voltage < minVolt) { minVolt = line.Voltage; }
}
if (this.IsSource)
{
// initial sourcepoints need to get highest attached voltage assigned to be able to power all attached lines
this.CurrentVolt = maxVolt;
}
else
{
// every other point gets the minimum
this.CurrentVolt = minVolt;
}
//the code above would work when the power network will be consistent
//for we have to use this
this.CurrentVolt = maxVolt;
return;
}
/// <summary>
/// Sets CurrentVolt parameter based on the highest voltage of lines powering it
/// </summary>
public void SetCurrentVolt()
{
foreach (Powerline line in this.LineList)
{
if (line.IsON && line.Voltage > this.CurrentVolt) { this.CurrentVolt = line.Voltage; }
}
return;
}
public void TurnOffAttachedLines()
{
foreach(Powerline line in this.LineList) { line.IsON = false; }
return;
}