1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
#ifndef POWERELEMENT_H
#define POWERELEMENT_H
#include "Element.h"
#include "ElementPlotData.h"
/**
* @enum ElectricalUnit
* @brief Electrical units.
*/
enum ElectricalUnit {
UNIT_PU = 0, /**< Per unit (p.u.) */
UNIT_V, /**< Volt */
UNIT_kV, /**< Kilovolts */
UNIT_A, /**< Ampere */
UNIT_kA, /**< Kiloampere */
UNIT_W, /**< Watts */
UNIT_kW, /**< Kilowatts */
UNIT_MW, /**< Megawatts */
UNIT_VA, /**< Volt-ampere */
UNIT_kVA, /**< Kilovolt-ampere */
UNIT_MVA, /**< Megavolt-ampere */
UNIT_VAr, /**< Volt-ampere reactive */
UNIT_kVAr, /**< Kilovolt-ampere reactive */
UNIT_MVAr, /**< Megavolt-ampere reactive */
UNIT_OHM, /**< Ohm */
UNIT_OHM_km, /**< Ohm/km */
UNIT_S, /**< Siemens */
UNIT_S_km, /**< Siemens/km */
UNIT_DEGREE, /**< Degree */
UNIT_RADIAN /**< Radian */
};
/**
* @enum FaultData
* @brief Information about fault (type and location).
*/
enum FaultData {
FAULT_THREEPHASE = 0, /**< Three-phase fault */
FAULT_2LINE, /**< Line-to-line fault */
FAULT_2LINE_GROUND, /**< Double line-to-ground fault */
FAULT_LINE_GROUND, /**< Line-to-ground fault */
FAULT_LINE_A, /**< Fault on phase A or phase AB */
FAULT_LINE_B, /**< Fault on phase B or phase BC */
FAULT_LINE_C /**< Fault on phase C or phase CA */
};
/**
* @enum SwitchingType
* @brief Type of switching.
*/
enum SwitchingType {
SW_INSERT = 0, /**< Insert element */
SW_REMOVE /**< Remove element */
};
/**
* @enum PowerFlowDirection
* @brief Direction of power flow arrows.
*/
enum PowerFlowDirection {
PF_NONE = 0, /**< No direction (no arrows printed) */
PF_TO_BUS, /**< Element to bus */
PF_TO_ELEMENT, /**< Bus to element */
PF_BUS1_TO_BUS2, /**< First bus to secont bus (branch elements) */
PF_BUS2_TO_BUS1 /**< Second bus to first bus (branch elements) */
};
/**
* @class SwitchingData
* @author Thales Lima Oliveira
* @date 18/01/2017
* @file PowerElement.h
* @brief Switching data of power elements.
*/
struct SwitchingData {
std::vector<SwitchingType> swType; /**< Type of switching */
std::vector<double> swTime; /**< Time of switching */
};
/**
* @class IntegrationConstant
* @author Thales Lima Oliveira
* @date 24/05/2017
* @file PowerElement.h
* @brief Integration constants to calculate dynamic elements through trapezoidal integration method
*/
struct IntegrationConstant {
double c; /**< C value */
double m; /**< M value */
};
/**
* @class PowerElement
* @author Thales Lima Oliveira
* @date 18/01/2017
* @file PowerElement.h
* @brief Base class of power elements.
*/
class PowerElement : public Element
{
public:
/**
* @brief Constructor
*/
PowerElement();
/**
* @brief Destructor.
*/
~PowerElement();
/**
* @brief Get the correct switch position.
* @param parent Bus with switch.
* @param parentPoint Position of node on parent.
* @param secondPoint Next point in element.
*/
virtual wxPoint2DDouble GetSwitchPoint(Element* parent,
wxPoint2DDouble parentPoint,
wxPoint2DDouble secondPoint) const;
/**
* @brief Check if switch contains position.
* @param position position to be checked.
*/
virtual bool SwitchesContains(wxPoint2DDouble position) const;
/**
* @brief Update the switch position.
*/
virtual void UpdateSwitches();
/**
* @brief Draw switch.
*/
virtual void DrawSwitches() const;
/**
* @brief Calculate the points of the power flow arrows.
* @param edges Points of the element that arrows point.
*/
virtual void CalculatePowerFlowPts(std::vector<wxPoint2DDouble> edges);
/**
* @brief Draw power flow arrows.
*/
virtual void DrawPowerFlowPts() const;
/**
* @brief Set nominal voltage of the element.
* @param nominalVoltage Value of the nominal voltage.
* @param nominalVoltageUnit Unit of the nominal voltage.
*/
virtual void SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit);
/**
* @brief Set the switching data of the element.
* @param data Switching data.
*/
virtual void SetSwitchingData(SwitchingData data) { m_swData = data; }
/**
* @brief Returns the switching data of the element.
* @return Element switching data.
*/
virtual SwitchingData GetSwitchingData() { return m_swData; }
/**
* @brief Set the direction of the power flow.
* @param pfDirection Power flow direction.
*/
virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection) { m_pfDirection = pfDirection; }
/**
* @brief Return the direction of the power flow.
* @return Power flow direction.
*/
virtual PowerFlowDirection GetPowerFlowDirection() const { return m_pfDirection; }
/**
* @brief Fill the plot data.
* @param plotData Plot data to be filled.
* @return true if the plot data was successfully filled, false otherwise.
*/
virtual bool GetPlotData(ElementPlotData& plotData) { return false; }
/**
* @brief Check if the power element have dynamic event.
* @return true if the element have dynamic an event, false otherwise.
*/
virtual bool HaveDynamicEvent() const { return m_dynEvent; }
/**
* @brief Set if the power element have dynamic event.
* @param dynEvent Event occurrence.
*/
virtual void SetDynamicEvent(bool dynEvent = true) { m_dynEvent = dynEvent; }
protected:
SwitchingData m_swData;
std::vector<std::vector<wxPoint2DDouble> > m_powerFlowArrow;
PowerFlowDirection m_pfDirection = PF_NONE;
OpenGLColour m_busColour;
OpenGLColour m_onlineElementColour;
OpenGLColour m_offlineElementColour;
OpenGLColour m_closedSwitchColour;
OpenGLColour m_openedSwitchColour;
OpenGLColour m_powerFlowArrowColour;
OpenGLColour m_dynamicEventColour;
bool m_dynEvent = false;
};
#endif // POWERELEMENT_H
|