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> /// 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> /// 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; } /// <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; } } }