Power System Platform  2026w10a-beta
Loading...
Searching...
No Matches
Line.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#ifndef LINE_H
19#define LINE_H
20
21#include "../../forms/LineForm.h"
22#include "Branch.h"
23
25 // General
26 wxString name = "";
27 double nominalVoltage = 138.0;
28 ElectricalUnit nominalVoltageUnit = ElectricalUnit::UNIT_kV;
29 double nominalPower = 100.0;
31 double resistance = 0.0;
33 double indReactance = 1.0;
34 ElectricalUnit indReactanceUnit = ElectricalUnit::UNIT_PU;
35 double capSusceptance = 0.0;
36 ElectricalUnit capSusceptanceUnit = ElectricalUnit::UNIT_PU;
37 double lineSize = 100.0;
38 bool useLinePower = false;
39
40 // Power flow (p.u.)
41 std::complex<double> current[2] = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0)};
42 std::complex<double> powerFlow[2] = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0)};
43
44 // Fault
45 double zeroResistance = 0.0;
46 double zeroIndReactance = 1.0;
47 double zeroCapSusceptance = 0.0;
48 // p.u. fault data
49 std::complex<double> faultCurrent[2][3];
50
51 // Power Quality
52 std::vector<int> harmonicOrder;
53 std::vector< std::complex<double> > harmonicCurrent[2];
54};
55
63class Line : public Branch
64{
65 public:
66 Line();
67 Line(wxString name);
68 ~Line();
69 virtual bool Contains(wxPoint2DDouble position) const;
70 //virtual void Draw(wxPoint2DDouble translation, double scale) const;
71 virtual void DrawDC(wxPoint2DDouble translation, double scale, wxGraphicsContext* gc) const;
72 virtual void DrawDC(wxPoint2DDouble translation, double scale, wxDC& dc) const;
73 virtual void Move(wxPoint2DDouble position);
74 virtual void StartMove(wxPoint2DDouble position);
75 virtual void MoveNode(Element* parent, wxPoint2DDouble position);
76 virtual bool SetNodeParent(Element* parent);
77 virtual wxCursor GetBestPickboxCursor() const { return wxCURSOR_SIZING; }
78 virtual Element* GetCopy();
79 virtual bool AddParent(Element* parent, wxPoint2DDouble position);
80 virtual bool Intersects(wxRect2DDouble rect) const;
81 virtual void MovePickbox(wxPoint2DDouble position);
82 virtual bool PickboxContains(wxPoint2DDouble position);
83 virtual void AddPoint(wxPoint2DDouble point);
84 virtual bool GetContextMenu(wxMenu& menu);
85 virtual wxString GetTipText() const;
86 virtual void RemoveNode(wxPoint2DDouble point);
87 virtual void AddNode(wxPoint2DDouble point);
88 virtual void RotateNode(Element* parent, bool clockwise = true);
89 virtual void CalculateBoundaries(wxPoint2DDouble& leftUp, wxPoint2DDouble& rightBottom) const;
90 virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection);
91 virtual bool ShowForm(wxWindow* parent, Element* element);
92 virtual LineElectricalData GetElectricalData() const { return m_electricalData; }
93 virtual LineElectricalData GetPUElectricalData(double systemBasePower);
94 virtual void SetElectricalData(LineElectricalData electricalData) { m_electricalData = electricalData; }
95 virtual void SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit);
96 virtual void SetPointList(std::vector<wxPoint2DDouble> pointList);
97
98 virtual rapidxml::xml_node<>* SaveElement(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* elementListNode);
99 virtual bool OpenElement(rapidxml::xml_node<>* elementNode, std::vector<Element*> parentList);
100
101 protected:
102 void UpdatePowerFlowArrowsPosition();
103 LineElectricalData m_electricalData;
104};
105
106#endif // LINE_H
ElectricalUnit
Electrical units.
PowerFlowDirection
Direction of power flow arrows.
Abstract class for branch power elements.
Definition Branch.h:32
Base class of all elements of the program. This class is responsible for manage graphical and his dat...
Definition Element.h:112
Power line element.
Definition Line.h:64
virtual void AddPoint(wxPoint2DDouble point)
Add point to the list of points that connect the element to the bus.
Definition Line.cpp:372
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition Line.cpp:37
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element's rect intersects other rect.
Definition Line.cpp:341
virtual void SetNominalVoltage(std::vector< double > nominalVoltage, std::vector< ElectricalUnit > nominalVoltageUnit)
Set nominal voltage of the element.
Definition Line.cpp:530
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition Line.cpp:520
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus,...
Definition Line.cpp:275
virtual void DrawDC(wxPoint2DDouble translation, double scale, wxGraphicsContext *gc) const
Draw the element using GDI+.
Definition Line.cpp:107
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition Line.cpp:255
virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection)
Set the direction of the power flow.
Definition Line.cpp:621
virtual wxString GetTipText() const
Get the tip text.
Definition Line.cpp:675
virtual bool SetNodeParent(Element *parent)
Set a perent to the node. If all conditions are met, a new parent are added to the element and the po...
Definition Line.cpp:538
virtual wxCursor GetBestPickboxCursor() const
Get the best cursor to shown to the user when the mouse is above a pickbox.
Definition Line.h:77
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition Line.cpp:427
virtual void CalculateBoundaries(wxPoint2DDouble &leftUp, wxPoint2DDouble &rightBottom) const
Calculate the element boundaries.
Definition Line.cpp:505
virtual void RotateNode(Element *parent, bool clockwise=true)
Rotate a node.
Definition Line.cpp:646
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition Line.cpp:377
virtual void MoveNode(Element *parent, wxPoint2DDouble position)
Move a node. StartMove(wxPoint2DDouble position) before start moving.
Definition Line.cpp:383
virtual bool PickboxContains(wxPoint2DDouble position)
Check if a pickbox contains a point. If contains the attributes related to pickbox movement will be c...
Definition Line.cpp:360
virtual void SetPointList(std::vector< wxPoint2DDouble > pointList)
Set the list of points that connect the element to the bus.
Definition Line.cpp:661
virtual void MovePickbox(wxPoint2DDouble position)
Move the pickbox.
Definition Line.cpp:348
virtual Element * GetCopy()
Get a the element copy.
Definition Line.cpp:668