Power System Platform  2026w34a-beta
Loading...
Searching...
No Matches
PowerElement.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 POWERELEMENT_H
19#define POWERELEMENT_H
20
21#include "../Element.h"
22#include "../../utils/ElementPlotData.h"
23
37
42enum class SwitchingType : int {
43 SW_INSERT = 0,
45};
46
58
59enum class PlotStudy : int {
60 STABILITY = 0,
62};
63
72 std::vector<SwitchingType> swType;
73 std::vector<double> swTime;
74};
75
84 double c;
85 double m;
86};
87
95class PowerElement : public Element
96{
97 public:
101 PowerElement();
105 virtual ~PowerElement() {}
106
113 virtual wxPoint2DDouble GetSwitchPoint(Element* parent,
114 wxPoint2DDouble parentPoint,
115 wxPoint2DDouble secondPoint) const;
116
121 virtual bool SwitchesContains(wxPoint2DDouble position) const;
122
126 virtual void UpdateSwitches();
127 virtual void UpdateSwitchesPosition() {}
128 virtual void UpdatePowerFlowArrowsPosition() {}
129
133 //virtual void DrawSwitches() const;
134
138 virtual void DrawDCSwitches(GUIColour* guiColour, wxGraphicsContext* gc) const;
139
140 virtual void DrawDCSwitches(GUIColour* guiColour, wxDC& dc) const;
141
146 virtual void CalculatePowerFlowPts(std::vector<wxPoint2DDouble> edges);
147
151 //virtual void DrawPowerFlowPts() const;
152
157 virtual void DrawDCPowerFlowPts(GUIColour* guiColour, wxGraphicsContext* gc) const;
158
159 virtual void DrawDCPowerFlowPts(GUIColour* guiColour, wxDC& dc) const;
160
166 virtual void SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit);
167
172 virtual void SetSwitchingData(SwitchingData data) { m_swData = data; }
177 virtual SwitchingData GetSwitchingData() { return m_swData; }
182 virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection) { m_pfDirection = pfDirection; }
187 virtual PowerFlowDirection GetPowerFlowDirection() const { return m_pfDirection; }
193 virtual bool GetPlotData(ElementPlotData& plotData, PlotStudy study = PlotStudy::STABILITY) { return false; }
198 virtual bool HaveDynamicEvent() const { return m_dynEvent; }
203 virtual void SetDynamicEvent(bool dynEvent = true) { m_dynEvent = dynEvent; }
204 virtual double GetValueFromUnit(double value, ElectricalUnit valueUnit) const;
205
206 virtual void SaveCADProperties(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* elementNode);
207 virtual void SaveSwitchingData(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* electricalNode);
208 virtual bool OpenElement(rapidxml::xml_node<>* elementNode, std::vector<Element*> parentList) { return true; }
209 virtual bool OpenCADProperties(rapidxml::xml_node<>* elementNode, std::vector<Element*> parentList);
210 virtual bool OpenSwitchingData(rapidxml::xml_node<>* electricalNode);
211
212 protected:
213 SwitchingData m_swData;
214 std::vector<std::vector<wxPoint2DDouble> > m_powerFlowArrow;
216
217 wxColour m_busColour;
218 wxColour m_onlineElementColour;
219 wxColour m_offlineElementColour;
220 wxColour m_closedSwitchColour;
221 wxColour m_openedSwitchColour;
222 wxColour m_powerFlowArrowColour;
223 wxColour m_dynamicEventColour;
224
225 bool m_dynEvent = false;
226};
227
228#endif // POWERELEMENT_H
FaultData
Information about fault (type and location).
@ FAULT_LINE_GROUND
@ FAULT_2LINE_GROUND
@ FAULT_THREEPHASE
PowerFlowDirection
Direction of power flow arrows.
PlotStudy
SwitchingType
Type of switching.
Base class of all elements of the program. This class is responsible for manage graphical and his dat...
Definition Element.h:115
Abstract class of power elements.
virtual void SetNominalVoltage(std::vector< double > nominalVoltage, std::vector< ElectricalUnit > nominalVoltageUnit)
Set nominal voltage of the element.
virtual void SetSwitchingData(SwitchingData data)
Set the switching data of the element.
virtual bool GetPlotData(ElementPlotData &plotData, PlotStudy study=PlotStudy::STABILITY)
Fill the plot data.
virtual ~PowerElement()
Destructor.
virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection)
Set the direction of the power flow.
PowerElement()
Constructor.
virtual void SetDynamicEvent(bool dynEvent=true)
Set if the power element have dynamic event.
virtual void CalculatePowerFlowPts(std::vector< wxPoint2DDouble > edges)
Calculate the points of the power flow arrows.
virtual bool SwitchesContains(wxPoint2DDouble position) const
Check if switch contains position.
virtual PowerFlowDirection GetPowerFlowDirection() const
Return the direction of the power flow.
virtual void DrawDCPowerFlowPts(GUIColour *guiColour, wxGraphicsContext *gc) const
Draw power flow arrows.
virtual SwitchingData GetSwitchingData()
Returns the switching data of the element.
virtual void UpdateSwitches()
Update the switch position.
virtual void DrawDCSwitches(GUIColour *guiColour, wxGraphicsContext *gc) const
Draw switch.
virtual wxPoint2DDouble GetSwitchPoint(Element *parent, wxPoint2DDouble parentPoint, wxPoint2DDouble secondPoint) const
Get the correct switch position.
virtual bool HaveDynamicEvent() const
Check if the power element have dynamic event.
Integration constants to calculate dynamic elements through trapezoidal integration method.
Switching data of power elements.
std::vector< double > swTime
std::vector< SwitchingType > swType